Commit fd13fe74ef9ec7ae4a02ac59e2cd0414958adfb1

Authored by Jay Berkenbilt
1 parent f8e4b616

TODO and comments item for pipeContentStreams

@@ -10,6 +10,23 @@ Candidates for upcoming release @@ -10,6 +10,23 @@ Candidates for upcoming release
10 10
11 * See if we can work in Windows Build/External Libraries (below) 11 * See if we can work in Windows Build/External Libraries (below)
12 12
  13 +* QPDFObjectHandle::pipeContentStreams calls finish() after each
  14 + stream. In some code paths, Pl_Concatenate is used, which suppresses
  15 + that, but in other code paths, it's not used, and the library relies
  16 + on the behavior of finish() being called. Then there's the issue of
  17 + nested Pl_Concatenate pipelines -- calling manualFinish() on the top
  18 + one doesn't call manualFinish() on the lower ones, and there are no
  19 + exposed methods that allow us to apply things down the pipeline
  20 + stack, so it's hard to fix this without changing the API (at least
  21 + making Pipeline::getNext() public, which may be undesirable). To see
  22 + this problem in action, stick a Pl_Concatenate in front of the
  23 + pipeline in pipeContentStreams and observe the test failure. One
  24 + solution might be to add an additional argument indicating whether
  25 + or not to delay calling finish() until the end. See comments on
  26 + QPDFPageObjectHelper::filterPageContents,
  27 + QPDFObjectHandle::filterPageContents, and
  28 + QPDFObjectHandle::pipeContentStreams
  29 +
13 * Remember to check work `qpdf` project for private issues 30 * Remember to check work `qpdf` project for private issues
14 * file with very slow page extraction 31 * file with very slow page extraction
15 * big page even with --remove-unreferenced-resources=yes, even with --empty 32 * big page even with --remove-unreferenced-resources=yes, even with --empty
include/qpdf/QPDFObjectHandle.hh
@@ -393,7 +393,12 @@ class QPDFObjectHandle @@ -393,7 +393,12 @@ class QPDFObjectHandle
393 // messages. The all_description argument is initialized to 393 // messages. The all_description argument is initialized to
394 // something that could be used to describe the result of the 394 // something that could be used to describe the result of the
395 // pipeline. It is the description amended with the identifiers of 395 // pipeline. It is the description amended with the identifiers of
396 - // the underlying objects. 396 + // the underlying objects. Please note that if there is an array
  397 + // of content streams, p->finish() is called after each stream. If
  398 + // you pass a pipeline that doesn't allow write() to be called
  399 + // after finish(), you can wrap it in an instance of
  400 + // Pl_Concatenate and then call manualFinish() on the
  401 + // Pl_Concatenate pipeline at the end.
397 QPDF_DLL 402 QPDF_DLL
398 void pipeContentStreams(Pipeline* p, std::string const& description, 403 void pipeContentStreams(Pipeline* p, std::string const& description,
399 std::string& all_description); 404 std::string& all_description);
@@ -419,6 +424,7 @@ class QPDFObjectHandle @@ -419,6 +424,7 @@ class QPDFObjectHandle
419 void parsePageContents(ParserCallbacks* callbacks); 424 void parsePageContents(ParserCallbacks* callbacks);
420 QPDF_DLL 425 QPDF_DLL
421 void filterPageContents(TokenFilter* filter, Pipeline* next = 0); 426 void filterPageContents(TokenFilter* filter, Pipeline* next = 0);
  427 + // See comments for QPDFPageObjectHelper::pipePageContents.
422 QPDF_DLL 428 QPDF_DLL
423 void pipePageContents(Pipeline* p); 429 void pipePageContents(Pipeline* p);
424 QPDF_DLL 430 QPDF_DLL
include/qpdf/QPDFPageObjectHelper.hh
@@ -145,7 +145,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper @@ -145,7 +145,12 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
145 145
146 // Pipe a page's contents through the given pipeline. This method 146 // Pipe a page's contents through the given pipeline. This method
147 // works whether the contents are a single stream or an array of 147 // works whether the contents are a single stream or an array of
148 - // streams. Call on a page object. 148 + // streams. Call on a page object. Please note that if there is an
  149 + // array of content streams, p->finish() is called after each
  150 + // stream. If you pass a pipeline that doesn't allow write() to be
  151 + // called after finish(), you can wrap it in an instance of
  152 + // Pl_Concatenate and then call manualFinish() on the
  153 + // Pl_Concatenate pipeline at the end.
149 QPDF_DLL 154 QPDF_DLL
150 void pipePageContents(Pipeline* p); 155 void pipePageContents(Pipeline* p);
151 156