MCPcopy Index your code
hub / github.com/RsyncProject/rsync / deflateParams

Function deflateParams

zlib/deflate.c:506–541  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

504
505/* ========================================================================= */
506int ZEXPORT deflateParams(z_streamp strm, int level, int strategy)
507{
508 deflate_state *s;
509 compress_func func;
510 int err = Z_OK;
511
512 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
513 s = strm->state;
514
515#ifdef FASTEST
516 if (level != 0) level = 1;
517#else
518 if (level == Z_DEFAULT_COMPRESSION) level = 6;
519#endif
520 if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
521 return Z_STREAM_ERROR;
522 }
523 func = configuration_table[s->level].func;
524
525 if ((strategy != s->strategy || func != configuration_table[level].func) &&
526 strm->total_in != 0) {
527 /* Flush the last buffer: */
528 err = deflate(strm, Z_BLOCK);
529 if (err == Z_BUF_ERROR && s->pending == 0)
530 err = Z_OK;
531 }
532 if (s->level != level) {
533 s->level = level;
534 s->max_lazy_match = configuration_table[level].max_lazy;
535 s->good_match = configuration_table[level].good_length;
536 s->nice_match = configuration_table[level].nice_length;
537 s->max_chain_length = configuration_table[level].max_chain;
538 }
539 s->strategy = strategy;
540 return err;
541}
542
543/* ========================================================================= */
544int ZEXPORT deflateTune(z_streamp strm, int good_length, int max_lazy,

Callers

nothing calls this directly

Calls 1

deflateFunction · 0.85

Tested by

no test coverage detected