MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / check_match

Function check_match

extern/zlib/src/deflate.c:1557–1580  ·  view source on GitHub ↗

=========================================================================== * Check that the match at match_start is indeed a match. */

Source from the content-addressed store, hash-verified

1555 * Check that the match at match_start is indeed a match.
1556 */
1557local void check_match(deflate_state *s, IPos start, IPos match, int length) {
1558 /* check that the match is indeed a match */
1559 Bytef *back = s->window + (int)match, *here = s->window + start;
1560 IPos len = length;
1561 if (match == (IPos)-1) {
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);
1571 do {
1572 fprintf(stderr, "(%02x %02x)", *back++, *here++);
1573 } while (--len != 0);
1574 z_error("invalid match");
1575 }
1576 if (z_verbose > 1) {
1577 fprintf(stderr,"\\[%d,%d]", start - match, length);
1578 do { putc(s->window[start++], stderr); } while (--length != 0);
1579 }
1580}
1581#else
1582# define check_match(s, start, match, length)
1583#endif /* ZLIB_DEBUG */

Callers 3

deflate_fastFunction · 0.85
deflate_slowFunction · 0.85
deflate_rleFunction · 0.85

Calls 2

zmemcmpFunction · 0.85
z_errorFunction · 0.85

Tested by

no test coverage detected