aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf')
-rw-r--r--qpdf/qpdf.cc28
-rw-r--r--qpdf/qtest/qpdf.test17
-rw-r--r--qpdf/qtest/qpdf/badlin1.out4
3 files changed, 13 insertions, 36 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 8f83317b..da37ac25 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -3210,15 +3210,10 @@ static void do_check(QPDF& pdf, Options& o, int& exit_code)
if (pdf.isLinearized())
{
std::cout << "File is linearized\n";
- bool lin_errors = false;
- bool lin_warnings = false;
- // any errors or warnings are reported by checkLinearization()
- pdf.checkLinearization(lin_errors, lin_warnings);
- if (lin_errors)
- {
- okay = false;
- }
- else if (lin_warnings)
+ // any errors or warnings are reported by
+ // checkLinearization(). We treat all issues reported here
+ // as warnings.
+ if (! pdf.checkLinearization())
{
warnings = true;
}
@@ -3796,22 +3791,15 @@ static void do_inspection(QPDF& pdf, Options& o)
}
if (o.check_linearization)
{
- bool lin_errors = false;
- bool lin_warnings = false;
- pdf.checkLinearization(lin_errors, lin_warnings);
- if (lin_errors)
+ if (pdf.checkLinearization())
{
- exit_code = EXIT_ERROR;
+ std::cout << o.infilename << ": no linearization errors"
+ << std::endl;
}
- else if (lin_warnings && (exit_code != EXIT_ERROR))
+ else if (exit_code != EXIT_ERROR)
{
exit_code = EXIT_WARNING;
}
- else
- {
- std::cout << o.infilename << ": no linearization errors"
- << std::endl;
- }
}
if (o.show_linearization)
{
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 0329d35a..a11ccd0b 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -1321,12 +1321,12 @@ $n_tests += 3;
$td->runtest("bounds check linearization data 1",
{$td->COMMAND => "qpdf --check linearization-bounds-1.pdf"},
{$td->FILE => "linearization-bounds-1.out",
- $td->EXIT_STATUS => 2},
+ $td->EXIT_STATUS => 3},
$td->NORMALIZE_NEWLINES);
$td->runtest("bounds check linearization data 2",
{$td->COMMAND => "qpdf --check linearization-bounds-2.pdf"},
{$td->FILE => "linearization-bounds-2.out",
- $td->EXIT_STATUS => 2},
+ $td->EXIT_STATUS => 3},
$td->NORMALIZE_NEWLINES);
# Throws logic error, not bad_alloc
$td->runtest("sanity check array size",
@@ -2855,7 +2855,7 @@ my @to_linearize =
);
$n_tests += @linearized_files + 6;
-$n_tests += (3 * @to_linearize * 5) + 8;
+$n_tests += (3 * @to_linearize * 5) + 6;
foreach my $base (@linearized_files)
{
@@ -2939,17 +2939,6 @@ foreach my $base (@to_linearize)
}
}
-# Verify that we get proper exit codes for files with only warnings
-$td->runtest("linearization warnings check",
- {$td->COMMAND => "qpdf --check lin3.pdf"},
- {$td->FILE => "lin3-check.out", $td->EXIT_STATUS => 3},
- $td->NORMALIZE_NEWLINES);
-$td->runtest("linearization warnings check-linearization",
- {$td->COMMAND => "qpdf --check-linearization lin3.pdf"},
- {$td->FILE => "lin3-check-linearization.out",
- $td->EXIT_STATUS => 3},
- $td->NORMALIZE_NEWLINES);
-
show_ntests();
# ----------
$td->notify("--- Encryption Tests ---");
diff --git a/qpdf/qtest/qpdf/badlin1.out b/qpdf/qtest/qpdf/badlin1.out
index 8ad4bfd5..e61a201f 100644
--- a/qpdf/qtest/qpdf/badlin1.out
+++ b/qpdf/qtest/qpdf/badlin1.out
@@ -1,5 +1,5 @@
-ERROR: first page object (/O) mismatch
-ERROR: space before first xref item (/T) mismatch (computed = 11777; file = 11771
+WARNING: first page object (/O) mismatch
+WARNING: space before first xref item (/T) mismatch (computed = 11777; file = 11771
WARNING: end of first page section (/E) mismatch: /E = 1827; computed = 3889..3891
WARNING: page 0 has shared identifier entries
WARNING: page 0: shared object 62: in hint table but not computed list