mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 15:17:29 +00:00
Fix image optimization evaluation
Don't attempt to pass data through a JPEG filter if we are unable to filter the data.
This commit is contained in:
parent
ab536a4e55
commit
5c682f6d1e
23
qpdf/qpdf.cc
23
qpdf/qpdf.cc
@ -3548,16 +3548,7 @@ ImageOptimizer::makePipeline(std::string const& description, Pipeline* next)
|
||||
bool
|
||||
ImageOptimizer::evaluate(std::string const& description)
|
||||
{
|
||||
Pl_Discard d;
|
||||
Pl_Count c("count", &d);
|
||||
PointerHolder<Pipeline> p = makePipeline(description, &c);
|
||||
if (p.getPointer() == 0)
|
||||
{
|
||||
// message issued by makePipeline
|
||||
return false;
|
||||
}
|
||||
if (! image.pipeStreamData(p.getPointer(), 0, qpdf_dl_specialized,
|
||||
true, false))
|
||||
if (! image.pipeStreamData(0, 0, qpdf_dl_specialized, true))
|
||||
{
|
||||
QTC::TC("qpdf", "qpdf image optimize no pipeline");
|
||||
if (o.verbose)
|
||||
@ -3569,6 +3560,18 @@ ImageOptimizer::evaluate(std::string const& description)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Pl_Discard d;
|
||||
Pl_Count c("count", &d);
|
||||
PointerHolder<Pipeline> p = makePipeline(description, &c);
|
||||
if (p.getPointer() == 0)
|
||||
{
|
||||
// message issued by makePipeline
|
||||
return false;
|
||||
}
|
||||
if (! image.pipeStreamData(p.getPointer(), 0, qpdf_dl_specialized))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
long long orig_length = image.getDict().getKey("/Length").getIntValue();
|
||||
if (c.getCount() >= orig_length)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user