From 5a87b49919eeb1c5931666b4f1a0350ae2abad3e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 7 Nov 2015 16:54:05 +0100 Subject: Merging upstream version 1.4~rc1. Signed-off-by: Daniel Baumann --- main.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'main.cc') diff --git a/main.cc b/main.cc index 23247cf..94baeaa 100644 --- a/main.cc +++ b/main.cc @@ -103,7 +103,7 @@ void show_help( const long num_online ) std::printf( "\nOptions:\n" " -h, --help display this help and exit\n" " -V, --version output version information and exit\n" - " -B, --data-size= set size of input data blocks, in bytes\n" + " -B, --data-size= set size of input data blocks [2x8=16 MiB]\n" " -c, --stdout send output to standard output\n" " -d, --decompress decompress\n" " -f, --force overwrite existing output files\n" @@ -232,11 +232,14 @@ unsigned long long getnum( const char * const ptr, int get_dict_size( const char * const arg ) { char * tail; - int bits = std::strtol( arg, &tail, 0 ); + const int bits = std::strtol( arg, &tail, 0 ); if( bits >= LZ_min_dictionary_bits() && bits <= LZ_max_dictionary_bits() && *tail == 0 ) return ( 1 << bits ); - return getnum( arg, LZ_min_dictionary_size(), LZ_max_dictionary_size() ); + int dictionary_size = getnum( arg, LZ_min_dictionary_size(), + LZ_max_dictionary_size() ); + if( dictionary_size == 65535 ) ++dictionary_size; + return dictionary_size; } @@ -585,29 +588,29 @@ int main( const int argc, const char * const argv[] ) { const int code = parser.code( argind ); if( !code ) break; /* no more options */ - const char * const arg = parser.argument( argind ).c_str(); + const std::string & arg = parser.argument( argind ); switch( code ) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': encoder_options = option_mapping[code-'0']; break; case 'b': break; - case 'B': data_size = getnum( arg, 2 * LZ_min_dictionary_size(), + case 'B': data_size = getnum( arg.c_str(), 2 * LZ_min_dictionary_size(), 2 * LZ_max_dictionary_size() ); break; case 'c': to_stdout = true; break; case 'd': program_mode = m_decompress; break; - case 'D': debug_level = getnum( arg, 0, 3 ); break; + case 'D': debug_level = getnum( arg.c_str(), 0, 3 ); break; case 'f': force = true; break; case 'F': recompress = true; break; case 'h': show_help( num_online ); return 0; case 'k': keep_input_files = true; break; case 'm': encoder_options.match_len_limit = - getnum( arg, LZ_min_match_len_limit(), - LZ_max_match_len_limit() ); break; - case 'n': num_workers = getnum( arg, 1, max_workers ); break; + getnum( arg.c_str(), LZ_min_match_len_limit(), + LZ_max_match_len_limit() ); break; + case 'n': num_workers = getnum( arg.c_str(), 1, max_workers ); break; case 'o': default_output_filename = arg; break; case 'q': verbosity = -1; break; - case 's': encoder_options.dictionary_size = get_dict_size( arg ); + case 's': encoder_options.dictionary_size = get_dict_size( arg.c_str() ); break; case 'S': break; case 't': program_mode = m_test; break; -- cgit v1.2.3