diff options
Diffstat (limited to 'decoder.h')
-rw-r--r-- | decoder.h | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -1,5 +1,5 @@ /* Lzip - LZMA lossless data compressor - Copyright (C) 2008-2022 Antonio Diaz Diaz. + Copyright (C) 2008-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 @@ -75,12 +75,14 @@ public: return sz; } - void load() + bool load( const bool ignore_marking = true ) { code = 0; - for( int i = 0; i < 5; ++i ) code = ( code << 8 ) | get_byte(); range = 0xFFFFFFFFU; - code &= range; // make sure that first byte is discarded + // check and discard first byte of the LZMA stream + if( get_byte() != 0 && !ignore_marking ) return false; + for( int i = 0; i < 4; ++i ) code = ( code << 8 ) | get_byte(); + return true; } void normalize() @@ -268,7 +270,7 @@ class LZ_decoder bool pos_wrapped; void flush_data(); - bool verify_trailer( const Pretty_print & pp ) const; + int check_trailer( const Pretty_print & pp, const bool ignore_empty ) const; uint8_t peek_prev() const { return buffer[((pos > 0) ? pos : dictionary_size)-1]; } @@ -340,5 +342,5 @@ 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 ); + int decode_member( const Cl_options & cl_opts, const Pretty_print & pp ); }; |