diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 00:54:44 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 00:54:51 +0200 |
commit | f4206a0938318984f2e7ca8709154598addcfa64 (patch) | |
tree | d613b2c5483f6fe39fbde501e87bf834b1069a27 /qpdf/test_driver.cc | |
parent | 16139d97c83ba48ab31b0f7619bab77d6cdb79e6 (diff) | |
download | qpdf-f4206a0938318984f2e7ca8709154598addcfa64.tar.zst |
Add new Pl_String Pipeline
Diffstat (limited to 'qpdf/test_driver.cc')
-rw-r--r-- | qpdf/test_driver.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index ed603c3b..79744162 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -10,6 +10,7 @@ #include <qpdf/Pl_Discard.hh> #include <qpdf/Pl_Flate.hh> #include <qpdf/Pl_StdioFile.hh> +#include <qpdf/Pl_String.hh> #include <qpdf/QIntC.hh> #include <qpdf/QPDFAcroFormDocumentHelper.hh> #include <qpdf/QPDFEmbeddedFileDocumentHelper.hh> @@ -435,16 +436,13 @@ test_6(QPDF& pdf, char const* arg2) if (!metadata.isStream()) { throw std::logic_error("test 6 run on file with no metadata"); } - Pl_Buffer bufpl("buffer"); + std::string buf; + Pl_String bufpl("buffer", buf); metadata.pipeStreamData(&bufpl, 0, qpdf_dl_none); - Buffer* buf = bufpl.getBuffer(); - unsigned char const* data = buf->getBuffer(); bool cleartext = false; - if ((buf->getSize() > 9) && - (strncmp(reinterpret_cast<char const*>(data), "<?xpacket", 9) == 0)) { + if (buf.substr(0, 9) == "<?xpacket") { cleartext = true; } - delete buf; std::cout << "encrypted=" << (pdf.isEncrypted() ? 1 : 0) << "; cleartext=" << (cleartext ? 1 : 0) << std::endl; } |