Commit fa3cdaf1b46dcbb583393f93a02f89207ba21a88
1 parent
dedf9a06
Check for warnings in files used by --pages
Showing
4 changed files
with
13 additions
and
1 deletions
ChangeLog
| 1 | +2023-09-03 Jay Berkenbilt <ejb@ql.org> | ||
| 2 | + | ||
| 3 | + * Bug fix: with --pages, if one of the external files had warnings | ||
| 4 | + but the main file did not, the warning was previously not taken | ||
| 5 | + into consideration when determining the exit status. | ||
| 6 | + | ||
| 1 | 2023-09-02 Jay Berkenbilt <ejb@ql.org> | 7 | 2023-09-02 Jay Berkenbilt <ejb@ql.org> |
| 2 | 8 | ||
| 3 | * Bug fix from M. Holger: allow fix-qdf to read from pipe. Fixes #1010. | 9 | * Bug fix from M. Holger: allow fix-qdf to read from pipe. Fixes #1010. |
libqpdf/QPDFJob.cc
| @@ -2561,6 +2561,11 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | @@ -2561,6 +2561,11 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector<std::unique_ptr<QPDF>>& page_hea | ||
| 2561 | } | 2561 | } |
| 2562 | } | 2562 | } |
| 2563 | } | 2563 | } |
| 2564 | + for (auto const& p: page_spec_qpdfs) { | ||
| 2565 | + if (!p.second->getWarnings().empty()) { | ||
| 2566 | + m->warnings = true; | ||
| 2567 | + } | ||
| 2568 | + } | ||
| 2564 | } | 2569 | } |
| 2565 | 2570 | ||
| 2566 | void | 2571 | void |
qpdf/qtest/page-errors.test
| @@ -22,7 +22,7 @@ $td->runtest("handle page no with contents", | @@ -22,7 +22,7 @@ $td->runtest("handle page no with contents", | ||
| 22 | $td->NORMALIZE_NEWLINES); | 22 | $td->NORMALIZE_NEWLINES); |
| 23 | $td->runtest("handle page with missing MediaBox", | 23 | $td->runtest("handle page with missing MediaBox", |
| 24 | {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"}, | 24 | {$td->COMMAND => "qpdf --static-id --empty --pages page-no-content.pdf -- out.pdf"}, |
| 25 | - {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 0}, | 25 | + {$td->FILE => "page-missing-mediabox.out", $td->EXIT_STATUS => 3}, |
| 26 | $td->NORMALIZE_NEWLINES); | 26 | $td->NORMALIZE_NEWLINES); |
| 27 | $td->runtest("check output", | 27 | $td->runtest("check output", |
| 28 | {$td->FILE => "out.pdf"}, | 28 | {$td->FILE => "out.pdf"}, |
qpdf/qtest/qpdf/page-missing-mediabox.out
| 1 | WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A | 1 | WARNING: page-no-content.pdf, object 4 0 at offset 288: kid 1 (from 0) MediaBox is undefined; setting to letter / ANSI A |
| 2 | +qpdf: operation succeeded with warnings; resulting file may have some problems |