diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2008-10-07 09:40:31 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2008-10-07 09:40:31 +0300 |
commit | 1e8e4fd1f3e50129b4541406ad765d2aa1233943 (patch) | |
tree | c2c952fb207b48effd8585436d3c83c7a475a22d | |
parent | Removed fi from po/LINGUAS. (diff) | |
download | xz-1e8e4fd1f3e50129b4541406ad765d2aa1233943.tar.xz |
Made the preset numbering more logical in liblzma API.
-rw-r--r-- | src/liblzma/api/lzma/container.h | 20 | ||||
-rw-r--r-- | src/liblzma/api/lzma/lzma.h | 2 | ||||
-rw-r--r-- | src/liblzma/lzma/lzma_encoder_presets.c | 3 | ||||
-rw-r--r-- | src/lzma/args.c | 8 | ||||
-rw-r--r-- | src/lzma/args.h | 2 |
5 files changed, 18 insertions, 17 deletions
diff --git a/src/liblzma/api/lzma/container.h b/src/liblzma/api/lzma/container.h index 256bbc69..ff640a6c 100644 --- a/src/liblzma/api/lzma/container.h +++ b/src/liblzma/api/lzma/container.h @@ -49,7 +49,7 @@ typedef enum { /**< * LZMA2 filter with fast compression (fast in terms of LZMA2). * If you are interested in the exact options used, see - * lzma_preset_lzma[0]. Note that the exact options may + * lzma_lzma_preset(1). Note that the exact options may * change between liblzma versions. * * At the moment, the command line tool uses these settings @@ -57,18 +57,18 @@ typedef enum { * may default to some more complex way to determine the * settings used e.g. the type of files being compressed. * - * LZMA_EASY_LZMA_2 is equivalent to lzma_preset_lzma[1] + * LZMA_EASY_LZMA2_2 is equivalent to lzma_lzma_preset(2) * and so on. */ - LZMA_EASY_LZMA_2 = 2, - LZMA_EASY_LZMA_3 = 3, - LZMA_EASY_LZMA_4 = 4, - LZMA_EASY_LZMA_5 = 5, - LZMA_EASY_LZMA_6 = 6, - LZMA_EASY_LZMA_7 = 7, - LZMA_EASY_LZMA_8 = 8, - LZMA_EASY_LZMA_9 = 9, + LZMA_EASY_LZMA2_2 = 2, + LZMA_EASY_LZMA2_3 = 3, + LZMA_EASY_LZMA2_4 = 4, + LZMA_EASY_LZMA2_5 = 5, + LZMA_EASY_LZMA2_6 = 6, + LZMA_EASY_LZMA2_7 = 7, + LZMA_EASY_LZMA2_8 = 8, + LZMA_EASY_LZMA2_9 = 9, } lzma_easy_level; diff --git a/src/liblzma/api/lzma/lzma.h b/src/liblzma/api/lzma/lzma.h index 094667eb..5ec563dd 100644 --- a/src/liblzma/api/lzma/lzma.h +++ b/src/liblzma/api/lzma/lzma.h @@ -394,7 +394,7 @@ typedef struct { /** * \brief Set a compression level preset to lzma_options_lzma structure * - * level = 0 is the fastest and level = 8 is the slowest. These presets match + * level = 1 is the fastest and level = 9 is the slowest. These presets match * the switches -1 .. -9 of the command line tool. * * The preset values are subject to changes between liblzma versions. diff --git a/src/liblzma/lzma/lzma_encoder_presets.c b/src/liblzma/lzma/lzma_encoder_presets.c index 7ef3509e..b48e0698 100644 --- a/src/liblzma/lzma/lzma_encoder_presets.c +++ b/src/liblzma/lzma/lzma_encoder_presets.c @@ -53,9 +53,10 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t level) extern LZMA_API lzma_bool lzma_lzma_preset(lzma_options_lzma *options, uint32_t level) { - if (level >= 9) + if (level == 0 || level > 9) return true; + --level; memzero(options, sizeof(*options)); static const uint8_t shift[9] = { 16, 20, 19, 20, 21, 22, 23, 24, 25 }; diff --git a/src/lzma/args.c b/src/lzma/args.c index 47ae766a..14ccfb6d 100644 --- a/src/lzma/args.c +++ b/src/lzma/args.c @@ -40,13 +40,13 @@ bool opt_keep_original = false; bool opt_preserve_name = false; lzma_check opt_check = LZMA_CHECK_CRC64; -lzma_filter opt_filters[8]; +lzma_filter opt_filters[LZMA_BLOCK_FILTERS_MAX + 1]; // We don't modify or free() this, but we need to assign it in some // non-const pointers. const char *stdin_filename = "(stdin)"; -static size_t preset_number = 7 - 1; +static size_t preset_number = 7; static bool preset_default = true; static size_t filter_count = 0; @@ -178,7 +178,7 @@ parse_real(int argc, char **argv) case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - preset_number = c - '1'; + preset_number = c - '0'; preset_default = false; break; @@ -502,7 +502,7 @@ set_compression_settings(void) // setting is used. if (preset_default) { while (memory_usage > opt_memory) { - if (preset_number == 0) { + if (preset_number == 1) { errmsg(V_ERROR, _("Memory usage limit is too " "small for any internal " "filter preset")); diff --git a/src/lzma/args.h b/src/lzma/args.h index 587b280f..8d9cd306 100644 --- a/src/lzma/args.h +++ b/src/lzma/args.h @@ -55,7 +55,7 @@ extern enum tool_mode opt_mode; extern enum format_type opt_format; extern lzma_check opt_check; -extern lzma_filter opt_filters[8]; +extern lzma_filter opt_filters[LZMA_BLOCK_FILTERS_MAX + 1]; extern const char *stdin_filename; |