From 7096424f23df1b1813237fb5f8bc8f34cfcedd0c Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Tue, 11 Oct 2016 22:15:50 -0700 Subject: Clean up type conversions. --- inflate.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'inflate.c') diff --git a/inflate.c b/inflate.c index 2f3fcc9..eb1b4ce 100644 --- a/inflate.c +++ b/inflate.c @@ -241,10 +241,10 @@ int value; state->bits = 0; return Z_OK; } - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; + if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; value &= (1L << bits) - 1; state->hold += (unsigned)value << state->bits; - state->bits += bits; + state->bits += (uInt)bits; return Z_OK; } @@ -767,7 +767,7 @@ int flush; if (state->head != Z_NULL && state->head->name != Z_NULL && state->length < state->head->name_max) - state->head->name[state->length++] = len; + state->head->name[state->length++] = (Bytef)len; } while (len && copy < have); if ((state->flags & 0x0200) && (state->wrap & 4)) state->check = crc32(state->check, next, copy); @@ -788,7 +788,7 @@ int flush; if (state->head != Z_NULL && state->head->comment != Z_NULL && state->length < state->head->comm_max) - state->head->comment[state->length++] = len; + state->head->comment[state->length++] = (Bytef)len; } while (len && copy < have); if ((state->flags & 0x0200) && (state->wrap & 4)) state->check = crc32(state->check, next, copy); @@ -1249,7 +1249,7 @@ int flush; if ((state->wrap & 4) && out) strm->adler = state->check = UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + + strm->data_type = (int)state->bits + (state->last ? 64 : 0) + (state->mode == TYPE ? 128 : 0) + (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) @@ -1500,6 +1500,7 @@ int subvert; state->sane = !subvert; return Z_OK; #else + (void)subvert; state->sane = 1; return Z_DATA_ERROR; #endif @@ -1537,7 +1538,7 @@ unsigned long ZEXPORT inflateCodesUsed(strm) z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L; + if (strm == Z_NULL || strm->state == Z_NULL) return (unsigned long)0 - 1; state = (struct inflate_state FAR *)strm->state; - return state->next - state->codes; + return (unsigned long)(state->next - state->codes); } -- cgit v1.2.3-55-g6feb