From 585fba50b00b5716bbde7a1b05cbab114af8cdb0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 12:53:03 +0100 Subject: Adding upstream version 1.18~pre2. Signed-off-by: Daniel Baumann --- range_dec.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'range_dec.cc') 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; } -- cgit v1.2.3