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

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.
This commit is contained in:
Lasse Collin 2014-01-12 16:44:52 +02:00
parent 0b6168974f
commit e34025d666

View file

@ -30,14 +30,16 @@ lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
options->lp = LZMA_LP_DEFAULT; options->lp = LZMA_LP_DEFAULT;
options->pb = LZMA_PB_DEFAULT; options->pb = LZMA_PB_DEFAULT;
options->dict_size = UINT32_C(1) << (uint8_t []){ static const uint8_t dict_pow2[]
18, 20, 21, 22, 22, 23, 23, 24, 25, 26 }[level]; = { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
options->dict_size = UINT32_C(1) << dict_pow2[level];
if (level <= 3) { if (level <= 3) {
options->mode = LZMA_MODE_FAST; options->mode = LZMA_MODE_FAST;
options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4; options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4;
options->nice_len = level <= 1 ? 128 : 273; 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 { } else {
options->mode = LZMA_MODE_NORMAL; options->mode = LZMA_MODE_NORMAL;
options->mf = LZMA_MF_BT4; options->mf = LZMA_MF_BT4;