]> git.lizzy.rs Git - zlib.git/commitdiff
Use a uniform approach for the largest value of an unsigned type.
authorMark Adler <madler@alumni.caltech.edu>
Sat, 31 Dec 2016 16:49:17 +0000 (08:49 -0800)
committerMark Adler <madler@alumni.caltech.edu>
Sat, 31 Dec 2016 16:49:17 +0000 (08:49 -0800)
compress.c
inflate.c
uncompr.c

index e5831e8aaec1f5a7877761c15af90792e79c4045..f0d075755a49e812b7f8b76af5e2bc864d2bfc50 100644 (file)
@@ -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;
index 0372edfda762908c9a45335cd6ff734b89e90b21..92e9139a67fe49f270bf6070611d2ecbfd4a76b0 100644 (file)
--- 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);
 }
index 2fbfcc0c5176d4fe50f9c551f43c913685c3fe66..f03a1a865e347d10ac16f6a70b2bc2fdc5235f9c 100644 (file)
--- 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 */