diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 06:46:33 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 06:46:33 +0000 |
commit | 0a87a190c3ad03598b4db143e3d1b440afa9cf5a (patch) | |
tree | 1ae6c99562cd18f35410f79f81826974d207ca59 /lzd.cc | |
parent | Adding debian version 0.3-1. (diff) | |
download | lzd-0a87a190c3ad03598b4db143e3d1b440afa9cf5a.tar.xz lzd-0a87a190c3ad03598b4db143e3d1b440afa9cf5a.zip |
Merging upstream version 0.4.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r-- | lzd.cc | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -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; } |