diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index e1f7538..5a544bd 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -18,3 +18,5 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb 9ae7bdea966102f9621b22192747a891078e7470 # Normalize white space in ChangeLog d7b909f97d3effc9540c35b0251bdf1c9abf187c +# Remove 'this->' +f5cac93ac63559ddc0aec1b1c61c9e2503c7b8e0 diff --git a/libqpdf/QPDFJob_argv.cc b/libqpdf/QPDFJob_argv.cc index 9aeabc0..180a7a6 100644 --- a/libqpdf/QPDFJob_argv.cc +++ b/libqpdf/QPDFJob_argv.cc @@ -117,8 +117,10 @@ ArgParser::argZopfli() logger->info("Set the environment variable QPDF_ZOPFLI to activate.\n"); logger->info("* QPDF_ZOPFLI=disabled or QPDF_ZOPFLI not set: don't use zopfli.\n"); logger->info("* QPDF_ZOPFLI=force: use zopfli, and fail if not available.\n"); - logger->info("* QPDF_ZOPFLI=silent: use zopfli if available and silently fall back if not.\n"); - logger->info("* QPDF_ZOPFLI= any other value: use zopfli if available, and warn if not.\n"); + logger->info( + "* QPDF_ZOPFLI=silent: use zopfli if available and silently fall back if not.\n"); + logger->info( + "* QPDF_ZOPFLI= any other value: use zopfli if available, and warn if not.\n"); } } else { logger->error("zopfli support is not enabled\n"); diff --git a/libqpdf/SF_FlateLzwDecode.cc b/libqpdf/SF_FlateLzwDecode.cc index b24ee5a..3be8dfc 100644 --- a/libqpdf/SF_FlateLzwDecode.cc +++ b/libqpdf/SF_FlateLzwDecode.cc @@ -7,17 +7,6 @@ #include #include -SF_FlateLzwDecode::SF_FlateLzwDecode(bool lzw) : - lzw(lzw), - // Initialize values to their defaults as per the PDF spec - predictor(1), - columns(1), - colors(1), - bits_per_component(8), - early_code_change(true) -{ -} - bool SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms) { @@ -32,14 +21,13 @@ SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms) if (key == "/Predictor") { if (value.isInteger()) { predictor = value.getIntValueAsInt(); - if (!((predictor == 1) || (predictor == 2) || - ((predictor >= 10) && (predictor <= 15)))) { + if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) { filterable = false; } } else { filterable = false; } - } else if ((key == "/Columns") || (key == "/Colors") || (key == "/BitsPerComponent")) { + } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") { if (value.isInteger()) { int val = value.getIntValueAsInt(); if (key == "/Columns") { @@ -56,7 +44,7 @@ SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms) if (value.isInteger()) { int earlychange = value.getIntValueAsInt(); early_code_change = (earlychange == 1); - if (!((earlychange == 0) || (earlychange == 1))) { + if (!(earlychange == 0 || earlychange == 1)) { filterable = false; } } else { @@ -65,7 +53,7 @@ SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms) } } - if ((predictor > 1) && (columns == 0)) { + if (predictor > 1 && columns == 0) { filterable = false; } @@ -76,7 +64,7 @@ Pipeline* SF_FlateLzwDecode::getDecodePipeline(Pipeline* next) { std::shared_ptr pipeline; - if ((predictor >= 10) && (predictor <= 15)) { + if (predictor >= 10 && predictor <= 15) { QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter"); pipeline = std::make_shared( "png decode", diff --git a/libqpdf/qpdf/SF_FlateLzwDecode.hh b/libqpdf/qpdf/SF_FlateLzwDecode.hh index 203d893..4b70b50 100644 --- a/libqpdf/qpdf/SF_FlateLzwDecode.hh +++ b/libqpdf/qpdf/SF_FlateLzwDecode.hh @@ -5,25 +5,29 @@ #ifndef SF_FLATELZWDECODE_HH # define SF_FLATELZWDECODE_HH -class SF_FlateLzwDecode: public QPDFStreamFilter +class SF_FlateLzwDecode final: public QPDFStreamFilter { public: - SF_FlateLzwDecode(bool lzw); - ~SF_FlateLzwDecode() override = default; + SF_FlateLzwDecode(bool lzw) : + lzw(lzw) + { + } + ~SF_FlateLzwDecode() final = default; - bool setDecodeParms(QPDFObjectHandle decode_parms) override; - Pipeline* getDecodePipeline(Pipeline* next) override; + bool setDecodeParms(QPDFObjectHandle decode_parms) final; + Pipeline* getDecodePipeline(Pipeline* next) final; static std::shared_ptr flate_factory(); static std::shared_ptr lzw_factory(); private: - bool lzw; - int predictor; - int columns; - int colors; - int bits_per_component; - bool early_code_change; + bool lzw{}; + // Defaults as per the PDF spec + int predictor{1}; + int columns{1}; + int colors{1}; + int bits_per_component{8}; + bool early_code_change{true}; std::vector> pipelines; };