diff options
| author | Mika Lindqvist <postmaster@raasu.org> | 2019-11-26 01:23:50 +0200 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2019-11-26 15:43:47 +0100 |
| commit | 3ea747396dcc3d63924eedbdf05bacf7866e1b29 (patch) | |
| tree | 0941ad618a1cc9ac2b7ae1cb691f4d3e86b35120 | |
| parent | edad2ab5887ac2eaad7357258b50d620825742c9 (diff) | |
| download | Project-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.c | 6 | ||||
| -rw-r--r-- | zlib.h | 2 |
2 files changed, 7 insertions, 1 deletions
@@ -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 @@ -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 |
