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

Function fixedtables

extlibs/minizip/src/inflate.c:291–333  ·  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

289 may not be thread-safe.
290 */
291local void fixedtables(state)
292
293struct inflate_state FAR * state;
294{
295#ifdef BUILDFIXED
296 static int virgin = 1;
297 static code *lenfix, *distfix;
298 static code fixed[544];
299
300 /* build fixed huffman tables if first call (may not be thread safe) */
301 if (virgin) {
302 unsigned sym, bits;
303 static code *next;
304
305 /* literal/length table */
306 sym = 0;
307 while (sym < 144) state->lens[sym++] = 8;
308 while (sym < 256) state->lens[sym++] = 9;
309 while (sym < 280) state->lens[sym++] = 7;
310 while (sym < 288) state->lens[sym++] = 8;
311 next = fixed;
312 lenfix = next;
313 bits = 9;
314 inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work);
315
316 /* distance table */
317 sym = 0;
318 while (sym < 32) state->lens[sym++] = 5;
319 distfix = next;
320 bits = 5;
321 inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work);
322
323 /* do this just once */
324 virgin = 0;
325 }
326#else /* !BUILDFIXED */
327# include "inffixed.h"
328#endif /* BUILDFIXED */
329 state->lencode = lenfix;
330 state->lenbits = 9;
331 state->distcode = distfix;
332 state->distbits = 5;
333}
334
335#ifdef MAKEFIXED
336#include <stdio.h>

Callers 2

makefixedFunction · 0.70
inflate.cFile · 0.70

Calls 1

inflate_tableFunction · 0.85

Tested by

no test coverage detected