diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:53:03 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 11:53:03 +0000 |
commit | 585fba50b00b5716bbde7a1b05cbab114af8cdb0 (patch) | |
tree | df705039ddf6d248ae0755a2a80c439b7b2aeee6 /range_dec.cc | |
parent | Adding upstream version 1.18~pre1. (diff) | |
download | lziprecover-585fba50b00b5716bbde7a1b05cbab114af8cdb0.tar.xz lziprecover-585fba50b00b5716bbde7a1b05cbab114af8cdb0.zip |
Adding upstream version 1.18~pre2.upstream/1.18_pre2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'range_dec.cc')
-rw-r--r-- | range_dec.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/range_dec.cc b/range_dec.cc index d4a2b2c..c6ccb7a 100644 --- a/range_dec.cc +++ b/range_dec.cc @@ -48,16 +48,7 @@ int decompress_member( const int infd, const int outfd, rdec.read_data( header.data, File_header::size ); if( rdec.finished() ) // End Of File { pp( "File ends unexpectedly at member header." ); return 2; } - if( !header.verify_magic() ) - { pp( "Bad magic number (file not in lzip format)." ); return 2; } - if( !header.verify_version() ) - { - if( pp.verbosity() >= 0 ) - { pp(); - std::fprintf( stderr, "Version %d member format not supported.\n", - header.version() ); } - return 2; - } + if( !verify_header( header, pp ) ) return 2; const unsigned dictionary_size = header.dictionary_size(); if( dictionary_size < min_dictionary_size || dictionary_size > max_dictionary_size ) @@ -101,7 +92,12 @@ int list_file( const char * const input_filename, const Pretty_print & pp ) { const unsigned long long data_size = file_index.data_end(); const unsigned long long file_size = file_index.file_end(); + unsigned dictionary_size = 0; + for( long i = 0; i < file_index.members(); ++i ) + if( dictionary_size < file_index.dictionary_size( i ) ) + dictionary_size = file_index.dictionary_size( i ); pp( 0, stdout ); + show_header( dictionary_size, 1 ); if( data_size > 0 && file_size > 0 ) std::printf( "%6.3f:1, %6.3f bits/byte, %5.2f%% saved. ", (double)data_size / file_size, @@ -123,6 +119,10 @@ int list_file( const char * const input_filename, const Pretty_print & pp ) db.pos(), db.size(), mb.pos(), mb.size() ); } } + const long long trailing_size = file_index.file_size() - file_index.file_end(); + if( pp.verbosity() >= 1 && trailing_size > 0 ) + std::printf( " %lld bytes of trailing data at end of file.\n", + trailing_size ); } return 0; } |