Commit 909daf9543a6e364a50568485278fdfd6c6abb7d
1 parent
24f28f07
Move page spec processing earlier
Showing
4 changed files
with
23 additions
and
7 deletions
ChangeLog
| 1 | +2017-08-05 Jay Berkenbilt <ejb@ql.org> | |
| 2 | + | |
| 3 | + * Process --pages options earlier so that certain inspection | |
| 4 | + options, like --show-pages, can show the state after the merging | |
| 5 | + operations. | |
| 6 | + | |
| 1 | 7 | 2017-08-02 Jay Berkenbilt <ejb@ql.org> |
| 2 | 8 | |
| 3 | 9 | * Fix off-by-one error in parsing pages options. Fixes #129. | ... | ... |
qpdf/qpdf.cc
| ... | ... | @@ -1874,12 +1874,6 @@ static void set_encryption_options(QPDF& pdf, Options& o, QPDFWriter& w) |
| 1874 | 1874 | static void write_outfile(QPDF& pdf, Options& o) |
| 1875 | 1875 | { |
| 1876 | 1876 | QPDF encryption_pdf; |
| 1877 | - std::vector<PointerHolder<QPDF> > page_heap; | |
| 1878 | - if (! o.page_specs.empty()) | |
| 1879 | - { | |
| 1880 | - handle_page_specs(pdf, o, page_heap); | |
| 1881 | - } | |
| 1882 | - | |
| 1883 | 1877 | if (strcmp(o.outfilename, "-") == 0) |
| 1884 | 1878 | { |
| 1885 | 1879 | o.outfilename = 0; |
| ... | ... | @@ -2020,6 +2014,12 @@ int main(int argc, char* argv[]) |
| 2020 | 2014 | pdf.processFile(o.infilename, o.password); |
| 2021 | 2015 | } |
| 2022 | 2016 | |
| 2017 | + std::vector<PointerHolder<QPDF> > page_heap; | |
| 2018 | + if (! o.page_specs.empty()) | |
| 2019 | + { | |
| 2020 | + handle_page_specs(pdf, o, page_heap); | |
| 2021 | + } | |
| 2022 | + | |
| 2023 | 2023 | if (o.outfilename == 0) |
| 2024 | 2024 | { |
| 2025 | 2025 | do_inspection(pdf, o); | ... | ... |
qpdf/qtest/qpdf.test
| ... | ... | @@ -206,7 +206,7 @@ $td->runtest("remove page we don't have", |
| 206 | 206 | show_ntests(); |
| 207 | 207 | # ---------- |
| 208 | 208 | $td->notify("--- Miscellaneous Tests ---"); |
| 209 | -$n_tests += 94; | |
| 209 | +$n_tests += 95; | |
| 210 | 210 | |
| 211 | 211 | $td->runtest("qpdf version", |
| 212 | 212 | {$td->COMMAND => "qpdf --version"}, |
| ... | ... | @@ -652,6 +652,13 @@ $td->runtest("don't overwrite self", |
| 652 | 652 | {$td->REGEXP => "input file and output file are the same.*", |
| 653 | 653 | $td->EXIT_STATUS => 2}); |
| 654 | 654 | |
| 655 | +$td->runtest("combine show and --pages", | |
| 656 | + {$td->COMMAND => | |
| 657 | + "qpdf --empty --pages minimal.pdf -- --show-pages"}, | |
| 658 | + {$td->FILE => "show-pages-pages.out", | |
| 659 | + $td->EXIT_STATUS => 0}, | |
| 660 | + $td->NORMALIZE_NEWLINES); | |
| 661 | + | |
| 655 | 662 | show_ntests(); |
| 656 | 663 | # ---------- |
| 657 | 664 | $td->notify("--- Numeric range parsing tests ---"); | ... | ... |
qpdf/qtest/qpdf/show-pages-pages.out
0 → 100644