1
0
Fork 0

Merging upstream version 1.4~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 04:09:39 +01:00
parent f441ba7f78
commit 718f5f97e5
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
13 changed files with 84 additions and 94 deletions

23
main.cc
View file

@ -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=<bytes> set size of input data blocks, in bytes\n"
" -B, --data-size=<bytes> 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;