summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.h')
-rw-r--r--decoder.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/decoder.h b/decoder.h
index f0d2de6..df3b46f 100644
--- a/decoder.h
+++ b/decoder.h
@@ -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; }