From a9dff770f27dfbcef3bf768146324b03c810bfb8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 23 Jan 2024 06:27:08 +0100 Subject: Merging upstream version 1.24~rc2. Signed-off-by: Daniel Baumann --- decoder.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'decoder.h') diff --git a/decoder.h b/decoder.h index 29fdef6..cf10f3d 100644 --- a/decoder.h +++ b/decoder.h @@ -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 ); }; -- cgit v1.2.3