summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 07:25:07 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 07:25:07 +0000
commitcc850a231b6eb35f6a7513455f85fd51a299af71 (patch)
tree4a73324f0332390d84c3d83843444e68e833eff4 /decoder.cc
parentAdding upstream version 1.6. (diff)
downloadlzip-cc850a231b6eb35f6a7513455f85fd51a299af71.tar.xz
lzip-cc850a231b6eb35f6a7513455f85fd51a299af71.zip
Adding upstream version 1.7.upstream/1.7
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'decoder.cc')
-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 );
}
}
}