=========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */
| 2107 | * (It will be regenerated if this run of deflate switches away from Huffman.) |
| 2108 | */ |
| 2109 | local block_state deflate_huff(deflate_state *s, int flush) { |
| 2110 | int bflush; /* set if current block must be flushed */ |
| 2111 | |
| 2112 | for (;;) { |
| 2113 | /* Make sure that we have a literal to write. */ |
| 2114 | if (s->lookahead == 0) { |
| 2115 | fill_window(s); |
| 2116 | if (s->lookahead == 0) { |
| 2117 | if (flush == Z_NO_FLUSH) |
| 2118 | return need_more; |
| 2119 | break; /* flush the current block */ |
| 2120 | } |
| 2121 | } |
| 2122 | |
| 2123 | /* Output a literal byte */ |
| 2124 | s->match_length = 0; |
| 2125 | Tracevv((stderr,"%c", s->window[s->strstart])); |
| 2126 | _tr_tally_lit(s, s->window[s->strstart], bflush); |
| 2127 | s->lookahead--; |
| 2128 | s->strstart++; |
| 2129 | if (bflush) FLUSH_BLOCK(s, 0); |
| 2130 | } |
| 2131 | s->insert = 0; |
| 2132 | if (flush == Z_FINISH) { |
| 2133 | FLUSH_BLOCK(s, 1); |
| 2134 | return finish_done; |
| 2135 | } |
| 2136 | if (s->sym_next) |
| 2137 | FLUSH_BLOCK(s, 0); |
| 2138 | return block_done; |
| 2139 | } |
no test coverage detected