X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzx-decompress.c;h=c98b84c038ed55a09c2e43c4be971422cb6ffcb8;hb=41c221c509deed7dc9c2bd8eb8c7e93563b21199;hp=bbb105144710464068c33a9eeaabdb41ea452c05;hpb=a20052d2eaf44eb0466972826f8f9e0c3bcb92d2;p=wimlib diff --git a/src/lzx-decompress.c b/src/lzx-decompress.c index bbb10514..c98b84c0 100644 --- a/src/lzx-decompress.c +++ b/src/lzx-decompress.c @@ -107,9 +107,9 @@ # include "config.h" #endif -#include "wimlib.h" #include "wimlib/decompressor_ops.h" #include "wimlib/decompress_common.h" +#include "wimlib/error.h" #include "wimlib/lzx.h" #include "wimlib/util.h" @@ -523,9 +523,6 @@ lzx_decode_match(unsigned main_element, int block_type, unsigned num_extra_bits; u32 verbatim_bits; u32 aligned_bits; - unsigned i; - u8 *match_dest; - u8 *match_src; /* The main element is offset by 256 because values under 256 indicate a * literal value. */ @@ -621,24 +618,8 @@ lzx_decode_match(unsigned main_element, int block_type, return -1; } - match_dest = window + window_pos; - match_src = match_dest - match_offset; - -#if 0 - printf("Match: src %u, dst %u, len %u\n", match_src - window, - match_dest - window, - match_len); - putchar('|'); - for (i = 0; i < match_len; i++) { - match_dest[i] = match_src[i]; - putchar(match_src[i]); - } - putchar('|'); - putchar('\n'); -#else - for (i = 0; i < match_len; i++) - match_dest[i] = match_src[i]; -#endif + lz_copy(&window[window_pos], match_len, match_offset, + &window[window_pos + bytes_remaining]); return match_len; } @@ -809,7 +790,7 @@ lzx_free_decompressor(void *_ctx) { struct lzx_decompressor *ctx = _ctx; - FREE(ctx); + ALIGNED_FREE(ctx); } static int @@ -822,7 +803,8 @@ lzx_create_decompressor(size_t max_window_size, if (!lzx_window_size_valid(max_window_size)) return WIMLIB_ERR_INVALID_PARAM; - ctx = MALLOC(sizeof(struct lzx_decompressor)); + ctx = ALIGNED_MALLOC(sizeof(struct lzx_decompressor), + DECODE_TABLE_ALIGNMENT); if (ctx == NULL) return WIMLIB_ERR_NOMEM;