summaryrefslogtreecommitdiff
path: root/inflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2016-10-11 22:15:50 -0700
committerHans Kristian Rosbach <hk-git@circlestorm.org>2017-01-31 12:24:20 +0100
commitf9bb580bcba2e94eb1c931d0d8d9146d86704557 (patch)
tree5b304d549df2af887cd3f8c006911953f1bd1eec /inflate.c
parent52380f5b4475ad92c4aa5f033fa119fcb914e633 (diff)
Clean up type conversions.
Based on upstream 7096424f23df1b1813237fb5f8bc8f34cfcedd0c, but modified heavily to match zlib-ng.
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/inflate.c b/inflate.c
index 17c7239..1f715db 100644
--- a/inflate.c
+++ b/inflate.c
@@ -214,11 +214,11 @@ int ZEXPORT inflatePrime(z_stream *strm, int bits, int value) {
state->bits = 0;
return Z_OK;
}
- if (bits > 16 || state->bits + bits > 32)
+ if (bits > 16 || state->bits + (unsigned int)bits > 32)
return Z_STREAM_ERROR;
value &= (1L << bits) - 1;
state->hold += (unsigned)value << state->bits;
- state->bits += bits;
+ state->bits += (unsigned int)bits;
return Z_OK;
}
@@ -735,7 +735,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
do {
len = (unsigned)(next[copy++]);
if (state->head != NULL && state->head->name != NULL && state->length < state->head->name_max)
- state->head->name[state->length++] = len;
+ state->head->name[state->length++] = (unsigned char)len;
} while (len && copy < have);
if ((state->flags & 0x0200) && (state->wrap & 4))
state->check = crc32(state->check, next, copy);
@@ -756,7 +756,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
len = (unsigned)(next[copy++]);
if (state->head != NULL && state->head->comment != NULL
&& state->length < state->head->comm_max)
- state->head->comment[state->length++] = len;
+ state->head->comment[state->length++] = (unsigned char)len;
} while (len && copy < have);
if ((state->flags & 0x0200) && (state->wrap & 4))
state->check = crc32(state->check, next, copy);
@@ -1219,7 +1219,7 @@ int ZEXPORT inflate(z_stream *strm, int flush) {
state->total += out;
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)
ret = Z_BUF_ERROR;
@@ -1451,6 +1451,7 @@ int ZEXPORT inflateUndermine(z_stream *strm, int subvert) {
state->sane = !subvert;
return Z_OK;
#else
+ (void)subvert;
state->sane = 1;
return Z_DATA_ERROR;
#endif