diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-06-03 15:51:27 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-06-03 15:51:27 +0000 |
commit | 38cff5f25d4d9225f35375c3554fb35e9048733e (patch) | |
tree | 77a10b67d8f703d558df0fd5cc4dd7856ebe225b /decoder.h | |
parent | Adding upstream version 1.18~pre1. (diff) | |
download | lzip-38cff5f25d4d9225f35375c3554fb35e9048733e.tar.xz lzip-38cff5f25d4d9225f35375c3554fb35e9048733e.zip |
Adding upstream version 1.18.upstream/1.18
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'decoder.h')
-rw-r--r-- | decoder.h | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,5 @@ /* Lzip - LZMA lossless data compressor - Copyright (C) 2008-2015 Antonio Diaz Diaz. + Copyright (C) 2008-2016 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 @@ -47,14 +47,14 @@ public: ~Range_decoder() { delete[] buffer; } - bool code_is_zero() const { return ( code == 0 ); } bool finished() { return pos >= stream_pos && !read_block(); } unsigned long long member_position() const { return partial_member_pos + pos; } void reset_member_position() { partial_member_pos = -pos; } uint8_t get_byte() { - if( finished() ) return 0xAA; // make code != 0 + // 0xFF avoids decoder error if member is truncated at EOS marker + if( finished() ) return 0xFF; return buffer[pos++]; } @@ -217,7 +217,7 @@ class LZ_decoder unsigned stream_pos; // first byte not yet written to file uint32_t crc_; const int outfd; // output file descriptor - const int member_version; + bool pos_wrapped; void flush_data(); bool verify_trailer( const Pretty_print & pp ) const; @@ -267,17 +267,17 @@ class LZ_decoder void operator=( const LZ_decoder & ); // declared as private public: - LZ_decoder( const File_header & header, Range_decoder & rde, const int ofd ) + LZ_decoder( Range_decoder & rde, const unsigned dict_size, const int ofd ) : partial_data_pos( 0 ), rdec( rde ), - dictionary_size( header.dictionary_size() ), + dictionary_size( dict_size ), buffer( new uint8_t[dictionary_size] ), pos( 0 ), stream_pos( 0 ), crc_( 0xFFFFFFFFU ), outfd( ofd ), - member_version( header.version() ) + pos_wrapped( false ) { buffer[dictionary_size-1] = 0; } // prev_byte of first byte ~LZ_decoder() { delete[] buffer; } |