summaryrefslogtreecommitdiffstats
path: root/decoder.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:42:39 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 11:42:39 +0000
commit04d72dd06c3c49fcc61e5ae7b8cee112d34e8df1 (patch)
treeaadf6684ddb287ecaaa4bfc482ab8859ce3742cb /decoder.cc
parentAdding debian version 1.15~pre1-2. (diff)
downloadlziprecover-04d72dd06c3c49fcc61e5ae7b8cee112d34e8df1.tar.xz
lziprecover-04d72dd06c3c49fcc61e5ae7b8cee112d34e8df1.zip
Merging upstream version 1.15~rc1.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'decoder.cc')
-rw-r--r--decoder.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/decoder.cc b/decoder.cc
index 497471c..379aa3d 100644
--- a/decoder.cc
+++ b/decoder.cc
@@ -1,4 +1,4 @@
-/* Lziprecover - Data recovery tool for lzipped files
+/* Lziprecover - Data recovery tool for lzip files
Copyright (C) 2009, 2010, 2011, 2012, 2013 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
@@ -104,10 +104,10 @@ bool Range_decoder::read_block()
void LZ_decoder::flush_data()
{
- const int size = pos - stream_pos;
- if( size > 0 )
+ if( pos > stream_pos )
{
- crc32.update( crc_, buffer + stream_pos, size );
+ const int size = pos - stream_pos;
+ crc32.update_buf( crc_, buffer + stream_pos, size );
if( outfd >= 0 )
{
const unsigned long long sp = stream_position();
@@ -207,7 +207,6 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
Bit_model bm_align[dis_align_size];
Len_model match_len_model;
Len_model rep_len_model;
-
unsigned rep0 = 0; // rep[0-3] latest four distances
unsigned rep1 = 0; // used for efficient coding of
unsigned rep2 = 0; // repeated distances
@@ -222,11 +221,16 @@ int LZ_decoder::decode_member( const Pretty_print & pp )
{
const uint8_t prev_byte = get_prev_byte();
if( state.is_char() )
+ {
+ state.set_char1();
put_byte( rdec.decode_tree( bm_literal[get_lit_state(prev_byte)], 8 ) );
+ }
else
+ {
+ state.set_char2();
put_byte( rdec.decode_matched( bm_literal[get_lit_state(prev_byte)],
get_byte( rep0 ) ) );
- state.set_char();
+ }
}
else
{