aboutsummaryrefslogtreecommitdiff
path: root/gzwrite.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-01-29 09:12:08 -0800
committerMark Adler <madler@alumni.caltech.edu>2012-01-29 09:47:29 -0800
commit22eb01184fd2d33b482a289d0bb08b2e2b0c5a18 (patch)
tree3c897fff9827ec2bf097cd150e66dcca45854f4d /gzwrite.c
parent8fbd9f13400df299c8211b7b643bdbbe1ecabd77 (diff)
downloadzlib-22eb01184fd2d33b482a289d0bb08b2e2b0c5a18.tar.gz
zlib-22eb01184fd2d33b482a289d0bb08b2e2b0c5a18.tar.bz2
zlib-22eb01184fd2d33b482a289d0bb08b2e2b0c5a18.zip
Have gzputc return the character written instead of the argument.
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.
Diffstat (limited to 'gzwrite.c')
-rw-r--r--gzwrite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gzwrite.c b/gzwrite.c
index 18ade4a..c48c906 100644
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -272,14 +272,14 @@ int ZEXPORT gzputc(file, c)
272 strm->next_in = state->in; 272 strm->next_in = state->in;
273 strm->next_in[strm->avail_in++] = c; 273 strm->next_in[strm->avail_in++] = c;
274 state->x.pos++; 274 state->x.pos++;
275 return c; 275 return c & 0xff;
276 } 276 }
277 277
278 /* no room in buffer or not initialized, use gz_write() */ 278 /* no room in buffer or not initialized, use gz_write() */
279 buf[0] = c; 279 buf[0] = c;
280 if (gzwrite(file, buf, 1) != 1) 280 if (gzwrite(file, buf, 1) != 1)
281 return -1; 281 return -1;
282 return c; 282 return c & 0xff;
283} 283}
284 284
285/* -- see zlib.h -- */ 285/* -- see zlib.h -- */