X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzms-decompress.c;h=532dfb59c9393f3b486c4c3661e07af283e6c951;hb=efdb571bf22033727f0d15bb161614686e5bcf66;hp=6cc6dab326e795484ed678a3716cf06bff77efe0;hpb=67c5f2c5954d07c25f57b6d9aedb73fb3720ec0b;p=wimlib diff --git a/src/lzms-decompress.c b/src/lzms-decompress.c index 6cc6dab3..532dfb59 100644 --- a/src/lzms-decompress.c +++ b/src/lzms-decompress.c @@ -304,7 +304,7 @@ struct lzms_huffman_decoder { u8 lens[LZMS_MAX_NUM_SYMS]; /* The codeword of each symbol in the Huffman code. */ - u16 codewords[LZMS_MAX_NUM_SYMS]; + u32 codewords[LZMS_MAX_NUM_SYMS]; /* A table for quickly decoding symbols encoded using the Huffman code. */ @@ -664,7 +664,6 @@ static int lzms_copy_lz_match(struct lzms_decompressor *ctx, u32 length, u32 offset) { u8 *out_next; - u8 *matchptr; if (length > ctx->out_end - ctx->out_next) { LZMS_DEBUG("Match overrun!"); @@ -676,11 +675,10 @@ lzms_copy_lz_match(struct lzms_decompressor *ctx, u32 length, u32 offset) } out_next = ctx->out_next; - matchptr = out_next - offset; - while (length--) - *out_next++ = *matchptr++; - ctx->out_next = out_next; + lz_copy(out_next, length, offset, ctx->out_end); + ctx->out_next = out_next + length; + return 0; } @@ -1032,7 +1030,7 @@ lzms_free_decompressor(void *_ctx) { struct lzms_decompressor *ctx = _ctx; - FREE(ctx); + ALIGNED_FREE(ctx); } static int @@ -1042,7 +1040,8 @@ lzms_create_decompressor(size_t max_block_size, { struct lzms_decompressor *ctx; - ctx = MALLOC(sizeof(struct lzms_decompressor)); + ctx = ALIGNED_MALLOC(sizeof(struct lzms_decompressor), + DECODE_TABLE_ALIGNMENT); if (ctx == NULL) return WIMLIB_ERR_NOMEM;