Commit 2c6a3e977798f7c0b0e38d19bda2094ff4c7547f
1 parent
637c33a7
Refactor `QPDFJob::Selection`: remove redundant `qpdf` member, update related lo…
…gic in `handlePageSpecs` and `new_selection`, and simplify page processing.
Showing
2 changed files
with
2 additions
and
5 deletions
libqpdf/QPDFJob.cc
| @@ -2416,7 +2416,6 @@ QPDFJob::Inputs::process_all() | @@ -2416,7 +2416,6 @@ QPDFJob::Inputs::process_all() | ||
| 2416 | // Read original pages from the PDF, and parse the page range associated with this | 2416 | // Read original pages from the PDF, and parse the page range associated with this |
| 2417 | // occurrence of the file. | 2417 | // occurrence of the file. |
| 2418 | auto const& file_spec = files[selection.filename]; | 2418 | auto const& file_spec = files[selection.filename]; |
| 2419 | - selection.qpdf = file_spec.qpdf; | ||
| 2420 | if (selection.range.empty()) { | 2419 | if (selection.range.empty()) { |
| 2421 | selection.selected_pages.reserve(static_cast<size_t>(file_spec.n_pages)); | 2420 | selection.selected_pages.reserve(static_cast<size_t>(file_spec.n_pages)); |
| 2422 | for (int i = 1; i <= file_spec.n_pages; ++i) { | 2421 | for (int i = 1; i <= file_spec.n_pages; ++i) { |
| @@ -2533,8 +2532,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf) | @@ -2533,8 +2532,8 @@ QPDFJob::handlePageSpecs(QPDF& pdf) | ||
| 2533 | if (input.cfis) { | 2532 | if (input.cfis) { |
| 2534 | input.cfis->stayOpen(true); | 2533 | input.cfis->stayOpen(true); |
| 2535 | } | 2534 | } |
| 2536 | - auto& pldh = selection.qpdf->page_labels(); | ||
| 2537 | - auto& other_afdh = selection.qpdf->acroform(); | 2535 | + auto& pldh = input.qpdf->page_labels(); |
| 2536 | + auto& other_afdh = input.qpdf->acroform(); | ||
| 2538 | if (pldh.hasPageLabels()) { | 2537 | if (pldh.hasPageLabels()) { |
| 2539 | any_page_labels = true; | 2538 | any_page_labels = true; |
| 2540 | } | 2539 | } |
libqpdf/qpdf/QPDFJob_private.hh
| @@ -20,7 +20,6 @@ struct QPDFJob::Selection | @@ -20,7 +20,6 @@ struct QPDFJob::Selection | ||
| 20 | Selection(QPDFJob::Selection const& other, int page) : | 20 | Selection(QPDFJob::Selection const& other, int page) : |
| 21 | filename(other.filename), | 21 | filename(other.filename), |
| 22 | // range and password are no longer required when this constructor is called. | 22 | // range and password are no longer required when this constructor is called. |
| 23 | - qpdf(other.qpdf), | ||
| 24 | selected_pages({page}) | 23 | selected_pages({page}) |
| 25 | { | 24 | { |
| 26 | } | 25 | } |
| @@ -30,7 +29,6 @@ struct QPDFJob::Selection | @@ -30,7 +29,6 @@ struct QPDFJob::Selection | ||
| 30 | std::string filename; | 29 | std::string filename; |
| 31 | std::string password; | 30 | std::string password; |
| 32 | std::string range; | 31 | std::string range; |
| 33 | - QPDF* qpdf; | ||
| 34 | std::vector<int> selected_pages; | 32 | std::vector<int> selected_pages; |
| 35 | }; | 33 | }; |
| 36 | 34 |