Commit c4e56fa5f40188ddf4f75d316e57143c10ed51fa
1 parent
2a2ec1c0
QPDFJob: make createsOutput callable before run()
Showing
2 changed files
with
8 additions
and
9 deletions
include/qpdf/QPDFJob.hh
| ... | ... | @@ -85,6 +85,10 @@ class QPDFJob |
| 85 | 85 | QPDF_DLL |
| 86 | 86 | void setOutputStreams(std::ostream* out_stream, std::ostream* err_stream); |
| 87 | 87 | |
| 88 | + // Returns true if output is created by the specified job. | |
| 89 | + QPDF_DLL | |
| 90 | + bool createsOutput() const; | |
| 91 | + | |
| 88 | 92 | // QXXXQ set options -- implemented in QPDFJob_options.cc |
| 89 | 93 | |
| 90 | 94 | // QXXXQ these will not be in the final interface |
| ... | ... | @@ -108,9 +112,6 @@ class QPDFJob |
| 108 | 112 | QPDF_DLL |
| 109 | 113 | bool hasWarnings(); |
| 110 | 114 | |
| 111 | - QPDF_DLL | |
| 112 | - bool createsOutput(); // QXXXQ need better name | |
| 113 | - | |
| 114 | 115 | // Return value is bitwise OR of values from qpdf_encryption_status_e |
| 115 | 116 | QPDF_DLL |
| 116 | 117 | unsigned long getEncryptionStatus(); |
| ... | ... | @@ -398,7 +399,6 @@ class QPDFJob |
| 398 | 399 | |
| 399 | 400 | std::string message_prefix; |
| 400 | 401 | bool warnings; |
| 401 | - bool creates_output; | |
| 402 | 402 | std::ostream* cout; |
| 403 | 403 | std::ostream* cerr; |
| 404 | 404 | unsigned long encryption_status; | ... | ... |
libqpdf/QPDFJob.cc
| ... | ... | @@ -322,7 +322,6 @@ ProgressReporter::reportProgress(int percentage) |
| 322 | 322 | QPDFJob::Members::Members() : |
| 323 | 323 | message_prefix("qpdf"), |
| 324 | 324 | warnings(false), |
| 325 | - creates_output(false), | |
| 326 | 325 | cout(&std::cout), |
| 327 | 326 | cerr(&std::cerr), |
| 328 | 327 | encryption_status(0) |
| ... | ... | @@ -500,8 +499,7 @@ QPDFJob::run() |
| 500 | 499 | handleUnderOverlay(pdf); |
| 501 | 500 | handleTransformations(pdf); |
| 502 | 501 | |
| 503 | - this->m->creates_output = ((o.outfilename != nullptr) || o.replace_input); | |
| 504 | - if (! this->m->creates_output) | |
| 502 | + if (! createsOutput()) | |
| 505 | 503 | { |
| 506 | 504 | doInspection(pdf); |
| 507 | 505 | } |
| ... | ... | @@ -526,9 +524,10 @@ QPDFJob::hasWarnings() |
| 526 | 524 | } |
| 527 | 525 | |
| 528 | 526 | bool |
| 529 | -QPDFJob::createsOutput() | |
| 527 | +QPDFJob::createsOutput() const | |
| 530 | 528 | { |
| 531 | - return this->m->creates_output; | |
| 529 | + QPDFJob const& o = *this; // QXXXQ | |
| 530 | + return ((o.outfilename != nullptr) || o.replace_input); | |
| 532 | 531 | } |
| 533 | 532 | |
| 534 | 533 | bool | ... | ... |