diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 07:23:06 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 07:23:06 +0000 |
commit | 4b650df10dcb0f7aa36b40f517e3ddb85b1198e4 (patch) | |
tree | 41c04636a5e74aa432e5f44d5904e805cae51790 /decoder.cc | |
parent | Adding debian version 1.6~pre1-1. (diff) | |
download | lzip-4b650df10dcb0f7aa36b40f517e3ddb85b1198e4.tar.xz lzip-4b650df10dcb0f7aa36b40f517e3ddb85b1198e4.zip |
Merging upstream version 1.6~pre2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | decoder.cc | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -47,6 +47,7 @@ void LZ_decoder::flush_data() { if( !member_finished ) { + crc32.update( crc_, buffer, pos ); if( odes_ >= 0 ) { const int wr = writeblock( odes_, (char *)buffer, pos ); @@ -65,7 +66,9 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const const int trailer_size = trailer.size( format_version ); for( int i = 0; i < trailer_size && !error; ++i ) { - if( range_decoder.finished() ) + if( !range_decoder.finished() ) + ((uint8_t *)&trailer)[i] = range_decoder.get_byte(); + else { error = true; if( verbosity >= 0 ) @@ -75,7 +78,6 @@ bool LZ_decoder::verify_trailer( const Pretty_print & pp ) const " some checks may fail.\n", i ); } } - ((uint8_t *)&trailer)[i] = range_decoder.read_byte(); } if( format_version == 0 ) trailer.member_size( member_position() ); if( trailer.data_crc() != crc() ) @@ -195,23 +197,22 @@ int LZ_decoder::decode_member( const Pretty_print & pp ) rep0 += range_decoder.decode_tree_reversed( bm_align, dis_align_bits ); if( rep0 == 0xFFFFFFFF ) // Marker found { + range_decoder.normalize(); + flush_data(); if( len == min_match_len ) // End Of Stream marker - { - flush_data(); - if( verify_trailer( pp ) ) return 0; else return 3; - } + { if( verify_trailer( pp ) ) return 0; else return 3; } if( verbosity >= 0 ) { pp(); std::fprintf( stderr, "unsupported marker code `%d'.\n", len ); } - flush_data(); return 4; } + if( rep0 >= (unsigned int)buffer_size ) { flush_data(); return 1; } } } } - if( !copy_block( rep0, len ) ) { flush_data(); return 1; } + copy_block( rep0, len ); prev_byte = get_byte( 0 ); } } |