From e489f8922a571d5b42e4c0c3d3a91d421b785efd Mon Sep 17 00:00:00 2001 From: joern274 Date: Thu, 4 Jul 2024 19:38:19 +0200 Subject: [PATCH] Bugfix: use 32 bit array for crc_table in zlib --- deps/abc/src/misc/zlib/crc32.c | 4 ++-- deps/abc/src/misc/zlib/crc32.h | 10 +++++++++- deps/abc/src/misc/zlib/zlib.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/deps/abc/src/misc/zlib/crc32.c b/deps/abc/src/misc/zlib/crc32.c index 46c9700871c..74b8c755681 100644 --- a/deps/abc/src/misc/zlib/crc32.c +++ b/deps/abc/src/misc/zlib/crc32.c @@ -213,13 +213,13 @@ ABC_NAMESPACE_IMPL_START /* ========================================================================= * This function can be used by asm versions of crc32() */ -const unsigned long FAR * ZEXPORT get_crc_table() +const unsigned FAR * ZEXPORT get_crc_table() /* changed long -> unsigned (see crc32.h) */ { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; + return (const unsigned FAR *)crc_table; } /* ========================================================================= */ diff --git a/deps/abc/src/misc/zlib/crc32.h b/deps/abc/src/misc/zlib/crc32.h index d023439aa52..3818d7c6e85 100644 --- a/deps/abc/src/misc/zlib/crc32.h +++ b/deps/abc/src/misc/zlib/crc32.h @@ -4,7 +4,15 @@ ABC_NAMESPACE_HEADER_START -local const unsigned long FAR crc_table[TBLS][256] = +/* changed long -> unsigned + + The curse of having a library frozen at an rather old version. In recent + versions the variable bit size gets adjusted according to system and + compile flags. By now we need unsigned (32 bit) since that is what + QuaZip expects. +*/ + +local const unsigned FAR crc_table[TBLS][256] = { { 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, diff --git a/deps/abc/src/misc/zlib/zlib.h b/deps/abc/src/misc/zlib/zlib.h index 46c1a1aecb7..b3d4533b669 100644 --- a/deps/abc/src/misc/zlib/zlib.h +++ b/deps/abc/src/misc/zlib/zlib.h @@ -1611,7 +1611,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, /* undocumented functions */ ZEXTERN const char * ZEXPORT zError OF((int)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); +ZEXTERN const unsigned * ZEXPORT get_crc_table OF((void)); /* changed long -> unsigned (see crc32.h) */ ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); ABC_NAMESPACE_HEADER_END