summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-07-07 23:33:45 +0200
committerJay Berkenbilt <ejb@ql.org>2012-07-07 23:33:45 +0200
commite2dedde4bdb5fa68c86d412e534a4b2750739988 (patch)
tree34f2b4ec6897d605067dd2ad39c53441f74c57e7 /include
parent8705e2e8fc1a9721b2438c09ba7e92ec673af19d (diff)
downloadqpdf-e2dedde4bdb5fa68c86d412e534a4b2750739988.tar.zst
Don't require stream data provider to know length in advance
Breaking API change: length parameter has disappeared from the StreamDataProvider version of QPDFObjectHandle::replaceStreamData since it is no longer necessary to compute it in advance. This breaking change is justified by the fact that removing the length parameter provides the caller an opportunity to simplify the calling code.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFObjectHandle.hh31
1 files changed, 22 insertions, 9 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index a61277a9..421b0144 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -294,18 +294,31 @@ class QPDFObjectHandle
// directly providing a buffer with the stream data, call the
// given provider's provideStreamData method. See comments on the
// StreamDataProvider class (defined above) for details on the
- // method. The provider must write the number of bytes as
- // indicated by the length parameter, and the data must be
- // consistent with filter and decode_parms as provided. Although
- // it is more complex to use this form of replaceStreamData than
- // the one that takes a buffer, it makes it possible to avoid
- // allocating memory for the stream data. Example programs are
- // provided that use both forms of replaceStreamData.
+ // method. The data must be consistent with filter and
+ // decode_parms as provided. Although it is more complex to use
+ // this form of replaceStreamData than the one that takes a
+ // buffer, it makes it possible to avoid allocating memory for the
+ // stream data. Example programs are provided that use both forms
+ // of replaceStreamData.
+
+ // Note about stream length: for any given stream, the provider
+ // must provide the same amount of data each time it is called.
+ // This is critical for making linearization work properly.
+ // Versions of qpdf before 3.0.0 required a length to be specified
+ // here. Starting with version 3.0.0, this is no longer necessary
+ // (or permitted). The first time the stream data provider is
+ // invoked for a given stream, the actual length is stored.
+ // Subsequent times, it is enforced that the length be the same as
+ // the first time.
+
+ // If you have gotten a compile error here while building code
+ // that worked with older versions of qpdf, just omit the length
+ // parameter. You can also simplify your code by not having to
+ // compute the length in advance.
QPDF_DLL
void replaceStreamData(PointerHolder<StreamDataProvider> provider,
QPDFObjectHandle const& filter,
- QPDFObjectHandle const& decode_parms,
- size_t length);
+ QPDFObjectHandle const& decode_parms);
// return 0 for direct objects
QPDF_DLL