summaryrefslogtreecommitdiffstats
path: root/range_dec.cc
diff options
context:
space:
mode:
Diffstat (limited to 'range_dec.cc')
-rw-r--r--range_dec.cc20
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;
}