diff options
author | Mark Adler <fork@madler.net> | 2022-10-01 19:55:29 -0700 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2023-03-17 21:27:56 +0100 |
commit | ba7b6788a543b02eb6924175dced964c28b1bf7f (patch) | |
tree | bc78e7dbe80a1d5d56e65941a9f886deaca1ce14 | |
parent | 39bac283533d5e9ac01a5e380679af9b091b9938 (diff) |
Fix bug in block type selection when Z_FIXED used.
A fixed block could be chosen when a stored block was smaller. Now
the smaller of the two is always chosen.
-rw-r--r-- | trees.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -670,7 +670,7 @@ void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_ opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, s->sym_next / 3)); - if (static_lenb <= opt_lenb) + if (static_lenb <= opt_lenb || s->strategy == Z_FIXED) opt_lenb = static_lenb; } else { @@ -688,7 +688,7 @@ void Z_INTERNAL zng_tr_flush_block(deflate_state *s, char *buf, uint32_t stored_ */ zng_tr_stored_block(s, buf, stored_len, last); - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { + } else if (static_lenb == opt_lenb) { zng_tr_emit_tree(s, STATIC_TREES, last); compress_block(s, (const ct_data *)static_ltree, (const ct_data *)static_dtree); cmpr_bits_add(s, s->static_len); |