diff options
author | Jay Berkenbilt <ejb@ql.org> | 2019-08-24 01:54:08 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2019-08-24 02:34:21 +0200 |
commit | dac0598b94c877bec92a1edd78ae00021cfa1638 (patch) | |
tree | 70988ddf9cc7c4e9c2e7b867bb135c331e061217 /libqpdf | |
parent | bda5d26894c857a05f811a6ebd3595d26424d2ea (diff) | |
download | qpdf-dac0598b94c877bec92a1edd78ae00021cfa1638.tar.zst |
Add ability to set zlib compression level globally
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/Pl_Flate.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libqpdf/Pl_Flate.cc b/libqpdf/Pl_Flate.cc index a782255b..1eca837e 100644 --- a/libqpdf/Pl_Flate.cc +++ b/libqpdf/Pl_Flate.cc @@ -6,6 +6,8 @@ #include <qpdf/QUtil.hh> #include <qpdf/QIntC.hh> +int Pl_Flate::compression_level = Z_DEFAULT_COMPRESSION; + Pl_Flate::Members::Members(size_t out_bufsize, action_e action) : out_bufsize(out_bufsize), @@ -120,7 +122,7 @@ Pl_Flate::handleData(unsigned char* data, size_t len, int flush) #endif if (this->m->action == a_deflate) { - err = deflateInit(&zstream, Z_DEFAULT_COMPRESSION); + err = deflateInit(&zstream, compression_level); } else { @@ -236,6 +238,12 @@ Pl_Flate::finish() } void +Pl_Flate::setCompressionLevel(int level) +{ + compression_level = level; +} + +void Pl_Flate::checkError(char const* prefix, int error_code) { z_stream& zstream = *(static_cast<z_stream*>(this->m->zdata)); |