diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-16 22:53:52 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-02-16 22:53:52 +0000 |
commit | 006e85e57e005079065991a735a5007ab99f7071 (patch) | |
tree | 06ad797bb9415413b606043f87213703d02e0505 /decoder.h | |
parent | Adding upstream version 1.19. (diff) | |
download | lzip-006e85e57e005079065991a735a5007ab99f7071.tar.xz lzip-006e85e57e005079065991a735a5007ab99f7071.zip |
Adding upstream version 1.20.upstream/1.20
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'decoder.h')
-rw-r--r-- | decoder.h | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -1,5 +1,5 @@ /* Lzip - LZMA lossless data compressor - Copyright (C) 2008-2017 Antonio Diaz Diaz. + Copyright (C) 2008-2018 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 @@ -222,11 +222,7 @@ class LZ_decoder bool verify_trailer( const Pretty_print & pp ) const; uint8_t peek_prev() const - { - if( pos > 0 ) return buffer[pos-1]; - if( pos_wrapped ) return buffer[dictionary_size-1]; - return 0; // prev_byte of first byte - } + { return buffer[((pos > 0) ? pos : dictionary_size)-1]; } uint8_t peek( const unsigned distance ) const { @@ -287,7 +283,8 @@ public: crc_( 0xFFFFFFFFU ), outfd( ofd ), pos_wrapped( false ) - {} + // prev_byte of first byte; also for peek( 0 ) on corrupt file + { buffer[dictionary_size-1] = 0; } ~LZ_decoder() { delete[] buffer; } |