summaryrefslogtreecommitdiffstats
path: root/decoder.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-25 13:57:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-01-25 13:57:19 +0000
commit43dcb3aa74b5cbea293b296f161006f739b5a754 (patch)
tree3fb004d6e2437743a557510e7a0cfb587246becd /decoder.c
parentReleasing debian version 1.11-8. (diff)
downloadlzlib-43dcb3aa74b5cbea293b296f161006f739b5a754.tar.xz
lzlib-43dcb3aa74b5cbea293b296f161006f739b5a754.zip
Merging upstream version 1.12.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'decoder.c')
-rw-r--r--decoder.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/decoder.c b/decoder.c
index 3dc62cc..82472b3 100644
--- a/decoder.c
+++ b/decoder.c
@@ -1,27 +1,27 @@
-/* Lzlib - Compression library for the lzip format
- Copyright (C) 2009-2019 Antonio Diaz Diaz.
+/* Lzlib - Compression library for the lzip format
+ Copyright (C) 2009-2021 Antonio Diaz Diaz.
- This library is free software. Redistribution and use in source and
- binary forms, with or without modification, are permitted provided
- that the following conditions are met:
+ This library is free software. Redistribution and use in source and
+ binary forms, with or without modification, are permitted provided
+ that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions, and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- This library 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.
+ This library 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.
*/
static int LZd_try_verify_trailer( struct LZ_decoder * const d )
{
Lzip_trailer trailer;
- if( Rd_available_bytes( d->rdec ) < Lt_size && !d->rdec->at_stream_end )
- return 0;
+ if( Rd_available_bytes( d->rdec ) < Lt_size )
+ { if( !d->rdec->at_stream_end ) return 0; else return 2; }
d->verify_trailer_pending = false;
d->member_finished = true;
@@ -40,10 +40,10 @@ static int LZd_decode_member( struct LZ_decoder * const d )
{
struct Range_decoder * const rdec = d->rdec;
State * const state = &d->state;
- /* unsigned old_mpos = d->rdec->member_position; */
+ /* unsigned old_mpos = rdec->member_position; */
if( d->member_finished ) return 0;
- if( !Rd_try_reload( rdec, false ) )
+ if( !Rd_try_reload( rdec ) )
{ if( !rdec->at_stream_end ) return 0; else return 2; }
if( d->verify_trailer_pending ) return LZd_try_verify_trailer( d );
@@ -51,7 +51,7 @@ static int LZd_decode_member( struct LZ_decoder * const d )
{
int len;
const int pos_state = LZd_data_position( d ) & pos_state_mask;
- /* const unsigned mpos = d->rdec->member_position;
+ /* const unsigned mpos = rdec->member_position;
if( mpos - old_mpos > rd_min_available_bytes ) return 5;
old_mpos = mpos; */
if( !Rd_enough_available_bytes( rdec ) ) /* check unexpected EOF */
@@ -123,6 +123,9 @@ static int LZd_decode_member( struct LZ_decoder * const d )
if( distance == 0xFFFFFFFFU ) /* marker found */
{
Rd_normalize( rdec );
+ /* const unsigned mpos = rdec->member_position;
+ if( mpos - old_mpos > rd_min_available_bytes ) return 5;
+ old_mpos = mpos; */
if( len == min_match_len ) /* End Of Stream marker */
{
d->verify_trailer_pending = true;
@@ -130,7 +133,8 @@ static int LZd_decode_member( struct LZ_decoder * const d )
}
if( len == min_match_len + 1 ) /* Sync Flush marker */
{
- if( Rd_try_reload( rdec, true ) ) { /*old_mpos += 5;*/ continue; }
+ rdec->reload_pending = true;
+ if( Rd_try_reload( rdec ) ) continue;
else { if( !rdec->at_stream_end ) return 0; else break; }
}
return 4;