MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / inflateBackInit_

Function inflateBackInit_

ZLib/infback.c:28–70  ·  view source on GitHub ↗

strm provides memory allocation functions in zalloc and zfree, or Z_NULL to use the library memory allocation functions. windowBits is in the range 8..15, and window is a user-supplied window and output buffer that is 2**windowBits bytes. */

(strm, windowBits, window, version, stream_size)

Source from the content-addressed store, hash-verified

26 window and output buffer that is 2**windowBits bytes.
27 */
28int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size)
29z_streamp strm;
30int windowBits;
31unsigned char FAR *window;
32const char *version;
33int stream_size;
34{
35 struct inflate_state FAR *state;
36
37 if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
38 stream_size != (int)(sizeof(z_stream)))
39 return Z_VERSION_ERROR;
40 if (strm == Z_NULL || window == Z_NULL ||
41 windowBits < 8 || windowBits > 15)
42 return Z_STREAM_ERROR;
43 strm->msg = Z_NULL; /* in case we return an error */
44 if (strm->zalloc == (alloc_func)0) {
45#ifdef Z_SOLO
46 return Z_STREAM_ERROR;
47#else
48 strm->zalloc = zcalloc;
49 strm->opaque = (voidpf)0;
50#endif
51 }
52 if (strm->zfree == (free_func)0)
53#ifdef Z_SOLO
54 return Z_STREAM_ERROR;
55#else
56 strm->zfree = zcfree;
57#endif
58 state = (struct inflate_state FAR *)ZALLOC(strm, 1,
59 sizeof(struct inflate_state));
60 if (state == Z_NULL) return Z_MEM_ERROR;
61 Tracev((stderr, "inflate: allocated\n"));
62 strm->state = (struct internal_state FAR *)state;
63 state->dmax = 32768U;
64 state->wbits = windowBits;
65 state->wsize = 1U << windowBits;
66 state->window = window;
67 state->wnext = 0;
68 state->whave = 0;
69 return Z_OK;
70}
71
72/*
73 Return state with length and distance decoding tables and index sizes set to

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected