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

Function deflateParams

zlib/deflate.c:416–451  ·  view source on GitHub ↗

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

(strm, level, strategy)

Source from the content-addressed store, hash-verified

414
415/* ========================================================================= */
416int ZEXPORT deflateParams(strm, level, strategy)
417 z_streamp strm;
418 int level;
419 int strategy;
420{
421 deflate_state *s;
422 compress_func func;
423 int err = Z_OK;
424
425 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
426 s = strm->state;
427
428#ifdef FASTEST
429 if (level != 0) level = 1;
430#else
431 if (level == Z_DEFAULT_COMPRESSION) level = 6;
432#endif
433 if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
434 return Z_STREAM_ERROR;
435 }
436 func = configuration_table[s->level].func;
437
438 if (func != configuration_table[level].func && strm->total_in != 0) {
439 /* Flush the last buffer: */
440 err = deflate(strm, Z_PARTIAL_FLUSH);
441 }
442 if (s->level != level) {
443 s->level = level;
444 s->max_lazy_match = configuration_table[level].max_lazy;
445 s->good_match = configuration_table[level].good_length;
446 s->nice_match = configuration_table[level].nice_length;
447 s->max_chain_length = configuration_table[level].max_chain;
448 }
449 s->strategy = strategy;
450 return err;
451}
452
453/* ========================================================================= */
454int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)

Callers 1

gzsetparamsFunction · 0.85

Calls 1

deflateFunction · 0.85

Tested by

no test coverage detected