summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMika Lindqvist <postmaster@raasu.org>2019-11-26 01:23:50 +0200
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-11-26 15:43:47 +0100
commit3ea747396dcc3d63924eedbdf05bacf7866e1b29 (patch)
tree0941ad618a1cc9ac2b7ae1cb691f4d3e86b35120
parentedad2ab5887ac2eaad7357258b50d620825742c9 (diff)
downloadProject-Tick-3ea747396dcc3d63924eedbdf05bacf7866e1b29.tar.gz
Project-Tick-3ea747396dcc3d63924eedbdf05bacf7866e1b29.zip
Compatibility fix for crc32()
* Use "unsigned long" externally instead of "uint32_t" for crc * Use "unsigned int" externally instead of "uint32_t" for len Fixes #483
-rw-r--r--crc32.c6
-rw-r--r--zlib.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/crc32.c b/crc32.c
index 4959ceac76..557067e4be 100644
--- a/crc32.c
+++ b/crc32.c
@@ -64,9 +64,15 @@ ZLIB_INTERNAL uint32_t crc32_generic(uint32_t crc, const unsigned char *buf, uin
return crc ^ 0xffffffff;
}
+#ifdef ZLIB_COMPAT
+unsigned long ZEXPORT PREFIX(crc32)(unsigned long crc, const unsigned char *buf, unsigned int len) {
+ return (unsigned long) PREFIX(crc32_z)((uint32_t) crc, buf, len);
+}
+#else
uint32_t ZEXPORT PREFIX(crc32)(uint32_t crc, const unsigned char *buf, uint32_t len) {
return PREFIX(crc32_z)(crc, buf, len);
}
+#endif
/*
This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit
diff --git a/zlib.h b/zlib.h
index bd8c9733e2..5b2f32b309 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1680,7 +1680,7 @@ ZEXTERN uint32_t ZEXPORT adler32_combine(uint32_t adler1, uint32_t adler2, z_off
negative, the result has no meaning or utility.
*/
-ZEXTERN uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uint32_t len);
+ZEXTERN unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char *buf, unsigned int len);
/*
Update a running CRC-32 with the bytes buf[0..len-1] and return the
updated CRC-32. If buf is NULL, this function returns the required