From: Mark Adler Date: Sat, 31 Dec 2016 16:49:17 +0000 (-0800) Subject: Use a uniform approach for the largest value of an unsigned type. X-Git-Tag: 1.9.9-b1~710 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd0071573cb2189ab059c91d1249e5ec4a4df991;p=thirdparty%2Fzlib-ng.git Use a uniform approach for the largest value of an unsigned type. --- diff --git a/compress.c b/compress.c index 1fba05701..d4f99bb31 100644 --- a/compress.c +++ b/compress.c @@ -23,7 +23,7 @@ int ZEXPORT compress2(unsigned char *dest, size_t *destLen, const unsigned char size_t sourceLen, int level) { z_stream stream; int err; - const unsigned int max = (unsigned int)0 - 1; + const unsigned int max = (unsigned int)-1; size_t left; left = *destLen; diff --git a/inflate.c b/inflate.c index 298479f86..0f7e3e711 100644 --- a/inflate.c +++ b/inflate.c @@ -1496,7 +1496,7 @@ long ZEXPORT inflateMark(z_stream *strm) { unsigned long ZEXPORT inflateCodesUsed(z_stream *strm) { struct inflate_state *state; if (strm == NULL || strm->state == NULL) - return (unsigned long)0 - 1; + return (unsigned long)-1; state = (struct inflate_state *)strm->state; return (unsigned long)(state->next - state->codes); } diff --git a/uncompr.c b/uncompr.c index 834ffc90c..7bf47b8dd 100644 --- a/uncompr.c +++ b/uncompr.c @@ -27,7 +27,7 @@ int ZEXPORT uncompress2(unsigned char *dest, size_t *destLen, const unsigned char *source, size_t *sourceLen) { z_stream stream; int err; - const unsigned int max = (unsigned int)0 - 1; + const unsigned int max = (unsigned int)-1; size_t len, left; unsigned char buf[1]; /* for detection of incomplete stream when *destLen == 0 */