X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flzms-compress.c;h=af7f85b6ffff41224684f95aa639890c983ef0a1;hb=92502e53658f09310d67118a0bbc18fa83a1b6f0;hp=3169218288c79c676911ea3376be2a3688c4b3e9;hpb=95ab133e80c52b6a0b0de85ba172447d5d9b68eb;p=wimlib diff --git a/src/lzms-compress.c b/src/lzms-compress.c index 31692182..af7f85b6 100644 --- a/src/lzms-compress.c +++ b/src/lzms-compress.c @@ -599,18 +599,6 @@ lzms_encode_lz_match(struct lzms_compressor *ctx, u32 length, u32 offset) lzms_end_encode_item(ctx, length); } -static struct lzms_match -lzms_get_best_match(struct lzms_compressor *ctx) -{ - struct lzms_match match; - - /* TODO */ - - match.length = 0; - - return match; -} - static void lzms_record_literal(u8 literal, void *_ctx) { @@ -652,6 +640,19 @@ lzms_fast_encode(struct lzms_compressor *ctx) } #if 0 + +static struct lzms_match +lzms_get_best_match(struct lzms_compressor *ctx) +{ + struct lzms_match match; + + /* TODO */ + + match.length = 0; + + return match; +} + static void lzms_slow_encode(struct lzms_compressor *ctx) { @@ -709,6 +710,7 @@ lzms_init_compressor(struct lzms_compressor *ctx, const u8 *udata, u32 ulen, /* Copy the uncompressed data into the @ctx->window buffer. */ memcpy(ctx->window, udata, ulen); + memset(&ctx->window[ulen], 0, 8); ctx->cur_window_pos = 0; ctx->window_size = ulen; @@ -961,7 +963,7 @@ lzms_create_compressor(size_t max_block_size, if (ctx == NULL) goto oom; - ctx->window = MALLOC(max_block_size); + ctx->window = MALLOC(max_block_size + 8); if (ctx->window == NULL) goto oom;