summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Kristian Rosbach <hk-git@circlestorm.org>2020-08-25 16:36:28 +0200
committerHans Kristian Rosbach <hk-github@circlestorm.org>2020-08-27 19:20:38 +0200
commit6264b5a58d7470333a64d69b247a2bd561bbbe68 (patch)
treec5f5e085460f3458ff572fb3e6fd5b8c47676ce8
parent3a26093bafc2a842472916dc67b3d91818e819fd (diff)
downloadProject-Tick-6264b5a58d7470333a64d69b247a2bd561bbbe68.tar.gz
Project-Tick-6264b5a58d7470333a64d69b247a2bd561bbbe68.zip
Fix more conversion warnings related to s->bi_valid, stored_len and misc.
-rw-r--r--deflate.h6
-rw-r--r--deflate_p.h2
-rw-r--r--trees.c20
3 files changed, 15 insertions, 13 deletions
diff --git a/deflate.h b/deflate.h
index 898f78ce79..9087e2e24b 100644
--- a/deflate.h
+++ b/deflate.h
@@ -260,7 +260,7 @@ typedef struct internal_state {
/* Output buffer. bits are inserted starting at the bottom (least
* significant bits).
*/
- int bi_valid;
+ int32_t bi_valid;
/* Number of valid bits in bi_buf. All bits above the last valid bit
* are always zero.
*/
@@ -390,10 +390,10 @@ void ZLIB_INTERNAL slide_hash_c(deflate_state *s);
/* in trees.c */
void ZLIB_INTERNAL zng_tr_init(deflate_state *s);
-void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
+void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
void ZLIB_INTERNAL zng_tr_flush_bits(deflate_state *s);
void ZLIB_INTERNAL zng_tr_align(deflate_state *s);
-void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last);
+void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last);
unsigned ZLIB_INTERNAL bi_reverse(unsigned code, int len);
void ZLIB_INTERNAL flush_pending(PREFIX3(streamp) strm);
diff --git a/deflate_p.h b/deflate_p.h
index 78a63af040..60ca1370f3 100644
--- a/deflate_p.h
+++ b/deflate_p.h
@@ -61,7 +61,7 @@ static inline int zng_tr_tally_dist(deflate_state *s, unsigned dist, unsigned ch
zng_tr_flush_block(s, (s->block_start >= 0 ? \
(char *)&s->window[(unsigned)s->block_start] : \
NULL), \
- (unsigned long)((int)s->strstart - s->block_start), \
+ (uint32_t)((int)s->strstart - s->block_start), \
(last)); \
s->block_start = (int)s->strstart; \
flush_pending(s->strm); \
diff --git a/trees.c b/trees.c
index 47734f3082..83d77c1547 100644
--- a/trees.c
+++ b/trees.c
@@ -206,11 +206,13 @@ static void gen_bitlen(deflate_state *s, tree_desc *desc) {
*/
tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */
- for (h = s->heap_max+1; h < HEAP_SIZE; h++) {
+ for (h = s->heap_max + 1; h < HEAP_SIZE; h++) {
n = s->heap[h];
- bits = tree[tree[n].Dad].Len + 1;
- if (bits > max_length)
- bits = max_length, overflow++;
+ bits = tree[tree[n].Dad].Len + 1u;
+ if (bits > max_length){
+ bits = max_length;
+ overflow++;
+ }
tree[n].Len = (uint16_t)bits;
/* We overwrite tree[n].Dad which is no longer needed */
@@ -234,11 +236,11 @@ static void gen_bitlen(deflate_state *s, tree_desc *desc) {
/* Find the first bit length which could increase: */
do {
- bits = max_length-1;
+ bits = max_length - 1;
while (s->bl_count[bits] == 0)
bits--;
- s->bl_count[bits]--; /* move one leaf down the tree */
- s->bl_count[bits+1] += 2; /* move one overflow item as its brother */
+ s->bl_count[bits]--; /* move one leaf down the tree */
+ s->bl_count[bits+1] += 2u; /* move one overflow item as its brother */
s->bl_count[max_length]--;
/* The brother of the overflow item also moves one step up,
* but this does not affect bl_count[max_length]
@@ -587,7 +589,7 @@ static void send_all_trees(deflate_state *s, int lcodes, int dcodes, int blcodes
/* ===========================================================================
* Send a stored block
*/
-void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
+void ZLIB_INTERNAL zng_tr_stored_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
/* buf: input block */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */
@@ -627,7 +629,7 @@ void ZLIB_INTERNAL zng_tr_align(deflate_state *s) {
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
-void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, unsigned long stored_len, int last) {
+void ZLIB_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_len, int last) {
/* buf: input block, or NULL if too old */
/* stored_len: length of input block */
/* last: one if this is the last block for a file */