int last_flush; /* value of flush param for previous deflate call */
int reproducible; /* Whether reproducible compression results are required. */
- int block_open;
+ unsigned int block_open;
/* Whether or not a block is currently open for the QUICK deflation scheme.
* This is set to 1 if there is an active block, or 0 if the block was just closed.
*/
* matches. It is used only for the fast compression options.
*/
Z_INTERNAL block_state deflate_fast(deflate_state *s, int flush) {
- Pos hash_head; /* head of the hash chain */
int bflush = 0; /* set if current block must be flushed */
- int64_t dist;
uint32_t match_len = 0;
for (;;) {
* dictionary, and set hash_head to the head of the hash chain:
*/
if (s->lookahead >= WANT_MIN_MATCH) {
- hash_head = quick_insert_string(s, s->strstart);
- dist = (int64_t)s->strstart - hash_head;
+ Pos hash_head = quick_insert_string(s, s->strstart);
+ int64_t dist = (int64_t)s->strstart - hash_head;
/* Find the longest match, discarding those <= prev_length.
* At this point we have always match length < WANT_MIN_MATCH
FLUSH_BLOCK(s, 0);
}
s->insert = s->strstart < (STD_MIN_MATCH - 1) ? s->strstart : (STD_MIN_MATCH - 1);
+
if (UNLIKELY(flush == Z_FINISH)) {
FLUSH_BLOCK(s, 1);
return finish_done;
#define QUICK_START_BLOCK(s, last) { \
zng_tr_emit_tree(s, STATIC_TREES, last); \
- s->block_open = 1 + (int)last; \
+ s->block_open = 1 + last; \
s->block_start = (int)s->strstart; \
}
}
Z_INTERNAL block_state deflate_quick(deflate_state *s, int flush) {
- Pos hash_head;
- int64_t dist;
- unsigned match_len, last;
-
-
- last = (flush == Z_FINISH) ? 1 : 0;
+ unsigned last = (flush == Z_FINISH) ? 1 : 0;
if (UNLIKELY(last && s->block_open != 2)) {
/* Emit end of previous block */
QUICK_END_BLOCK(s, 0);
}
if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
- hash_head = quick_insert_string(s, s->strstart);
- dist = (int64_t)s->strstart - hash_head;
+ Pos hash_head = quick_insert_string(s, s->strstart);
+ int64_t dist = (int64_t)s->strstart - hash_head;
if (dist <= MAX_DIST(s) && dist > 0) {
const uint8_t *str_start = s->window + s->strstart;
const uint8_t *match_start = s->window + hash_head;
if (zng_memcmp_2(str_start, match_start) == 0) {
- match_len = FUNCTABLE_CALL(compare256)(str_start+2, match_start+2) + 2;
+ uint32_t match_len = FUNCTABLE_CALL(compare256)(str_start+2, match_start+2) + 2;
if (match_len >= WANT_MIN_MATCH) {
if (UNLIKELY(match_len > s->lookahead))
* no better match at the next window position.
*/
Z_INTERNAL block_state deflate_slow(deflate_state *s, int flush) {
- Pos hash_head; /* head of hash chain */
int bflush; /* set if current block must be flushed */
- int64_t dist;
- uint32_t match_len;
match_func longest_match;
if (s->max_chain_length <= 1024)
/* Insert the string window[strstart .. strstart+2] in the
* dictionary, and set hash_head to the head of the hash chain:
*/
- hash_head = 0;
+ Pos hash_head = 0;
if (LIKELY(s->lookahead >= WANT_MIN_MATCH)) {
hash_head = s->quick_insert_string(s, s->strstart);
}
/* Find the longest match, discarding those <= prev_length.
*/
s->prev_match = (Pos)s->match_start;
- match_len = STD_MIN_MATCH - 1;
- dist = (int64_t)s->strstart - hash_head;
+ uint32_t match_len = STD_MIN_MATCH - 1;
+ int64_t dist = (int64_t)s->strstart - hash_head;
if (dist <= MAX_DIST(s) && dist > 0 && s->prev_length < s->max_lazy_match && hash_head != 0) {
/* To simplify the code, we prevent matches with the string