From 82b8e9da4931a731976c3998f2464d4e690502e8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 14 Sep 2014 12:27:16 -0500 Subject: [PATCH] lzx-compress.c: Fix for lazy parsing and multiple blocks --- src/lzx-compress.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lzx-compress.c b/src/lzx-compress.c index a9745b62..c7ff96f5 100644 --- a/src/lzx-compress.c +++ b/src/lzx-compress.c @@ -1788,6 +1788,8 @@ lzx_choose_lazy_items_for_block(struct lzx_compressor *c, * length 3 match. Output the previous match if there * is one; otherwise output a literal. */ + no_match_found: + if (prev_len) { skip_len = prev_len - 2; goto output_prev_match; @@ -1825,11 +1827,8 @@ lzx_choose_lazy_items_for_block(struct lzx_compressor *c, if (unlikely(cur_len > block_end - (window_ptr - 1))) { /* Nearing end of block. */ cur_len = block_end - (window_ptr - 1); - if (cur_len < 3) { - lzx_declare_literal(c, *(window_ptr - 1), &next_chosen_item); - prev_len = 0; - continue; - } + if (cur_len < 3) + goto no_match_found; } if (prev_len == 0 || cur_score > prev_score) { -- 2.43.0