aboutsummaryrefslogtreecommitdiff
path: root/gzread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gzread.c')
-rw-r--r--gzread.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gzread.c b/gzread.c
index 956b91e..f94abfe 100644
--- a/gzread.c
+++ b/gzread.c
@@ -314,9 +314,9 @@ local z_size_t gz_read(state, buf, len)
314 got = 0; 314 got = 0;
315 do { 315 do {
316 /* set n to the maximum amount of len that fits in an unsigned int */ 316 /* set n to the maximum amount of len that fits in an unsigned int */
317 n = -1; 317 n = (unsigned)-1;
318 if (n > len) 318 if (n > len)
319 n = len; 319 n = (unsigned)len;
320 320
321 /* first just try copying data from the output buffer */ 321 /* first just try copying data from the output buffer */
322 if (state->x.have) { 322 if (state->x.have) {
@@ -397,7 +397,7 @@ int ZEXPORT gzread(file, buf, len)
397 } 397 }
398 398
399 /* read len or fewer bytes to buf */ 399 /* read len or fewer bytes to buf */
400 len = gz_read(state, buf, len); 400 len = (unsigned)gz_read(state, buf, len);
401 401
402 /* check for an error */ 402 /* check for an error */
403 if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR) 403 if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
@@ -447,7 +447,6 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file)
447int ZEXPORT gzgetc(file) 447int ZEXPORT gzgetc(file)
448 gzFile file; 448 gzFile file;
449{ 449{
450 int ret;
451 unsigned char buf[1]; 450 unsigned char buf[1];
452 gz_statep state; 451 gz_statep state;
453 452
@@ -469,8 +468,7 @@ int ZEXPORT gzgetc(file)
469 } 468 }
470 469
471 /* nothing there -- try gz_read() */ 470 /* nothing there -- try gz_read() */
472 ret = gz_read(state, buf, 1); 471 return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
473 return ret < 1 ? -1 : buf[0];
474} 472}
475 473
476int ZEXPORT gzgetc_(file) 474int ZEXPORT gzgetc_(file)