MCPcopy Create free account
hub / github.com/F-Stack/f-stack / deflateInit2_

Function deflateInit2_

freebsd/contrib/zlib/deflate.c:243–351  ·  view source on GitHub ↗

========================================================================= */

(strm, level, method, windowBits, memLevel, strategy,
                  version, stream_size)

Source from the content-addressed store, hash-verified

241
242/* ========================================================================= */
243int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
244 version, stream_size)
245 z_streamp strm;
246 int level;
247 int method;
248 int windowBits;
249 int memLevel;
250 int strategy;
251 const char *version;
252 int stream_size;
253{
254 deflate_state *s;
255 int wrap = 1;
256 static const char my_version[] = ZLIB_VERSION;
257
258 ushf *overlay;
259 /* We overlay pending_buf and d_buf+l_buf. This works since the average
260 * output size for (length,distance) codes is <= 24 bits.
261 */
262
263 if (version == Z_NULL || version[0] != my_version[0] ||
264 stream_size != sizeof(z_stream)) {
265 return Z_VERSION_ERROR;
266 }
267 if (strm == Z_NULL) return Z_STREAM_ERROR;
268
269 strm->msg = Z_NULL;
270 if (strm->zalloc == (alloc_func)0) {
271#if defined(Z_SOLO) && !defined(_KERNEL)
272 return Z_STREAM_ERROR;
273#else
274 strm->zalloc = zcalloc;
275 strm->opaque = (voidpf)0;
276#endif
277 }
278 if (strm->zfree == (free_func)0)
279#if defined(Z_SOLO) && !defined(_KERNEL)
280 return Z_STREAM_ERROR;
281#else
282 strm->zfree = zcfree;
283#endif
284
285#ifdef FASTEST
286 if (level != 0) level = 1;
287#else
288 if (level == Z_DEFAULT_COMPRESSION) level = 6;
289#endif
290
291 if (windowBits < 0) { /* suppress zlib wrapper */
292 wrap = 0;
293 windowBits = -windowBits;
294 }
295#ifdef GZIP
296 else if (windowBits > 15) {
297 wrap = 2; /* write gzip wrapper instead */
298 windowBits -= 16;
299 }
300#endif

Callers 2

zstd_zlibwrapper.cFile · 0.85
deflateInit_Function · 0.85

Calls 2

deflateEndFunction · 0.85
deflateResetFunction · 0.85

Tested by

no test coverage detected