summaryrefslogtreecommitdiffstats
path: root/decoder.c
diff options
context:
space:
mode:
Diffstat (limited to 'decoder.c')
-rw-r--r--decoder.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/decoder.c b/decoder.c
index 3095015..63d30ea 100644
--- a/decoder.c
+++ b/decoder.c
@@ -1,18 +1,18 @@
-/* Lunzip - Decompressor for the lzip format
- Copyright (C) 2010-2019 Antonio Diaz Diaz.
+/* Lunzip - Decompressor for the lzip format
+ Copyright (C) 2010-2021 Antonio Diaz Diaz.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 2 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _FILE_OFFSET_BITS 64
@@ -104,9 +104,8 @@ void LZd_flush_data( struct LZ_decoder * const d )
writeblock( d->outfd, d->buffer + d->stream_pos, size ) != size )
{ show_error( "Write error", errno, false ); cleanup_and_fail( 1 ); }
if( d->pos >= d->buffer_size )
- { d->partial_data_pos += d->pos; d->pos = 0; d->pos_wrapped = true;
- if( d->partial_data_pos >= d->dictionary_size )
- d->pos_wrapped_dic = true; }
+ { d->partial_data_pos += d->pos; d->pos = 0;
+ if( d->partial_data_pos >= d->dictionary_size ) d->pos_wrapped = true; }
d->stream_pos = d->pos;
}
}
@@ -173,16 +172,15 @@ static bool LZd_verify_trailer( struct LZ_decoder * const d,
{
if( verbosity >= 4 ) show_header( d->dictionary_size );
if( data_size == 0 || member_size == 0 )
- fputs( "no data compressed. ", stderr );
+ fputs( "no data compressed. ", stderr );
else
- fprintf( stderr, "%6.3f:1, %5.2f%% ratio, %5.2f%% saved. ",
+ fprintf( stderr, "%6.3f:1, %5.2f%% ratio, %5.2f%% saved. ",
(double)data_size / member_size,
( 100.0 * member_size ) / data_size,
100.0 - ( ( 100.0 * member_size ) / data_size ) );
if( verbosity >= 4 ) fprintf( stderr, "CRC %08X, ", td_crc );
if( verbosity >= 3 )
- fprintf( stderr, "decompressed %9llu, compressed %8llu. ",
- data_size, member_size );
+ fprintf( stderr, "%9llu out, %8llu in. ", data_size, member_size );
}
return true;
}
@@ -320,7 +318,7 @@ int LZd_decode_member( struct LZ_decoder * const d,
rep3 = rep2; rep2 = rep1; rep1 = rep0; rep0 = distance;
state = St_set_match( state );
if( rep0 >= d->dictionary_size ||
- ( rep0 >= LZd_data_position( d ) && !d->pos_wrapped_dic ) )
+ ( !d->pos_wrapped && rep0 >= LZd_data_position( d ) ) )
{ LZd_flush_data( d ); return 1; }
}
copy_block( d, rep0, len );