diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2016-12-31 16:57:26 -0800 |
---|---|---|
committer | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2017-02-09 11:21:35 +0100 |
commit | 73ba5ea69e0ef6f389aa3edd81d8f1038324d198 (patch) | |
tree | 95b2ebf89d88dcff6fa1f30f6ae87b71df7d5c3d /crc32.c | |
parent | cd0071573cb2189ab059c91d1249e5ec4a4df991 (diff) |
Add crc32_z() and adler32_z() functions with size_t lengths.
Diffstat (limited to 'crc32.c')
-rw-r--r-- | crc32.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -64,9 +64,9 @@ #include "deflate.h" #if BYTE_ORDER == LITTLE_ENDIAN -static uint32_t crc32_little(uint32_t, const unsigned char *, z_off64_t); +static uint32_t crc32_little(uint32_t, const unsigned char *, size_t); #elif BYTE_ORDER == BIG_ENDIAN -static uint32_t crc32_big(uint32_t, const unsigned char *, z_off64_t); +static uint32_t crc32_big(uint32_t, const unsigned char *, size_t); #endif /* Local functions for crc concatenation */ @@ -211,7 +211,7 @@ const uint32_t * ZEXPORT get_crc_table(void) { #define DO4 DO1; DO1; DO1; DO1 /* ========================================================================= */ -uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) { +uint32_t ZEXPORT crc32_z(uint32_t crc, const unsigned char *buf, size_t len) { if (buf == NULL) return 0; #ifdef DYNAMIC_CRC_TABLE @@ -246,6 +246,9 @@ uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) { return crc ^ 0xffffffff; } +uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, uint32_t len) { + return crc32_z(crc, buf, len); +} /* This BYFOUR code accesses the passed unsigned char * buffer with a 32-bit @@ -267,7 +270,7 @@ uint32_t ZEXPORT crc32(uint32_t crc, const unsigned char *buf, z_off64_t len) { #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 /* ========================================================================= */ -static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, z_off64_t len) { +static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, size_t len) { register uint32_t c; register const uint32_t *buf4; @@ -309,7 +312,7 @@ static uint32_t crc32_little(uint32_t crc, const unsigned char *buf, z_off64_t l #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* ========================================================================= */ -static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, z_off64_t len) { +static uint32_t crc32_big(uint32_t crc, const unsigned char *buf, size_t len) { register uint32_t c; register const uint32_t *buf4; |