MCPcopy Create free account
hub / github.com/TruthHun/BookStack / deflate_huff

Function deflate_huff

static/word2md/mammoth.browser.js:19206–19256  ·  view source on GitHub ↗
(s, flush)

Source from the content-addressed store, hash-verified

19204 * (It will be regenerated if this run of deflate switches away from Huffman.)
19205 */
19206function deflate_huff(s, flush) {
19207 var bflush; /* set if current block must be flushed */
19208
19209 for (;;) {
19210 /* Make sure that we have a literal to write. */
19211 if (s.lookahead === 0) {
19212 fill_window(s);
19213 if (s.lookahead === 0) {
19214 if (flush === Z_NO_FLUSH) {
19215 return BS_NEED_MORE;
19216 }
19217 break; /* flush the current block */
19218 }
19219 }
19220
19221 /* Output a literal byte */
19222 s.match_length = 0;
19223 //Tracevv((stderr,"%c", s->window[s->strstart]));
19224 /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/
19225 bflush = trees._tr_tally(s, 0, s.window[s.strstart]);
19226 s.lookahead--;
19227 s.strstart++;
19228 if (bflush) {
19229 /*** FLUSH_BLOCK(s, 0); ***/
19230 flush_block_only(s, false);
19231 if (s.strm.avail_out === 0) {
19232 return BS_NEED_MORE;
19233 }
19234 /***/
19235 }
19236 }
19237 s.insert = 0;
19238 if (flush === Z_FINISH) {
19239 /*** FLUSH_BLOCK(s, 1); ***/
19240 flush_block_only(s, true);
19241 if (s.strm.avail_out === 0) {
19242 return BS_FINISH_STARTED;
19243 }
19244 /***/
19245 return BS_FINISH_DONE;
19246 }
19247 if (s.last_lit) {
19248 /*** FLUSH_BLOCK(s, 0); ***/
19249 flush_block_only(s, false);
19250 if (s.strm.avail_out === 0) {
19251 return BS_NEED_MORE;
19252 }
19253 /***/
19254 }
19255 return BS_BLOCK_DONE;
19256}
19257
19258/* Values for max_lazy_match, good_match and max_chain_length, depending on
19259 * the desired pack level (0..9). The values given below have been tuned to

Callers 1

deflateFunction · 0.70

Calls 2

fill_windowFunction · 0.70
flush_block_onlyFunction · 0.70

Tested by

no test coverage detected