From bf0ce1adc0ace9ce9468aaa5c4f17187736e012d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 07:46:28 +0100 Subject: Adding upstream version 0.4. Signed-off-by: Daniel Baumann --- ChangeLog | 5 +++++ NEWS | 4 ++-- configure | 2 +- lzd.cc | 19 ++++++++++--------- testsuite/check.sh | 2 -- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f516f1..eb56908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-08-01 Antonio Diaz Diaz + + * Version 0.4 released. + * testsuite/check.sh: Removed '/dev/full' from tests. + 2013-07-24 Antonio Diaz Diaz * Version 0.3 released. diff --git a/NEWS b/NEWS index 2c8be2e..d4f019c 100644 --- a/NEWS +++ b/NEWS @@ -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. diff --git a/configure b/configure index 98acee7..f74b397 100755 --- a/configure +++ b/configure @@ -6,7 +6,7 @@ # to copy, distribute and modify it. pkgname=lzd -pkgversion=0.3 +pkgversion=0.4 progname=lzd srctrigger=lzd.cc diff --git a/lzd.cc b/lzd.cc index 0ac7b64..b5c5ac8 100644 --- a/lzd.cc +++ b/lzd.cc @@ -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 ) crc = data[(crc^buffer[i])&0xFF] ^ ( crc >> 8 ); @@ -278,7 +279,7 @@ void LZ_decoder::flush_data() if( 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; if( std::fwrite( buffer + stream_pos, 1, size, stdout ) != size ) { 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; 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_len[state()][pos_state] ) == 0 ) // 4th bit - { state.set_short_rep(); put_byte( get_byte( rep0 ) ); continue; } - } - else + if( rdec.decode_bit( bm_rep0[state()] ) == 1 ) // 3rd bit { unsigned distance; 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; 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 ); 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" "There is NO WARRANTY, to the extent permitted by law.\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; } diff --git a/testsuite/check.sh b/testsuite/check.sh index a701bcb..5eaa679 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -27,8 +27,6 @@ fail=0 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 if [ $? = 2 ] ; then printf . ; else fail=1 ; printf - ; fi dd if="${in_lz}" bs=1 count=6 2> /dev/null | "${LZIP}" 2> /dev/null -- cgit v1.2.3