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

Function fixedtables

zlib/infback.c:73–114  ·  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

71 may not be thread-safe.
72 */
73local void fixedtables(state)
74struct inflate_state FAR *state;
75{
76#ifdef BUILDFIXED
77 static int virgin = 1;
78 static code *lenfix, *distfix;
79 static code fixed[544];
80
81 /* build fixed huffman tables if first call (may not be thread safe) */
82 if (virgin) {
83 unsigned sym, bits;
84 static code *next;
85
86 /* literal/length table */
87 sym = 0;
88 while (sym < 144) state->lens[sym++] = 8;
89 while (sym < 256) state->lens[sym++] = 9;
90 while (sym < 280) state->lens[sym++] = 7;
91 while (sym < 288) state->lens[sym++] = 8;
92 next = fixed;
93 lenfix = next;
94 bits = 9;
95 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
96
97 /* distance table */
98 sym = 0;
99 while (sym < 32) state->lens[sym++] = 5;
100 distfix = next;
101 bits = 5;
102 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
103
104 /* do this just once */
105 virgin = 0;
106 }
107#else /* !BUILDFIXED */
108# include "inffixed.h"
109#endif /* BUILDFIXED */
110 state->lencode = lenfix;
111 state->lenbits = 9;
112 state->distcode = distfix;
113 state->distbits = 5;
114}
115
116/* Macros for inflateBack(): */
117

Callers 1

inflateBackFunction · 0.70

Calls 1

inflate_tableFunction · 0.85

Tested by

no test coverage detected