diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2014-07-13 20:21:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-07-29 12:44:36 (GMT) |
commit | 7a92eddbcb2b2e6419062538e346908f0e502586 (patch) | |
tree | b1985ad4a8904211f12cb07742a9d776fa28152f /Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c | |
parent | b2a07ca49c66665f5b51b592f44ecc4f66c7556b (diff) | |
download | CMake-7a92eddbcb2b2e6419062538e346908f0e502586.zip CMake-7a92eddbcb2b2e6419062538e346908f0e502586.tar.gz CMake-7a92eddbcb2b2e6419062538e346908f0e502586.tar.bz2 |
liblzma: Port from C99 to C89/90
Remove use of designated initializers and declarations of variables
after statements. Leave "//" comments as-is for now.
Diffstat (limited to 'Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c')
-rw-r--r-- | Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c index 21e427a..8af9b9f 100644 --- a/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c +++ b/Utilities/cmliblzma/liblzma/lzma/lzma_encoder_presets.c @@ -16,6 +16,9 @@ extern LZMA_API(lzma_bool) lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) { + static const uint8_t dict_size_values[] = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }; + static const uint8_t depth_values[] = { 4, 8, 24, 48 }; + const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK; const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK; const uint32_t supported_flags = LZMA_PRESET_EXTREME; @@ -30,14 +33,13 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset) options->lp = LZMA_LP_DEFAULT; options->pb = LZMA_PB_DEFAULT; - options->dict_size = UINT32_C(1) << (uint8_t []){ - 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; + options->dict_size = UINT32_C(1) << dict_size_values[level]; if (level <= 3) { options->mode = LZMA_MODE_FAST; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->nice_len = level <= 1 ? 128 : 273; - options->depth = (uint8_t []){ 4, 8, 24, 48 }[level]; + options->depth = depth_values[level]; } else { options->mode = LZMA_MODE_NORMAL; options->mf = LZMA_MF_BT4; |