/* 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.
*/
/* 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);
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); \
*/
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 */
/* 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]
/* ===========================================================================
* 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 */
* 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 */