aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--include/qpdf/QPDFObjectHandle.hh1
-rw-r--r--qpdf/test_driver.cc29
3 files changed, 26 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 341ae8e4..9efbdc15 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2021-12-10 Jay Berkenbilt <ejb@ql.org>
+ * Add missing QPDF_DLL to QPDFObjectHandle::addTokenFilter so that
+ it is actually accessible as part of the public interface as
+ intended. Fixes #580.
+
* C API: Overhaul how errors are handle the C API's object handle
interfaces. Clarify documentation regarding object accessors and
how type errors and warnings are handled. Many cases that used to
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 31afd01b..ccc3993e 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -456,6 +456,7 @@ class QPDFObjectHandle
// be applied to a page object, and which will automatically
// handle the case of pages whose contents are split across
// multiple streams.
+ QPDF_DLL
void addTokenFilter(PointerHolder<TokenFilter> token_filter);
// Legacy helpers for parsing content streams. These methods are
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index 613dc5bd..d4bfe2af 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -2704,14 +2704,27 @@ void runtest(int n, char const* filename1, char const* arg2)
std::cout << "--- parseContents ---" << std::endl;
ParserCallbacks cb;
fx1.parseContents(&cb);
- Pl_Buffer b("buffer");
- fx1.addContentTokenFilter(new TokenFilter);
- fx1.pipeContents(&b);
- std::unique_ptr<Buffer> buf(b.getBuffer());
- std::string s(
- reinterpret_cast<char const*>(buf->getBuffer()),
- buf->getSize());
- assert(s.find("/bye") != std::string::npos);
+ // Do this once with addContentTokenFilter and once with
+ // addTokenFilter to show that they are the same and to ensure
+ // that addTokenFilter is directly exercised in testing.
+ for (int i = 0; i < 2; i++)
+ {
+ Pl_Buffer b("buffer");
+ if (i == 0)
+ {
+ fx1.addContentTokenFilter(new TokenFilter);
+ }
+ else
+ {
+ fx1.getObjectHandle().addTokenFilter(new TokenFilter);
+ }
+ fx1.pipeContents(&b);
+ std::unique_ptr<Buffer> buf(b.getBuffer());
+ std::string s(
+ reinterpret_cast<char const*>(buf->getBuffer()),
+ buf->getSize());
+ assert(s.find("/bye") != std::string::npos);
+ }
}
else if (n == 73)
{