summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.cc')
-rw-r--r--decoder.cc16
1 files changed, 7 insertions, 9 deletions
diff --git a/decoder.cc b/decoder.cc
index 8ed1aae..497471c 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -126,7 +126,7 @@ void LZ_decoder::flush_data()
bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const
{
File_trailer trailer;
- const int trailer_size = File_trailer::size( member_version );
+ const int trailer_size = File_trailer::size;
const unsigned long long member_size =
rdec.member_position() + trailer_size;
bool error = false;
@@ -144,8 +144,6 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const
while( size < trailer_size ) trailer.data[size++] = 0;
}
- if( member_version == 0 ) trailer.member_size( member_size );
-
if( !rdec.code_is_zero() )
{
error = true;
@@ -220,7 +218,7 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
while( !rdec.finished() )
{
const int pos_state = data_position() & pos_state_mask;
- if( rdec.decode_bit( bm_match[state()][pos_state] ) == 0 )
+ if( rdec.decode_bit( bm_match[state()][pos_state] ) == 0 ) // 1st bit
{
const uint8_t prev_byte = get_prev_byte();
if( state.is_char() )
@@ -233,21 +231,21 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
else
{
int len;
- if( rdec.decode_bit( bm_rep[state()] ) == 1 )
+ if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit
{
- if( rdec.decode_bit( bm_rep0[state()] ) == 0 )
+ if( rdec.decode_bit( bm_rep0[state()] ) == 0 ) // 3rd bit
{
- if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 )
+ if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit
{ state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; }
}
else
{
unsigned distance;
- if( rdec.decode_bit( bm_rep1[state()] ) == 0 )
+ if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit
distance = rep1;
else
{
- if( rdec.decode_bit( bm_rep2[state()] ) == 0 )
+ if( rdec.decode_bit( bm_rep2[state()] ) == 0 ) // 5th bit
distance = rep2;
else
{ distance = rep3; rep3 = rep2; }