summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.h')
-rw-r--r--decoder.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/decoder.h b/decoder.h
index 03adbbb..99a9f84 100644
--- a/decoder.h
+++ b/decoder.h
@@ -1,5 +1,5 @@
/* Lziprecover - Data recovery tool for the lzip format
- Copyright (C) 2009-2023 Antonio Diaz Diaz.
+ Copyright (C) 2009-2024 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -81,7 +81,7 @@ public:
int read_header_carefully( Lzip_header & header, const bool ignore_errors )
{
int sz = 0;
- while( sz < Lzip_header::size && !finished() )
+ while( sz < header.size && !finished() )
{
header.data[sz] = buffer[pos];
if( ignore_errors &&
@@ -100,18 +100,18 @@ public:
if( buffer[pos] != lzip_magic[0] ) { ++pos; continue; }
reset_member_position();
Lzip_header h;
- if( read_header_carefully( h, true ) == Lzip_header::size )
+ if( read_header_carefully( h, true ) == header.size )
{ header = h; return true; }
}
return false;
}
- bool load( const bool ignore_marking = true )
+ bool load( const bool ignore_nonzero )
{
code = 0;
range = 0xFFFFFFFFU;
- // check and discard first byte of the LZMA stream
- if( get_byte() != 0 && !ignore_marking ) return false;
+ // check first byte of the LZMA stream
+ if( get_byte() != 0 && !ignore_nonzero ) return false;
for( int i = 0; i < 4; ++i ) code = ( code << 8 ) | get_byte();
return true;
}
@@ -305,7 +305,7 @@ class LZ_decoder
unsigned long long stream_position() const
{ return partial_data_pos + stream_pos; }
void flush_data();
- int check_trailer( const Pretty_print & pp, const bool ignore_empty ) const;
+ bool check_trailer( const Pretty_print & pp ) const;
uint8_t peek_prev() const
{ return buffer[((pos > 0) ? pos : dictionary_size)-1]; }
@@ -381,6 +381,7 @@ public:
unsigned crc() const { return crc_ ^ 0xFFFFFFFFU; }
unsigned long long data_position() const { return partial_data_pos + pos; }
- int decode_member( const Pretty_print & pp, const bool ignore_empty = true,
- const bool ignore_marking = true );
+ int decode_member( const Pretty_print & pp, const bool ignore_nonzero );
+ int decode_member()
+ { return decode_member( Pretty_print( "" ), true ); }
};