summaryrefslogtreecommitdiffstats
path: root/compress.cc
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:54:44 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 15:54:44 +0000
commitcf7b4bca3811d402cc01978658485297451a9784 (patch)
tree29e47e9255fb7903abdca4a444ca46851a8745ab /compress.cc
parentAdding debian version 1.4~rc1-1. (diff)
downloadplzip-cf7b4bca3811d402cc01978658485297451a9784.tar.xz
plzip-cf7b4bca3811d402cc01978658485297451a9784.zip
Merging upstream version 1.4.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'compress.cc')
-rw-r--r--compress.cc13
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",