diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2017-02-11 22:45:27 -0800 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2017-02-15 22:39:26 -0800 |
commit | 793ad7f559555757e6443ea591ce70de5505fc69 (patch) | |
tree | 5dcbb55465c3d28237521bd7134d1d60a095ce42 /gzread.c | |
parent | e00a2bd392ca51351ecee55dbeee803f6ebda2f5 (diff) | |
download | zlib-793ad7f559555757e6443ea591ce70de5505fc69.tar.gz zlib-793ad7f559555757e6443ea591ce70de5505fc69.tar.bz2 zlib-793ad7f559555757e6443ea591ce70de5505fc69.zip |
Avoid some conversion warnings in gzread.c and gzwrite.c.
Diffstat (limited to 'gzread.c')
-rw-r--r-- | gzread.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -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) | |||
447 | int ZEXPORT gzgetc(file) | 447 | int 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 | ||
476 | int ZEXPORT gzgetc_(file) | 474 | int ZEXPORT gzgetc_(file) |