summaryrefslogtreecommitdiffstats
path: root/decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.c')
-rw-r--r--decoder.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/decoder.c b/decoder.c
index 8061465..3511f9a 100644
--- a/decoder.c
+++ b/decoder.c
@@ -1,4 +1,4 @@
-/* Lunzip - Decompressor for lzip files
+/* Lunzip - Decompressor for the lzip format
Copyright (C) 2010-2015 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
@@ -38,11 +38,10 @@ void Pp_show_msg( struct Pretty_print * const pp, const char * const msg )
{
if( pp->first_post )
{
- int i, len;
+ int i, len = pp->longest_name - strlen( pp->name );
pp->first_post = false;
fprintf( stderr, " %s: ", pp->name );
- len = pp->longest_name - strlen( pp->name );
- for( i = 0; i < len; ++i ) fprintf( stderr, " " );
+ for( i = 0; i < len; ++i ) fputc( ' ', stderr );
if( !msg ) fflush( stderr );
}
if( msg ) fprintf( stderr, "%s\n", msg );
@@ -162,7 +161,7 @@ static bool LZd_verify_trailer( struct LZ_decoder * const d,
if( verbosity >= 0 )
{
Pp_show_msg( pp, 0 );
- fprintf( stderr, "CRC mismatch; trailer says %08X, data CRC is %08X.\n",
+ fprintf( stderr, "CRC mismatch; trailer says %08X, data CRC is %08X\n",
trailer_crc, LZd_crc( d ) );
}
}
@@ -173,7 +172,7 @@ static bool LZd_verify_trailer( struct LZ_decoder * const d,
if( verbosity >= 0 )
{
Pp_show_msg( pp, 0 );
- fprintf( stderr, "Data size mismatch; trailer says %llu, data size is %llu (0x%llX).\n",
+ fprintf( stderr, "Data size mismatch; trailer says %llu, data size is %llu (0x%llX)\n",
trailer_data_size, LZd_data_position( d ), LZd_data_position( d ) );
}
}
@@ -184,7 +183,7 @@ static bool LZd_verify_trailer( struct LZ_decoder * const d,
if( verbosity >= 0 )
{
Pp_show_msg( pp, 0 );
- fprintf( stderr, "Member size mismatch; trailer says %llu, member size is %llu (0x%llX).\n",
+ fprintf( stderr, "Member size mismatch; trailer says %llu, member size is %llu (0x%llX)\n",
trailer_member_size, member_size, member_size );
}
}
@@ -237,7 +236,7 @@ int LZd_decode_member( struct LZ_decoder * const d,
LZd_peek( d, rep0 ) ) );
}
}
- else
+ else /* match or repeated match */
{
int len;
if( Rd_decode_bit( rdec, &d->bm_rep[state] ) != 0 ) /* 2nd bit */
@@ -267,7 +266,7 @@ int LZd_decode_member( struct LZ_decoder * const d,
state = St_set_rep( state );
len = min_match_len + Rd_decode_len( rdec, &d->rep_len_model, pos_state );
}
- else
+ else /* match */
{
int dis_slot;
const unsigned rep0_saved = rep0;
@@ -301,7 +300,7 @@ int LZd_decode_member( struct LZ_decoder * const d,
if( verbosity >= 0 )
{
Pp_show_msg( pp, 0 );
- fprintf( stderr, "Unsupported marker code '%d'.\n", len );
+ fprintf( stderr, "Unsupported marker code '%d'\n", len );
}
return 4;
}