Commit 2af08ee3984d2f5f2ea3432572bcb631e3085b7e

Authored by Jay Berkenbilt
1 parent 599daddb

checkpoint -- will have to finish another day

git-svn-id: svn+q:///qpdf/trunk@661 71b93d88-0707-0410-a8cf-f5a4172ac649
ChangeLog
... ... @@ -8,8 +8,8 @@
8 8 structure of file, attempt to decode all stream data.
9 9  
10 10 * libqpdf/QPDFWriter.cc (QPDFWriter::writeObject): In QDF mode,
11   - write a comment to the QDF file that indicates the object ID from
12   - the original file.
  11 + write a comment to the QDF file before each object that indicates
  12 + the object ID of the corresponding object from the original file.
13 13  
14 14 * libqpdf/QPDF.cc (QPDF::pipeStreamData): Issue a warning instead
15 15 of failing if there is a problem found while decoding stream.
... ...
qpdf/qpdf.cc
... ... @@ -455,7 +455,7 @@ int main(int argc, char* argv[])
455 455 // 1 2 3 4 5 6 7 8
456 456 // 12345678901234567890123456789012345678901234567890123456789012345678901234567890
457 457 std::cout
458   - << whoami << " version 2.0.4" << std::endl
  458 + << whoami << " version 2.0.4+" << std::endl
459 459 << "Copyright (c) 2005-2009 Jay Berkenbilt"
460 460 << std::endl
461 461 << "This software may be distributed under the terms of version 2 of the"
... ... @@ -952,6 +952,8 @@ int main(int argc, char* argv[])
952 952 }
953 953 if (! pdf.getWarnings().empty())
954 954 {
  955 + std::cerr << whoami << ": operation succeeded with warnings;"
  956 + << " resulting file may have some problems" << std::endl;
955 957 exit(EXIT_WARNING);
956 958 }
957 959 }
... ...
qpdf/qtest/qpdf.test
... ... @@ -282,8 +282,8 @@ check_pdf(&quot;no recompression&quot;,
282 282 show_ntests();
283 283 # ----------
284 284 $td->notify("--- Object Stream Tests ---");
285   -$n_tests += 36 * 6;
286   -$n_compare_pdfs += 36;
  285 +$n_tests += (36 * 4) + (12 * 2);
  286 +$n_compare_pdfs += 36 + 12;
287 287  
288 288 for (my $n = 16; $n <= 19; ++$n)
289 289 {
... ... @@ -294,13 +294,23 @@ for (my $n = 16; $n &lt;= 19; ++$n)
294 294 {
295 295 foreach my $qdf ('-qdf', '', '-encrypt "" x 128 --')
296 296 {
297   - # 6 tests + 1 compare_pdfs
  297 + # 4 tests + 1 compare_pdfs * 36 cases
  298 + # 2 tests + 1 compare_pdfs * 12 cases
298 299 $td->runtest("object stream mode",
299 300 {$td->COMMAND =>
300 301 "qpdf --static-id $flags $qdf $in a.pdf"},
301 302 {$td->STRING => "",
302 303 $td->EXIT_STATUS => 0});
303 304 compare_pdfs("good$n.pdf", "a.pdf");
  305 + if ($qdf eq '-qdf')
  306 + {
  307 + $td->runtest("fix-qdf identity check",
  308 + {$td->COMMAND => "fix-qdf a.pdf >| b.pdf"},
  309 + {$td->STRING => "", $td->EXIT_STATUS => 0});
  310 + $td->runtest("compare files",
  311 + {$td->FILE => "a.pdf"},
  312 + {$td->FILE => "b.pdf"});
  313 + }
304 314 $td->runtest("convert to qdf",
305 315 {$td->COMMAND =>
306 316 "qpdf --static-id -qdf -decrypt" .
... ... @@ -313,12 +323,15 @@ for (my $n = 16; $n &lt;= 19; ++$n)
313 323 " -object-streams=disable a.pdf b.qdf"},
314 324 {$td->STRING => "",
315 325 $td->EXIT_STATUS => 0});
316   - $td->runtest("compare files",
317   - {$td->FILE => "a.qdf"},
318   - {$td->FILE => "b.qdf"});
319   - $td->runtest("fix-qdf identity check",
320   - {$td->COMMAND => "fix-qdf a.qdf >| b.pdf"},
321   - {$td->STRING => "", $td->EXIT_STATUS => 0});
  326 + # XXX The comparison is broken because of the new original
  327 + # object comments. We need a script that compares qpdfs
  328 + # by normalizing those comments (like replacing the object
  329 + # IDs with nnn) and then diffs. That will work here and
  330 + # in some of the other failure cases. For the rest where
  331 + # we're actually checking the qdf itself, we will need to
  332 + # store the new qdf files with the object IDs. That can't
  333 + # be done blindly -- we need to make sure the output is
  334 + # correct!
322 335 $td->runtest("compare files",
323 336 {$td->FILE => "a.qdf"},
324 337 {$td->FILE => "b.qdf"});
... ...
qpdf/qtest/qpdf/append-page-content-damaged.out
1 1 WARNING: append-page-content-damaged.pdf: offset 0: file is damaged
2 2 WARNING: append-page-content-damaged.pdf: can't find startxref
3 3 WARNING: Attempting to reconstruct cross-reference table
  4 +qpdf: operation succeeded with warnings; resulting file may have some problems
... ...
qpdf/qtest/qpdf/heifer.out
... ... @@ -2,3 +2,4 @@ WARNING: heifer.pdf: offset 0: file is damaged
2 2 WARNING: heifer.pdf: offset 92741: xref not found
3 3 WARNING: Attempting to reconstruct cross-reference table
4 4 WARNING: heifer.pdf: offset 51: attempting to recover stream length
  5 +qpdf: operation succeeded with warnings; resulting file may have some problems
... ...