diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:14:26 +0000 |
commit | c4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch) | |
tree | 93d5c6aa93d9987680dd1adad5685e2ad698f223 /wsutil/adler32.c | |
parent | Adding upstream version 4.2.6. (diff) | |
download | wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.tar.xz wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.zip |
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wsutil/adler32.c')
-rw-r--r-- | wsutil/adler32.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/wsutil/adler32.c b/wsutil/adler32.c index 2830eab4..bdd99395 100644 --- a/wsutil/adler32.c +++ b/wsutil/adler32.c @@ -12,6 +12,13 @@ #include <wsutil/adler32.h> +#ifdef HAVE_ZLIBNG +#include <zlib-ng.h> +#else +#ifdef HAVE_ZLIB +#include <zlib.h> +#endif /* HAVE_ZLIB */ +#endif #include <string.h> #define BASE 65521 /* largest prime smaller than 65536 */ @@ -19,6 +26,13 @@ /*--- update_adler32 --------------------------------------------------------*/ uint32_t update_adler32(uint32_t adler, const uint8_t *buf, size_t len) { +#if defined (HAVE_ZLIB) || defined (HAVE_ZLIBNG) +#ifdef HAVE_ZLIBNG + return (uint32_t)zng_adler32(adler, buf, len); +#else + return (uint32_t)adler32(adler, buf, len); +#endif +#endif uint32_t s1 = adler & 0xffff; uint32_t s2 = (adler >> 16) & 0xffff; size_t n; @@ -28,6 +42,7 @@ uint32_t update_adler32(uint32_t adler, const uint8_t *buf, size_t len) s2 = (s2 + s1) % BASE; } return (s2 << 16) + s1; + } /*--- adler32 ---------------------------------------------------------------*/ |