summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 07:25:15 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 07:25:15 +0000
commit30614e95829d832d1bd3038109132fe56ea085da (patch)
treec613ffcab3d7ef6c3b62e47daf127a36dd88be89 /decoder.cc
parentAdding debian version 1.6-1. (diff)
downloadlzip-30614e95829d832d1bd3038109132fe56ea085da.tar.xz
lzip-30614e95829d832d1bd3038109132fe56ea085da.zip
Merging upstream version 1.7.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--decoder.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/decoder.cc b/decoder.cc
index 0cb6188..6c0c775 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -125,12 +125,11 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const
// 3 = trailer error, 4 = unknown marker found.
int LZ_decoder::decode_member( const Pretty_print & pp )
{
- unsigned int rep0 = 0;
- unsigned int rep1 = 0;
- unsigned int rep2 = 0;
+ unsigned int rep0 = 0; // rep[0-3] latest four distances
+ unsigned int rep1 = 0; // used for efficient coding of
+ unsigned int rep2 = 0; // repeated distances
unsigned int rep3 = 0;
State state;
- uint8_t prev_byte = 0;
while( true )
{
@@ -139,11 +138,10 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
if( range_decoder.decode_bit( bm_match[state()][pos_state] ) == 0 )
{
if( state.is_char() )
- prev_byte = literal_decoder.decode( range_decoder, prev_byte );
+ put_byte( literal_decoder.decode( range_decoder, get_byte( 0 ) ) );
else
- prev_byte = literal_decoder.decode_matched( range_decoder, prev_byte,
- get_byte( rep0 ) );
- put_byte( prev_byte );
+ put_byte( literal_decoder.decode_matched( range_decoder, get_byte( 0 ),
+ get_byte( rep0 ) ) );
state.set_char();
}
else
@@ -222,7 +220,6 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
state.set_match();
}
copy_block( rep0, len );
- prev_byte = get_byte( 0 );
}
}
}