MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / fixedtables

Function fixedtables

zlib/inflate.c:205–246  ·  view source on GitHub ↗

Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little e

(state)

Source from the content-addressed store, hash-verified

203 may not be thread-safe.
204 */
205local void fixedtables(state)
206struct inflate_state FAR *state;
207{
208#ifdef BUILDFIXED
209 static int virgin = 1;
210 static code *lenfix, *distfix;
211 static code fixed[544];
212
213 /* build fixed huffman tables if first call (may not be thread safe) */
214 if (virgin) {
215 unsigned sym, bits;
216 static code *next;
217
218 /* literal/length table */
219 sym = 0;
220 while (sym < 144) state->lens[sym++] = 8;
221 while (sym < 256) state->lens[sym++] = 9;
222 while (sym < 280) state->lens[sym++] = 7;
223 while (sym < 288) state->lens[sym++] = 8;
224 next = fixed;
225 lenfix = next;
226 bits = 9;
227 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
228
229 /* distance table */
230 sym = 0;
231 while (sym < 32) state->lens[sym++] = 5;
232 distfix = next;
233 bits = 5;
234 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
235
236 /* do this just once */
237 virgin = 0;
238 }
239#else /* !BUILDFIXED */
240# include "inffixed.h"
241#endif /* BUILDFIXED */
242 state->lencode = lenfix;
243 state->lenbits = 9;
244 state->distcode = distfix;
245 state->distbits = 5;
246}
247
248#ifdef MAKEFIXED
249#include <stdio.h>

Callers 2

makefixedFunction · 0.70
inflate.cFile · 0.70

Calls 1

inflate_tableFunction · 0.85

Tested by

no test coverage detected