Commit 3416c60fe9ec4a6ad5c1e08a757bd63a4699a5a5

Authored by Jay Berkenbilt
1 parent 58b08ca6

save pass1 patch


git-svn-id: svn+q:///qpdf/trunk@931 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing 1 changed file with 48 additions and 6 deletions
1   -2.1
2   -===
3   -
4   - * Remove rc1 from version; search for rc1 in release notes as
5   - well...just change rc1 to 2.1 and update the date.
6   -
7 1 2.2
8 2 ===
9 3  
... ... @@ -21,6 +15,54 @@
21 15 General
22 16 =======
23 17  
  18 + * For debugging linearization bugs, consider adding an option to save
  19 + pass 1 of linearization. This code is sufficient. Change the
  20 + interface to allow specification of a pass1 file, which would
  21 + change the behavior as in this patch.
  22 +
  23 +------------------------------
  24 +Index: QPDFWriter.cc
  25 +===================================================================
  26 +--- QPDFWriter.cc (revision 920)
  27 ++++ QPDFWriter.cc (working copy)
  28 +@@ -1958,11 +1960,15 @@
  29 +
  30 + // Write file in two passes. Part numbers refer to PDF spec 1.4.
  31 +
  32 ++ FILE* XXX = 0;
  33 + for (int pass = 1; pass <= 2; ++pass)
  34 + {
  35 + if (pass == 1)
  36 + {
  37 +- pushDiscardFilter();
  38 ++// pushDiscardFilter();
  39 ++ XXX = fopen("/tmp/pass1.pdf", "w");
  40 ++ pushPipeline(new Pl_StdioFile("pass1", XXX));
  41 ++ activatePipelineStack();
  42 + }
  43 +
  44 + // Part 1: header
  45 +@@ -2037,7 +2043,8 @@
  46 + t_lin_first, first_half_start, first_half_end,
  47 + first_trailer_size,
  48 + hint_length + second_xref_offset,
  49 +- hint_id, hint_offset, hint_length);
  50 ++ hint_id, hint_offset, hint_length,
  51 ++ (pass == 1));
  52 + int endpos = this->pipeline->getCount();
  53 + if (pass == 1)
  54 + {
  55 +@@ -2187,6 +2194,8 @@
  56 +
  57 + // Restore hint offset
  58 + this->xref[hint_id] = QPDFXRefEntry(1, hint_offset, 0);
  59 ++ fclose(XXX);
  60 ++ XXX = 0;
  61 + }
  62 + }
  63 + }
  64 +------------------------------
  65 +
24 66 * Handle embedded files. PDF Reference 1.7 section 3.10, "File
25 67 Specifications", discusses this. Once we can definitely recongize
26 68 all embedded files in a docucment, we can update the encryption
... ...