QPDFJob: make createsOutput callable before run()

This commit is contained in:
Jay Berkenbilt 2022-01-23 13:04:08 -05:00
parent 2a2ec1c066
commit c4e56fa5f4
2 changed files with 8 additions and 9 deletions

View File

@ -85,6 +85,10 @@ class QPDFJob
QPDF_DLL
void setOutputStreams(std::ostream* out_stream, std::ostream* err_stream);
// Returns true if output is created by the specified job.
QPDF_DLL
bool createsOutput() const;
// QXXXQ set options -- implemented in QPDFJob_options.cc
// QXXXQ these will not be in the final interface
@ -108,9 +112,6 @@ class QPDFJob
QPDF_DLL
bool hasWarnings();
QPDF_DLL
bool createsOutput(); // QXXXQ need better name
// Return value is bitwise OR of values from qpdf_encryption_status_e
QPDF_DLL
unsigned long getEncryptionStatus();
@ -398,7 +399,6 @@ class QPDFJob
std::string message_prefix;
bool warnings;
bool creates_output;
std::ostream* cout;
std::ostream* cerr;
unsigned long encryption_status;

View File

@ -322,7 +322,6 @@ ProgressReporter::reportProgress(int percentage)
QPDFJob::Members::Members() :
message_prefix("qpdf"),
warnings(false),
creates_output(false),
cout(&std::cout),
cerr(&std::cerr),
encryption_status(0)
@ -500,8 +499,7 @@ QPDFJob::run()
handleUnderOverlay(pdf);
handleTransformations(pdf);
this->m->creates_output = ((o.outfilename != nullptr) || o.replace_input);
if (! this->m->creates_output)
if (! createsOutput())
{
doInspection(pdf);
}
@ -526,9 +524,10 @@ QPDFJob::hasWarnings()
}
bool
QPDFJob::createsOutput()
QPDFJob::createsOutput() const
{
return this->m->creates_output;
QPDFJob const& o = *this; // QXXXQ
return ((o.outfilename != nullptr) || o.replace_input);
}
bool