MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / fixedtables

Function fixedtables

extlibs/minizip/src/infback.c:84–126  ·  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

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

Callers 1

inflateBackFunction · 0.70

Calls 1

inflate_tableFunction · 0.85

Tested by

no test coverage detected