]> git.lizzy.rs Git - zlib.git/commitdiff
Have gzputc return the character written instead of the argument.
authorMark Adler <madler@alumni.caltech.edu>
Sun, 29 Jan 2012 17:12:08 +0000 (09:12 -0800)
committerMark Adler <madler@alumni.caltech.edu>
Sun, 29 Jan 2012 17:47:29 +0000 (09:47 -0800)
When successful, gzputc would return the second argument.  If the
second argument were -1, gzputc would return -1 instead of the
character written, which was 255.  However the -1 would not be
distinguishable from an error.  Now gzputc returns 255 in that
case.

gzwrite.c

index 18ade4ada8ffff0e5d8f6db2b5d875a4877e75e2..c48c906daed96c5c762c4f7662e91cd7ab0582b3 100644 (file)
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -272,14 +272,14 @@ int ZEXPORT gzputc(file, c)
             strm->next_in = state->in;
         strm->next_in[strm->avail_in++] = c;
         state->x.pos++;
-        return c;
+        return c & 0xff;
     }
 
     /* no room in buffer or not initialized, use gz_write() */
     buf[0] = c;
     if (gzwrite(file, buf, 1) != 1)
         return -1;
-    return c;
+    return c & 0xff;
 }
 
 /* -- see zlib.h -- */