From 9feb36b97c47af5154417e9771de6ffa7c81c636 Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Sun, 21 Jan 2024 07:46:56 +0000 Subject: sync with userland --- sys/lib/libz/deflate.c | 20 ++++++++++++++------ sys/lib/libz/zconf.h | 8 -------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'sys/lib') diff --git a/sys/lib/libz/deflate.c b/sys/lib/libz/deflate.c index cfd1f00c417..9b5593ff367 100644 --- a/sys/lib/libz/deflate.c +++ b/sys/lib/libz/deflate.c @@ -1552,13 +1552,21 @@ local uInt longest_match(deflate_state *s, IPos cur_match) { */ local void check_match(deflate_state *s, IPos start, IPos match, int length) { /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); + Bytef *back = s->window + (int)match, *here = s->window + start; + IPos len = length; + if (match == (IPos)-1) { + /* match starts one byte before the current window -- just compare the + subsequent length-1 bytes */ + back++; + here++; + len--; + } + if (zmemcmp(back, here, len) != EQUAL) { + fprintf(stderr, " start %u, match %d, length %d\n", + start, (int)match, length); do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); + fprintf(stderr, "(%02x %02x)", *back++, *here++); + } while (--len != 0); z_error("invalid match"); } if (z_verbose > 1) { diff --git a/sys/lib/libz/zconf.h b/sys/lib/libz/zconf.h index 7bc5562f162..58cc93959a0 100644 --- a/sys/lib/libz/zconf.h +++ b/sys/lib/libz/zconf.h @@ -298,14 +298,6 @@ # endif #endif -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have -- cgit v1.2.3