diff options
Diffstat (limited to '')
-rw-r--r-- | compress.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compress.cc b/compress.cc index 1f0ae5d..ecc7e5e 100644 --- a/compress.cc +++ b/compress.cc @@ -375,11 +375,10 @@ extern "C" void * cworker( void * arg ) Packet * const packet = courier.distribute_packet(); if( !packet ) break; // no more packets to process - int dict_size; - if( dictionary_size == 65535 && match_len_limit == 16 ) - dict_size = dictionary_size; - else dict_size = std::max( LZ_min_dictionary_size(), - std::min( dictionary_size, packet->size ) ); + const bool fast = dictionary_size == 65535 && match_len_limit == 16; + const int dict_size = fast ? dictionary_size : + std::max( std::min( dictionary_size, packet->size ), + LZ_min_dictionary_size() ); LZ_Encoder * const encoder = LZ_compress_open( dict_size, match_len_limit, LLONG_MAX ); if( !encoder || LZ_compress_errno( encoder ) != LZ_ok ) @@ -413,7 +412,7 @@ extern "C" void * cworker( void * arg ) { pp(); if( verbosity >= 0 ) - std::fprintf( stderr, "LZ_compress_read error: %s.\n", + std::fprintf( stderr, "LZ_compress_read error: %s\n", LZ_strerror( LZ_compress_errno( encoder ) ) ); cleanup_and_fail(); } @@ -521,7 +520,7 @@ int compress( const int data_size, const int dictionary_size, if( verbosity >= 1 ) { if( in_size == 0 || out_size == 0 ) - std::fprintf( stderr, " no data compressed.\n" ); + std::fputs( " no data compressed.\n", stderr ); else std::fprintf( stderr, "%6.3f:1, %6.3f bits/byte, " "%5.2f%% saved, %llu in, %llu out.\n", |