diff options
Diffstat (limited to 'decoder.c')
-rw-r--r-- | decoder.c | 30 |
1 files changed, 13 insertions, 17 deletions
@@ -34,7 +34,7 @@ CRC32 crc32; void Pp_show_msg( struct Pretty_print * const pp, const char * const msg ) { - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { if( pp->first_post ) { @@ -122,26 +122,23 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder, struct Pretty_print * const pp ) { File_trailer trailer; - const int trailer_size = Ft_versioned_size( decoder->member_version ); const unsigned long long member_size = - Rd_member_position( decoder->rdec ) + trailer_size; + Rd_member_position( decoder->rdec ) + Ft_size; bool error = false; - int size = Rd_read_data( decoder->rdec, trailer, trailer_size ); - if( size < trailer_size ) + int size = Rd_read_data( decoder->rdec, trailer, Ft_size ); + if( size < Ft_size ) { error = true; - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { Pp_show_msg( pp, 0 ); fprintf( stderr, "Trailer truncated at trailer position %d;" " some checks may fail.\n", size ); } - while( size < trailer_size ) trailer[size++] = 0; + while( size < Ft_size ) trailer[size++] = 0; } - if( decoder->member_version == 0 ) Ft_set_member_size( trailer, member_size ); - if( decoder->rdec->code != 0 ) { error = true; @@ -150,7 +147,7 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder, if( Ft_get_data_crc( trailer ) != LZd_crc( decoder ) ) { error = true; - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { Pp_show_msg( pp, 0 ); fprintf( stderr, "CRC mismatch; trailer says %08X, data CRC is %08X.\n", @@ -160,7 +157,7 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder, if( Ft_get_data_size( trailer ) != LZd_data_position( decoder ) ) { error = true; - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { Pp_show_msg( pp, 0 ); fprintf( stderr, "Data size mismatch; trailer says %llu, data size is %llu (0x%llX).\n", @@ -170,19 +167,19 @@ bool LZd_verify_trailer( struct LZ_decoder * const decoder, if( Ft_get_member_size( trailer ) != member_size ) { error = true; - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { Pp_show_msg( pp, 0 ); fprintf( stderr, "Member size mismatch; trailer says %llu, member size is %llu (0x%llX).\n", Ft_get_member_size( trailer ), member_size, member_size ); } } - if( !error && pp->verbosity >= 2 && LZd_data_position( decoder ) > 0 && member_size > 0 ) + if( !error && verbosity >= 2 && LZd_data_position( decoder ) > 0 && member_size > 0 ) fprintf( stderr, "%6.3f:1, %6.3f bits/byte, %5.2f%% saved. ", (double)LZd_data_position( decoder ) / member_size, ( 8.0 * member_size ) / LZd_data_position( decoder ), 100.0 * ( 1.0 - ( (double)member_size / LZd_data_position( decoder ) ) ) ); - if( !error && pp->verbosity >= 4 ) + if( !error && verbosity >= 4 ) fprintf( stderr, "data CRC %08X, data size %9llu, member size %8llu. ", Ft_get_data_crc( trailer ), Ft_get_data_size( trailer ), Ft_get_member_size( trailer ) ); @@ -266,8 +263,7 @@ int LZd_decode_member( struct LZ_decoder * const decoder, rep0 = ( 2 | ( dis_slot & 1 ) ) << direct_bits; if( dis_slot < end_dis_model ) rep0 += Rd_decode_tree_reversed( rdec, - decoder->bm_dis + rep0 - dis_slot - 1, - direct_bits ); + decoder->bm_dis + rep0 - dis_slot - 1, direct_bits ); else { rep0 += Rd_decode( rdec, direct_bits - dis_align_bits ) << dis_align_bits; @@ -285,7 +281,7 @@ int LZd_decode_member( struct LZ_decoder * const decoder, { Rd_load( rdec ); continue; } - if( pp->verbosity >= 0 ) + if( verbosity >= 0 ) { Pp_show_msg( pp, 0 ); fprintf( stderr, "Unsupported marker code '%d'.\n", len ); |