diff options
-rw-r--r-- | deflate.c | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -1556,13 +1556,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) { | |||
1556 | */ | 1556 | */ |
1557 | local void check_match(deflate_state *s, IPos start, IPos match, int length) { | 1557 | local void check_match(deflate_state *s, IPos start, IPos match, int length) { |
1558 | /* check that the match is indeed a match */ | 1558 | /* check that the match is indeed a match */ |
1559 | if (zmemcmp(s->window + match, | 1559 | Bytef *back = s->window + (int)match, *here = s->window + start; |
1560 | s->window + start, length) != EQUAL) { | 1560 | IPos len = length; |
1561 | fprintf(stderr, " start %u, match %u, length %d\n", | 1561 | if (match == (IPos)-1) { |
1562 | start, match, length); | 1562 | /* match starts one byte before the current window -- just compare the |
1563 | subsequent length-1 bytes */ | ||
1564 | back++; | ||
1565 | here++; | ||
1566 | len--; | ||
1567 | } | ||
1568 | if (zmemcmp(back, here, len) != EQUAL) { | ||
1569 | fprintf(stderr, " start %u, match %d, length %d\n", | ||
1570 | start, (int)match, length); | ||
1563 | do { | 1571 | do { |
1564 | fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); | 1572 | fprintf(stderr, "(%02x %02x)", *back++, *here++); |
1565 | } while (--length != 0); | 1573 | } while (--len != 0); |
1566 | z_error("invalid match"); | 1574 | z_error("invalid match"); |
1567 | } | 1575 | } |
1568 | if (z_verbose > 1) { | 1576 | if (z_verbose > 1) { |