Avoid some conversion warnings in gzread.c and gzwrite.c.
This commit is contained in:
parent
e00a2bd392
commit
793ad7f559
10
gzread.c
10
gzread.c
@ -314,9 +314,9 @@ local z_size_t gz_read(state, buf, len)
|
|||||||
got = 0;
|
got = 0;
|
||||||
do {
|
do {
|
||||||
/* set n to the maximum amount of len that fits in an unsigned int */
|
/* set n to the maximum amount of len that fits in an unsigned int */
|
||||||
n = -1;
|
n = (unsigned)-1;
|
||||||
if (n > len)
|
if (n > len)
|
||||||
n = len;
|
n = (unsigned)len;
|
||||||
|
|
||||||
/* first just try copying data from the output buffer */
|
/* first just try copying data from the output buffer */
|
||||||
if (state->x.have) {
|
if (state->x.have) {
|
||||||
@ -397,7 +397,7 @@ int ZEXPORT gzread(file, buf, len)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* read len or fewer bytes to buf */
|
/* read len or fewer bytes to buf */
|
||||||
len = gz_read(state, buf, len);
|
len = (unsigned)gz_read(state, buf, len);
|
||||||
|
|
||||||
/* check for an error */
|
/* check for an error */
|
||||||
if (len == 0 && state->err != Z_OK && state->err != Z_BUF_ERROR)
|
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)
|
|||||||
int ZEXPORT gzgetc(file)
|
int ZEXPORT gzgetc(file)
|
||||||
gzFile file;
|
gzFile file;
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
unsigned char buf[1];
|
unsigned char buf[1];
|
||||||
gz_statep state;
|
gz_statep state;
|
||||||
|
|
||||||
@ -469,8 +468,7 @@ int ZEXPORT gzgetc(file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* nothing there -- try gz_read() */
|
/* nothing there -- try gz_read() */
|
||||||
ret = gz_read(state, buf, 1);
|
return gz_read(state, buf, 1) < 1 ? -1 : buf[0];
|
||||||
return ret < 1 ? -1 : buf[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT gzgetc_(file)
|
int ZEXPORT gzgetc_(file)
|
||||||
|
@ -209,7 +209,7 @@ local z_size_t gz_write(state, buf, len)
|
|||||||
state->in);
|
state->in);
|
||||||
copy = state->size - have;
|
copy = state->size - have;
|
||||||
if (copy > len)
|
if (copy > len)
|
||||||
copy = len;
|
copy = (unsigned)len;
|
||||||
memcpy(state->in + have, buf, copy);
|
memcpy(state->in + have, buf, copy);
|
||||||
state->strm.avail_in += copy;
|
state->strm.avail_in += copy;
|
||||||
state->x.pos += copy;
|
state->x.pos += copy;
|
||||||
@ -229,7 +229,7 @@ local z_size_t gz_write(state, buf, len)
|
|||||||
do {
|
do {
|
||||||
unsigned n = (unsigned)-1;
|
unsigned n = (unsigned)-1;
|
||||||
if (n > len)
|
if (n > len)
|
||||||
n = len;
|
n = (unsigned)len;
|
||||||
state->strm.avail_in = n;
|
state->strm.avail_in = n;
|
||||||
state->x.pos += n;
|
state->x.pos += n;
|
||||||
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user