From 3631e889be9e340e2639829b6c0eed3470d07a4d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 6 May 2022 15:12:48 +0000 Subject: A number of fixes from zlib's 'develop' branch. --- compat/zlib/configure | 3 +++ compat/zlib/contrib/infback9/inftree9.c | 2 +- compat/zlib/contrib/minizip/iowin32.c | 5 +++++ compat/zlib/crc32.c | 8 ++++---- compat/zlib/deflate.h | 4 ++-- compat/zlib/inftrees.c | 2 +- compat/zlib/trees.c | 6 +++--- 7 files changed, 19 insertions(+), 11 deletions(-) diff --git a/compat/zlib/configure b/compat/zlib/configure index 52ff4a0..3fa3e86 100755 --- a/compat/zlib/configure +++ b/compat/zlib/configure @@ -174,7 +174,10 @@ if test -z "$CC"; then else cc=${CROSS_PREFIX}cc fi +else + cc=${CC} fi + cflags=${CFLAGS-"-O3"} # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure case "$cc" in diff --git a/compat/zlib/contrib/infback9/inftree9.c b/compat/zlib/contrib/infback9/inftree9.c index 0550606..2175bde 100644 --- a/compat/zlib/contrib/infback9/inftree9.c +++ b/compat/zlib/contrib/infback9/inftree9.c @@ -64,7 +64,7 @@ unsigned short FAR *work; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132, - 133, 133, 133, 133, 144, 199, 202}; + 133, 133, 133, 133, 144, 76, 202}; static const unsigned short dbase[32] = { /* Distance codes 0..31 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, diff --git a/compat/zlib/contrib/minizip/iowin32.c b/compat/zlib/contrib/minizip/iowin32.c index 274f39e..7df5251 100644 --- a/compat/zlib/contrib/minizip/iowin32.c +++ b/compat/zlib/contrib/minizip/iowin32.c @@ -28,6 +28,11 @@ // see Include/shared/winapifamily.h in the Windows Kit #if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API))) + +#if !defined(WINAPI_FAMILY_ONE_PARTITION) +#define WINAPI_FAMILY_ONE_PARTITION(PartitionSet, Partition) ((WINAPI_FAMILY & PartitionSet) == Partition) +#endif + #if WINAPI_FAMILY_ONE_PARTITION(WINAPI_FAMILY, WINAPI_PARTITION_APP) #define IOWIN32_USING_WINRT_API 1 #endif diff --git a/compat/zlib/crc32.c b/compat/zlib/crc32.c index a1bdce5..451887b 100644 --- a/compat/zlib/crc32.c +++ b/compat/zlib/crc32.c @@ -630,7 +630,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) #endif /* DYNAMIC_CRC_TABLE */ /* Pre-condition the CRC */ - crc ^= 0xffffffff; + crc = (~crc) & 0xffffffff; /* Compute the CRC up to a word boundary. */ while (len && ((z_size_t)buf & 7) != 0) { @@ -749,7 +749,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) #endif /* DYNAMIC_CRC_TABLE */ /* Pre-condition the CRC */ - crc ^= 0xffffffff; + crc = (~crc) & 0xffffffff; #ifdef W @@ -1077,7 +1077,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2) #ifdef DYNAMIC_CRC_TABLE once(&made, make_crc_table); #endif /* DYNAMIC_CRC_TABLE */ - return multmodp(x2nmodp(len2, 3), crc1) ^ crc2; + return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff); } /* ========================================================================= */ @@ -1112,5 +1112,5 @@ uLong crc32_combine_op(crc1, crc2, op) uLong crc2; uLong op; { - return multmodp(op, crc1) ^ crc2; + return multmodp(op, crc1) ^ (crc2 & 0xffffffff); } diff --git a/compat/zlib/deflate.h b/compat/zlib/deflate.h index 17c2261..1a06cd5 100644 --- a/compat/zlib/deflate.h +++ b/compat/zlib/deflate.h @@ -329,8 +329,8 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (uch)(length); \ ush dist = (ush)(distance); \ - s->sym_buf[s->sym_next++] = dist; \ - s->sym_buf[s->sym_next++] = dist >> 8; \ + s->sym_buf[s->sym_next++] = (uch)dist; \ + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); \ s->sym_buf[s->sym_next++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ diff --git a/compat/zlib/inftrees.c b/compat/zlib/inftrees.c index 09462a7..a2f386c 100644 --- a/compat/zlib/inftrees.c +++ b/compat/zlib/inftrees.c @@ -62,7 +62,7 @@ unsigned short FAR *work; 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 199, 202}; + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 202}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, diff --git a/compat/zlib/trees.c b/compat/zlib/trees.c index f73fd99..8b438cc 100644 --- a/compat/zlib/trees.c +++ b/compat/zlib/trees.c @@ -1017,9 +1017,9 @@ int ZLIB_INTERNAL _tr_tally (s, dist, lc) unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { - s->sym_buf[s->sym_next++] = dist; - s->sym_buf[s->sym_next++] = dist >> 8; - s->sym_buf[s->sym_next++] = lc; + s->sym_buf[s->sym_next++] = (uch)dist; + s->sym_buf[s->sym_next++] = (uch)(dist >> 8); + s->sym_buf[s->sym_next++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; -- cgit v0.12 From 8a2c8e2ec7abae84c15d9888e7c0eeba4397b6ee Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 May 2022 07:15:13 +0000 Subject: rebuild zlib1.dll 1.2.12.1 for i686 and x86_64 --- compat/zlib/win32/zlib1.dll | Bin 122880 -> 122880 bytes compat/zlib/win64/zlib1.dll | Bin 135168 -> 134144 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/compat/zlib/win32/zlib1.dll b/compat/zlib/win32/zlib1.dll index 6c45f4d..e87de8c 100755 Binary files a/compat/zlib/win32/zlib1.dll and b/compat/zlib/win32/zlib1.dll differ diff --git a/compat/zlib/win64/zlib1.dll b/compat/zlib/win64/zlib1.dll index a5c6da6..9e38c08 100755 Binary files a/compat/zlib/win64/zlib1.dll and b/compat/zlib/win64/zlib1.dll differ -- cgit v0.12 From d166e4d7a11a0f526ddd5667210777e260609595 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 9 May 2022 19:22:51 +0000 Subject: rebuild zlib1.dll 1.2.12.1 for aarch64 (win64-arm) --- compat/zlib/win64-arm/zlib1.dll | Bin 95232 -> 95232 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/compat/zlib/win64-arm/zlib1.dll b/compat/zlib/win64-arm/zlib1.dll index 161b60f..9025467 100755 Binary files a/compat/zlib/win64-arm/zlib1.dll and b/compat/zlib/win64-arm/zlib1.dll differ -- cgit v0.12