Commit 7e679ab8b68a38aae8374ef28f999afd94bf5124

Authored by Jay Berkenbilt
1 parent d61612a2

Avoid depending on exact xref stream offsets

For the modified test case, we care about successful recovery, not
about the exact offsets. Add a filter to remove the specific numbers
from show-xref.
qpdf/qtest/qpdf/filter-xref-offsets.pl 0 → 100644
  1 +use warnings;
  2 +use strict;
  3 +
  4 +while (<>)
  5 +{
  6 + s/(uncompressed; offset =) \d+/$1 .../;
  7 + print;
  8 +}
qpdf/qtest/qpdf/xref-with-short-size-new.out
1 -1/0: uncompressed; offset = 15 1 +1/0: uncompressed; offset = ...
2 2/0: compressed; stream = 1, index = 0 2 2/0: compressed; stream = 1, index = 0
3 3/0: compressed; stream = 1, index = 1 3 3/0: compressed; stream = 1, index = 1
4 4/0: compressed; stream = 1, index = 2 4 4/0: compressed; stream = 1, index = 2
@@ -8,6 +8,6 @@ @@ -8,6 +8,6 @@
8 8/0: compressed; stream = 1, index = 6 8 8/0: compressed; stream = 1, index = 6
9 9/0: compressed; stream = 1, index = 7 9 9/0: compressed; stream = 1, index = 7
10 10/0: compressed; stream = 1, index = 8 10 10/0: compressed; stream = 1, index = 8
11 -11/0: uncompressed; offset = 674  
12 -12/0: uncompressed; offset = 801  
13 -13/0: uncompressed; offset = 16194 11 +11/0: uncompressed; offset = ...
  12 +12/0: uncompressed; offset = ...
  13 +13/0: uncompressed; offset = ...
qpdf/qtest/xref-streams.test
@@ -28,7 +28,8 @@ $td-&gt;runtest(&quot;recover xref with short size&quot;, @@ -28,7 +28,8 @@ $td-&gt;runtest(&quot;recover xref with short size&quot;,
28 $td->EXIT_STATUS => 3}, 28 $td->EXIT_STATUS => 3},
29 $td->NORMALIZE_NEWLINES); 29 $td->NORMALIZE_NEWLINES);
30 $td->runtest("show new xref stream", 30 $td->runtest("show new xref stream",
31 - {$td->COMMAND => "qpdf --show-xref a.pdf"}, 31 + {$td->COMMAND => "qpdf --show-xref a.pdf",
  32 + $td->FILTER => "perl filter-xref-offsets.pl"},
32 {$td->FILE => "xref-with-short-size-new.out", 33 {$td->FILE => "xref-with-short-size-new.out",
33 $td->EXIT_STATUS => 0}, 34 $td->EXIT_STATUS => 0},
34 $td->NORMALIZE_NEWLINES); 35 $td->NORMALIZE_NEWLINES);