From a03c5fce136e44135380318322984e77cd637f4f Mon Sep 17 00:00:00 2001 From: m-holger Date: Fri, 9 May 2025 12:24:45 +0100 Subject: [PATCH] Simplify stream filtering logic and remove unused variable. --- libqpdf/QPDF_Stream.cc | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 64f37dd..d0f4bb3 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -382,8 +382,6 @@ Stream::filterable( return false; } - bool filterable = true; - // filters now contains a list of filters to be applied in order. See which ones we can support. // See if we can support any decode parameters that are specified. @@ -407,10 +405,6 @@ Stream::filterable( // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild. if ((filters.size() != 0) && (decode_parms.size() != filters.size())) { warn("stream /DecodeParms length is inconsistent with filters"); - filterable = false; - } - - if (!filterable) { return false; } @@ -418,20 +412,20 @@ Stream::filterable( auto filter = filters.at(i); auto decode_item = decode_parms.at(i); - if (filter->setDecodeParms(decode_item)) { - if (filter->isSpecializedCompression()) { - specialized_compression = true; - } - if (filter->isLossyCompression()) { - specialized_compression = true; - lossy_compression = true; - } - } else { - filterable = false; + if (!filter->setDecodeParms(decode_item)) { + return false; + } + if (filter->isLossyCompression()) { + specialized_compression = true; + lossy_compression = true; + continue; + } + if (filter->isSpecializedCompression()) { + specialized_compression = true; } } - return filterable; + return true; } bool -- libgit2 0.21.4