aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lzma/lzma_encoder_presets.c
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2014-01-12 16:44:52 +0200
committerLasse Collin <lasse.collin@tukaani.org>2014-04-26 08:38:12 +0300
commite34025d666852839388f997d076e3577847dd10f (patch)
treeedfc7c36ce4a81c41aa75b4c08a80b0478960e10 /src/liblzma/lzma/lzma_encoder_presets.c
parentliblzma: Remove a useless C99ism from sha256.c. (diff)
downloadxz-e34025d666852839388f997d076e3577847dd10f.tar.xz
liblzma: Avoid C99 compound literal arrays.
MSVC 2013 doesn't like them. Maybe they aren't so good for readability either since many aren't used to them.
Diffstat (limited to 'src/liblzma/lzma/lzma_encoder_presets.c')
-rw-r--r--src/liblzma/lzma/lzma_encoder_presets.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/liblzma/lzma/lzma_encoder_presets.c b/src/liblzma/lzma/lzma_encoder_presets.c
index 21e427a8..8484b774 100644
--- a/src/liblzma/lzma/lzma_encoder_presets.c
+++ b/src/liblzma/lzma/lzma_encoder_presets.c
@@ -30,14 +30,16 @@ 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];
+ static const uint8_t dict_pow2[]
+ = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
+ options->dict_size = UINT32_C(1) << dict_pow2[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];
+ static const uint8_t depths[] = { 4, 8, 24, 48 };
+ options->depth = depths[level];
} else {
options->mode = LZMA_MODE_NORMAL;
options->mf = LZMA_MF_BT4;