diff --git a/compat/crypt.h b/compat/crypt.h index 5eba242c..6e9b51ff 100644 --- a/compat/crypt.h +++ b/compat/crypt.h @@ -26,10 +26,12 @@ */ #ifndef _ZLIB_H -# if (ZLIB_VERNUM < 0x1270) +# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) + /* Define z_crc_t in zlib 1.2.6 and less */ typedef unsigned long z_crc_t; -# else - typedef uint32_t z_crc_t; +# elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df) + /* Define z_crc_t in zlib-ng 2.0.7 and less */ + typedef unsigned int z_crc_t; # endif #endif diff --git a/mz_crypt.c b/mz_crypt.c index 4c8d6596..2971f84c 100644 --- a/mz_crypt.c +++ b/mz_crypt.c @@ -34,11 +34,12 @@ int32_t mz_crypt_rand(uint8_t *buf, int32_t size) { uint32_t mz_crypt_crc32_update(uint32_t value, const uint8_t *buf, int32_t size) { #if defined(HAVE_ZLIB) - /* Define z_crc_t in zlib 1.2.5 and less or if using zlib-ng */ -# if (ZLIB_VERNUM < 0x1270) +# if (ZLIB_VERNUM & 0xf != 0xf) && (ZLIB_VERNUM < 0x1270) + /* Define z_crc_t in zlib 1.2.6 and less */ typedef unsigned long z_crc_t; -# else - typedef uint32_t z_crc_t; +# elif (ZLIB_VERNUM & 0xf == 0xf) && (ZLIB_VERNUM < 0x12df) + /* Define z_crc_t in zlib-ng 2.0.7 and less */ + typedef unsigned int z_crc_t; # endif return (uint32_t)ZLIB_PREFIX(crc32)((z_crc_t)value, buf, (uInt)size); #elif defined(HAVE_LZMA)