X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzx_decompress.c;h=cce98e32a96904f850f5da6d3e10c2f11b9f39b5;hb=4ee103c6e2a2988e1fb358bfa2dc38dcb621505a;hp=7b02dbf647edd5d820c20626c09daaf2a1299fa5;hpb=c3e031c6dfe0a2851b709e2ee54cd44dbd393285;p=wimlib diff --git a/src/lzx_decompress.c b/src/lzx_decompress.c index 7b02dbf6..cce98e32 100644 --- a/src/lzx_decompress.c +++ b/src/lzx_decompress.c @@ -93,6 +93,21 @@ struct lzx_decompressor { u8 extra_offset_bits[LZX_MAX_OFFSET_SLOTS]; }; + union { + DECODE_TABLE_WORKING_SPACE(maincode_working_space, + LZX_MAINCODE_MAX_NUM_SYMBOLS, + LZX_MAX_MAIN_CODEWORD_LEN); + DECODE_TABLE_WORKING_SPACE(lencode_working_space, + LZX_LENCODE_NUM_SYMBOLS, + LZX_MAX_LEN_CODEWORD_LEN); + DECODE_TABLE_WORKING_SPACE(alignedcode_working_space, + LZX_ALIGNEDCODE_NUM_SYMBOLS, + LZX_MAX_ALIGNED_CODEWORD_LEN); + DECODE_TABLE_WORKING_SPACE(precode_working_space, + LZX_PRECODE_NUM_SYMBOLS, + LZX_MAX_PRE_CODEWORD_LEN); + }; + unsigned window_order; unsigned num_main_syms; @@ -157,7 +172,8 @@ lzx_read_codeword_lens(struct lzx_decompressor *d, struct input_bitstream *is, LZX_PRECODE_NUM_SYMBOLS, LZX_PRECODE_TABLEBITS, d->precode_lens, - LZX_MAX_PRE_CODEWORD_LEN)) + LZX_MAX_PRE_CODEWORD_LEN, + d->precode_working_space)) return -1; /* Decode the codeword lengths. */ @@ -333,14 +349,16 @@ lzx_decompress_block(struct lzx_decompressor *d, struct input_bitstream *is, d->num_main_syms, LZX_MAINCODE_TABLEBITS, d->maincode_lens, - LZX_MAX_MAIN_CODEWORD_LEN)) + LZX_MAX_MAIN_CODEWORD_LEN, + d->maincode_working_space)) return -1; if (make_huffman_decode_table(d->lencode_decode_table, LZX_LENCODE_NUM_SYMBOLS, LZX_LENCODE_TABLEBITS, d->lencode_lens, - LZX_MAX_LEN_CODEWORD_LEN)) + LZX_MAX_LEN_CODEWORD_LEN, + d->lencode_working_space)) return -1; if (block_type == LZX_BLOCKTYPE_ALIGNED) { @@ -348,7 +366,8 @@ lzx_decompress_block(struct lzx_decompressor *d, struct input_bitstream *is, LZX_ALIGNEDCODE_NUM_SYMBOLS, LZX_ALIGNEDCODE_TABLEBITS, d->alignedcode_lens, - LZX_MAX_ALIGNED_CODEWORD_LEN)) + LZX_MAX_ALIGNED_CODEWORD_LEN, + d->alignedcode_working_space)) return -1; min_aligned_offset_slot = LZX_MIN_ALIGNED_OFFSET_SLOT; memcpy(d->extra_offset_bits, d->extra_offset_bits_minus_aligned,