1
0
Fork 0

Adding upstream version 1.5~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-17 22:13:05 +01:00
parent 44c75e168c
commit df42bf1fa4
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
11 changed files with 245 additions and 43 deletions

View file

@ -87,6 +87,15 @@ static int writeblock( const int fd, const uint8_t * const buf, const int size )
}
int seek_read( const int fd, uint8_t * const buf, const int size,
const int offset )
{
if( lseek( fd, offset, SEEK_END ) >= 0 )
return readblock( fd, buf, size );
return 0;
}
bool Rd_read_block( struct Range_decoder * const rdec )
{
if( !rdec->at_stream_end )
@ -193,6 +202,10 @@ int LZd_decode_member( struct LZ_decoder * const decoder,
struct Pretty_print * const pp )
{
struct Range_decoder * const rdec = decoder->rdec;
void (* const copy_block)
( struct LZ_decoder * const decoder, const int distance, int len ) =
( decoder->buffer_size >= decoder->dictionary_size ) ?
&LZd_copy_block : &LZd_copy_block2;
unsigned rep0 = 0; /* rep[0-3] latest four distances */
unsigned rep1 = 0; /* used for efficient coding of */
unsigned rep2 = 0; /* repeated distances */
@ -293,10 +306,10 @@ int LZd_decode_member( struct LZ_decoder * const decoder,
rep3 = rep2; rep2 = rep1; rep1 = rep0_saved;
state = St_set_match( state );
if( rep0 >= (unsigned)decoder->dictionary_size ||
( rep0 >= (unsigned)decoder->pos && !decoder->partial_data_pos ) )
rep0 >= LZd_data_position( decoder ) )
{ LZd_flush_data( decoder ); return 1; }
}
LZd_copy_block( decoder, rep0, len );
copy_block( decoder, rep0, len );
}
}
LZd_flush_data( decoder );