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: v1.2.9~5 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=b7fbee215674c3399212dffba1e71323056931d9;p=zlib.git Use a uniform approach for the largest value of an unsigned type. --- diff --git a/compress.c b/compress.c index e5831e8..f0d0757 100644 --- a/compress.c +++ b/compress.c @@ -28,7 +28,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) { z_stream stream; int err; - const uInt max = (uInt)0 - 1; + const uInt max = (uInt)-1; uLong left; left = *destLen; diff --git a/inflate.c b/inflate.c index 0372edf..92e9139 100644 --- a/inflate.c +++ b/inflate.c @@ -1555,7 +1555,7 @@ unsigned long ZEXPORT inflateCodesUsed(strm) z_streamp strm; { struct inflate_state FAR *state; - if (inflateStateCheck(strm)) return (unsigned long)0 - 1; + if (inflateStateCheck(strm)) return (unsigned long)-1; state = (struct inflate_state FAR *)strm->state; return (unsigned long)(state->next - state->codes); } diff --git a/uncompr.c b/uncompr.c index 2fbfcc0..f03a1a8 100644 --- a/uncompr.c +++ b/uncompr.c @@ -32,7 +32,7 @@ int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) { z_stream stream; int err; - const uInt max = (uInt)0 - 1; + const uInt max = (uInt)-1; uLong len, left; Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */