diff options
| author | Mark Adler <git@madler.net> | 2026-02-10 22:32:14 -0800 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2026-02-10 22:37:25 -0800 |
| commit | d37e27eef65c6249631e8757601c43e813ded155 (patch) | |
| tree | 7ff2c5aafa82e50ee86ff8a59a6dde7b410a6659 | |
| parent | fb8dd62f77d88808bbe342b72eca41e6ac0ec7e0 (diff) | |
| download | zlib-d37e27eef65c6249631e8757601c43e813ded155.tar.gz zlib-d37e27eef65c6249631e8757601c43e813ded155.tar.bz2 zlib-d37e27eef65c6249631e8757601c43e813ded155.zip | |
Reduce warnings in contrib/minizip.
| -rw-r--r-- | contrib/minizip/crypt.h | 2 | ||||
| -rw-r--r-- | contrib/minizip/skipset.h | 3 | ||||
| -rw-r--r-- | contrib/minizip/zip.c | 15 |
3 files changed, 11 insertions, 9 deletions
diff --git a/contrib/minizip/crypt.h b/contrib/minizip/crypt.h index 8bde464b..821c9137 100644 --- a/contrib/minizip/crypt.h +++ b/contrib/minizip/crypt.h | |||
| @@ -106,7 +106,7 @@ static unsigned crypthead(const char* passwd, /* password string */ | |||
| 106 | */ | 106 | */ |
| 107 | if (++calls == 1) | 107 | if (++calls == 1) |
| 108 | { | 108 | { |
| 109 | srand((unsigned)(time(NULL) ^ ZCR_SEED2)); | 109 | srand((unsigned)time(NULL) ^ ZCR_SEED2); |
| 110 | } | 110 | } |
| 111 | init_keys(passwd, pkeys, pcrc_32_tab); | 111 | init_keys(passwd, pkeys, pcrc_32_tab); |
| 112 | for (n = 0; n < RAND_HEAD_LEN-2; n++) | 112 | for (n = 0; n < RAND_HEAD_LEN-2; n++) |
diff --git a/contrib/minizip/skipset.h b/contrib/minizip/skipset.h index 9f0aad61..beb67887 100644 --- a/contrib/minizip/skipset.h +++ b/contrib/minizip/skipset.h | |||
| @@ -184,7 +184,8 @@ void set_grow(set_t *set, set_node_t *node, int want, int fill) { | |||
| 184 | int more = node->size ? node->size : 1; | 184 | int more = node->size ? node->size : 1; |
| 185 | while (more < want) | 185 | while (more < want) |
| 186 | more <<= 1; | 186 | more <<= 1; |
| 187 | node->right = set_alloc(set, node->right, more * sizeof(set_node_t *)); | 187 | node->right = set_alloc(set, node->right, |
| 188 | (size_t)more * sizeof(set_node_t *)); | ||
| 188 | node->size = (i16_t)more; | 189 | node->size = (i16_t)more; |
| 189 | } | 190 | } |
| 190 | int i; | 191 | int i; |
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c index 13c36beb..60e603d7 100644 --- a/contrib/minizip/zip.c +++ b/contrib/minizip/zip.c | |||
| @@ -337,7 +337,7 @@ local int block_get(block_t *block) { | |||
| 337 | return -1; | 337 | return -1; |
| 338 | /* Update left in case more was filled in since we were last here. */ | 338 | /* Update left in case more was filled in since we were last here. */ |
| 339 | block->left = block->node->filled_in_this_block - | 339 | block->left = block->node->filled_in_this_block - |
| 340 | (block->next - block->node->data); | 340 | (size_t)(block->next - block->node->data); |
| 341 | if (block->left != 0) | 341 | if (block->left != 0) |
| 342 | /* There was indeed more data appended in the current datablock. */ | 342 | /* There was indeed more data appended in the current datablock. */ |
| 343 | break; | 343 | break; |
| @@ -357,8 +357,9 @@ local int block_get(block_t *block) { | |||
| 357 | /* Return a 16-bit unsigned little-endian value from block, or a negative value | 357 | /* Return a 16-bit unsigned little-endian value from block, or a negative value |
| 358 | // if the end is reached. */ | 358 | // if the end is reached. */ |
| 359 | local long block_get2(block_t *block) { | 359 | local long block_get2(block_t *block) { |
| 360 | long got = block_get(block); | 360 | int low = block_get(block); |
| 361 | return got | ((unsigned long)block_get(block) << 8); | 361 | int high = block_get(block); |
| 362 | return low < 0 || high < 0 ? -1 : low | ((long)high << 8); | ||
| 362 | } | 363 | } |
| 363 | 364 | ||
| 364 | /* Read up to len bytes from block into buf. Return the number of bytes read. */ | 365 | /* Read up to len bytes from block into buf. Return the number of bytes read. */ |
| @@ -420,9 +421,9 @@ local char *block_central_name(block_t *block, set_t *set) { | |||
| 420 | /* Go through the remaining fixed-length portion of the record, | 421 | /* Go through the remaining fixed-length portion of the record, |
| 421 | // extracting the lengths of the three variable-length fields. */ | 422 | // extracting the lengths of the three variable-length fields. */ |
| 422 | block_skip(block, 24); | 423 | block_skip(block, 24); |
| 423 | unsigned flen = block_get2(block); /* file name length */ | 424 | unsigned flen = (unsigned)block_get2(block); /* file name length */ |
| 424 | unsigned xlen = block_get2(block); /* extra field length */ | 425 | unsigned xlen = (unsigned)block_get2(block); /* extra length */ |
| 425 | unsigned clen = block_get2(block); /* comment field length */ | 426 | unsigned clen = (unsigned)block_get2(block); /* comment length */ |
| 426 | if (block_skip(block, 12) == -1) | 427 | if (block_skip(block, 12) == -1) |
| 427 | /* Premature end of the record. */ | 428 | /* Premature end of the record. */ |
| 428 | break; | 429 | break; |
| @@ -1283,7 +1284,7 @@ local int isutf8(char const *str, size_t len) { | |||
| 1283 | if (code > 1) | 1284 | if (code > 1) |
| 1284 | utf8 = 1; | 1285 | utf8 = 1; |
| 1285 | str += code; | 1286 | str += code; |
| 1286 | len -= code; | 1287 | len -= (unsigned)code; |
| 1287 | } | 1288 | } |
| 1288 | return utf8; | 1289 | return utf8; |
| 1289 | } | 1290 | } |
