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 /zlib-flate/zlib-flate.cc | |
parent | bda5d26894c857a05f811a6ebd3595d26424d2ea (diff) | |
download | qpdf-dac0598b94c877bec92a1edd78ae00021cfa1638.tar.zst |
Add ability to set zlib compression level globally
Diffstat (limited to 'zlib-flate/zlib-flate.cc')
-rw-r--r-- | zlib-flate/zlib-flate.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc index d1c74d4d..c2613202 100644 --- a/zlib-flate/zlib-flate.cc +++ b/zlib-flate/zlib-flate.cc @@ -12,8 +12,14 @@ static char const* whoami = 0; void usage() { - std::cerr << "Usage: " << whoami << " { -uncompress | -compress }" - << std::endl; + std::cerr << "Usage: " << whoami << " { -uncompress | -compress[=n] }" + << std::endl + << "If n is specified with -compress, it is a" + << " zlib compression level from" << std::endl + << "1 to 9 where lower numbers are faster and" + << " less compressed and higher" << std::endl + << "numbers are slower and more compresed" + << std::endl; exit(2); } @@ -43,6 +49,7 @@ int main(int argc, char* argv[]) { usage(); } + // QXXXQ level Pl_Flate::action_e action = Pl_Flate::a_inflate; @@ -54,6 +61,12 @@ int main(int argc, char* argv[]) { action = Pl_Flate::a_deflate; } + else if ((strncmp(argv[1], "-compress=", 10) == 0)) + { + action = Pl_Flate::a_deflate; + int level = QUtil::string_to_int(argv[1] + 10); + Pl_Flate::setCompressionLevel(level); + } else { usage(); |