aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-02 23:43:50 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-03 00:06:05 +0100
commit5fdf37b1bac9cfa1b1f77f47aded7f916fd81fd9 (patch)
tree29e222ca11705cccc7c8d3ac62a81aab183e08b3 /qpdf
parent2046f6536d69b70494c507609fbc75511b8937eb (diff)
downloadqpdf-5fdf37b1bac9cfa1b1f77f47aded7f916fd81fd9.tar.zst
Handle warnings in --pages from other files
Warnings were not being handled per --no-warn or generating exit code 3.
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qpdf.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index ca59cb3a..0405a45d 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -5000,7 +5000,7 @@ static bool should_remove_unreferenced_resources(QPDF& pdf, Options& o)
return false;
}
-static void handle_page_specs(QPDF& pdf, Options& o)
+static void handle_page_specs(QPDF& pdf, Options& o, bool& warnings)
{
// Parse all page specifications and translate them into lists of
// actual pages.
@@ -5261,6 +5261,10 @@ static void handle_page_specs(QPDF& pdf, Options& o)
selected_from_orig.insert(pageno);
}
}
+ if (page_data.qpdf->anyWarnings())
+ {
+ warnings = true;
+ }
if (cis)
{
cis->stayOpen(false);
@@ -5819,9 +5823,10 @@ int realmain(int argc, char* argv[])
return EXIT_IS_NOT_ENCRYPTED;
}
}
+ bool other_warnings = false;
if (! o.page_specs.empty())
{
- handle_page_specs(pdf, o);
+ handle_page_specs(pdf, o, other_warnings);
}
if (! o.rotations.empty())
{
@@ -5829,7 +5834,6 @@ int realmain(int argc, char* argv[])
}
handle_under_overlay(pdf, o);
handle_transformations(pdf, o);
- bool split_warnings = false;
if ((o.outfilename == 0) && (! o.replace_input))
{
@@ -5837,13 +5841,13 @@ int realmain(int argc, char* argv[])
}
else if (o.split_pages)
{
- do_split_pages(pdf, o, split_warnings);
+ do_split_pages(pdf, o, other_warnings);
}
else
{
write_outfile(pdf, o);
}
- if ((! pdf.getWarnings().empty()) || split_warnings)
+ if ((! pdf.getWarnings().empty()) || other_warnings)
{
if (! o.suppress_warnings)
{