1
0
Fork 0
mirror of https://git.tukaani.org/xz.git synced 2024-04-04 12:36:23 +02:00

Added preset=NUM to --lzma1 and --lzma2. This makes it easy

to take a preset as a template and modify it a little.
This commit is contained in:
Lasse Collin 2008-12-10 01:23:58 +02:00
parent bceb3918db
commit 1ea9e7f15a
2 changed files with 9 additions and 0 deletions

View file

@ -806,6 +806,7 @@ message_help(bool long_help)
"\n" "\n"
" --lzma1=[OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n" " --lzma1=[OPTS] LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
" --lzma2=[OPTS] more of the following options (valid values; default):\n" " --lzma2=[OPTS] more of the following options (valid values; default):\n"
" preset=NUM reset options to preset number NUM (1-9)\n"
" dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n" " dict=NUM dictionary size (4KiB - 1536MiB; 8MiB)\n"
" lc=NUM number of literal context bits (0-4; 3)\n" " lc=NUM number of literal context bits (0-4; 3)\n"
" lp=NUM number of literal position bits (0-4; 0)\n" " lp=NUM number of literal position bits (0-4; 0)\n"

View file

@ -237,6 +237,7 @@ options_delta(const char *str)
////////// //////////
enum { enum {
OPT_PRESET,
OPT_DICT, OPT_DICT,
OPT_LC, OPT_LC,
OPT_LP, OPT_LP,
@ -254,6 +255,12 @@ set_lzma(void *options, uint32_t key, uint64_t value)
lzma_options_lzma *opt = options; lzma_options_lzma *opt = options;
switch (key) { switch (key) {
case OPT_PRESET:
if (lzma_lzma_preset(options, (uint32_t)(value)))
message_fatal("LZMA1/LZMA2 preset %u is not supported",
(unsigned int)(value));
break;
case OPT_DICT: case OPT_DICT:
opt->dict_size = value; opt->dict_size = value;
break; break;
@ -308,6 +315,7 @@ options_lzma(const char *str)
}; };
static const option_map opts[] = { static const option_map opts[] = {
{ "preset", NULL, 1, 9 },
{ "dict", NULL, LZMA_DICT_SIZE_MIN, { "dict", NULL, LZMA_DICT_SIZE_MIN,
(UINT32_C(1) << 30) + (UINT32_C(1) << 29) }, (UINT32_C(1) << 30) + (UINT32_C(1) << 29) },
{ "lc", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX }, { "lc", NULL, LZMA_LCLP_MIN, LZMA_LCLP_MAX },