1
0
Fork 0

Merging upstream version 0.4.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-20 14:27:34 +01:00
parent ba75e35833
commit ef9b582bb4
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
5 changed files with 18 additions and 14 deletions

View file

@ -1,3 +1,8 @@
2013-08-01 Antonio Diaz Diaz <antonio@gnu.org>
* Version 0.4 released.
* testsuite/check.sh: Removed '/dev/full' from tests.
2013-07-24 Antonio Diaz Diaz <antonio@gnu.org> 2013-07-24 Antonio Diaz Diaz <antonio@gnu.org>
* Version 0.3 released. * Version 0.3 released.

4
NEWS
View file

@ -1,3 +1,3 @@
Changes in version 0.3: Changes in version 0.4:
All the code is now contained in a single file (lzd.cc). A portability problem in the testsuite has been fixed.

2
configure vendored
View file

@ -6,7 +6,7 @@
# to copy, distribute and modify it. # to copy, distribute and modify it.
pkgname=lzd pkgname=lzd
pkgversion=0.3 pkgversion=0.4
progname=lzd progname=lzd
srctrigger=lzd.cc srctrigger=lzd.cc

19
lzd.cc
View file

@ -110,7 +110,8 @@ public:
} }
} }
void update( uint32_t & crc, const uint8_t * const buffer, const int size ) const void update_buf( uint32_t & crc, const uint8_t * const buffer,
const int size ) const
{ {
for( int i = 0; i < size; ++i ) for( int i = 0; i < size; ++i )
crc = data[(crc^buffer[i])&0xFF] ^ ( crc >> 8 ); crc = data[(crc^buffer[i])&0xFF] ^ ( crc >> 8 );
@ -278,7 +279,7 @@ void LZ_decoder::flush_data()
if( pos > stream_pos ) if( pos > stream_pos )
{ {
const unsigned size = pos - stream_pos; const unsigned size = pos - stream_pos;
crc32.update( crc_, buffer + stream_pos, size ); crc32.update_buf( crc_, buffer + stream_pos, size );
errno = 0; errno = 0;
if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size ) if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size )
{ std::fprintf( stderr, "Write error: %s\n", std::strerror( errno ) ); { std::fprintf( stderr, "Write error: %s\n", std::strerror( errno ) );
@ -328,12 +329,7 @@ bool LZ_decoder::decode_member() // Returns false if error
int len; int len;
if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit if( rdec.decode_bit( bm_rep[state()] ) == 1 ) // 2nd bit
{ {
if( rdec.decode_bit( bm_rep0[state()] ) == 0 ) // 3rd bit if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit
{
if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit
{ state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; }
}
else
{ {
unsigned distance; unsigned distance;
if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit if( rdec.decode_bit( bm_rep1[state()] ) == 0 ) // 4th bit
@ -349,6 +345,11 @@ bool LZ_decoder::decode_member() // Returns false if error
rep1 = rep0; rep1 = rep0;
rep0 = distance; rep0 = distance;
} }
else
{
if( rdec.decode_bit( bm_len[state()][pos_state] ) == 0 ) // 4th bit
{ state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; }
}
len = min_match_len + rdec.decode_len( rep_len_model, pos_state ); len = min_match_len + rdec.decode_len( rep_len_model, pos_state );
state.set_rep(); state.set_rep();
} }
@ -405,7 +406,7 @@ int main( const int argc, const char * const argv[] )
"This is free software: you are free to change and redistribute it.\n" "This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n" "There is NO WARRANTY, to the extent permitted by law.\n"
"Report bugs to lzip-bug@nongnu.org\n" "Report bugs to lzip-bug@nongnu.org\n"
"Lzip home page: http://www.nongnu.org/lzip/lzip.html\n" ); "Lzd home page: http://www.nongnu.org/lzip/lzd.html\n" );
return 0; return 0;
} }

View file

@ -27,8 +27,6 @@ fail=0
printf "testing lzd-%s..." "$2" printf "testing lzd-%s..." "$2"
"${LZIP}" < "${in_lz}" > /dev/full 2> /dev/null
if [ $? = 1 ] ; then printf . ; else fail=1 ; printf - ; fi
"${LZIP}" < "${in}" 2> /dev/null "${LZIP}" < "${in}" 2> /dev/null
if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi
dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" 2> /dev/null dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" 2> /dev/null