aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorTobias Hoffmann <thobi@worker>2012-06-27 06:00:58 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-27 16:19:57 +0200
commit43c404b45ab54583a33492adc93f54fa349c2f94 (patch)
treeda195c74239078c5a52b3f7be4c2477d6eea9f0b /libqpdf
parent75054c0b9404572f2c1477858fe47a61404b72f5 (diff)
downloadqpdf-43c404b45ab54583a33492adc93f54fa349c2f94.tar.zst
Add QPDFObjectHandle::newStream(QPDF *, std::string const&)
This makes the code simpler than having to create a buffer of a fixed size and copy the string to it.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFObjectHandle.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index b1f7df2c..139ca02b 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -681,6 +681,15 @@ QPDFObjectHandle::newStream(QPDF* qpdf, PointerHolder<Buffer> data)
}
QPDFObjectHandle
+QPDFObjectHandle::newStream(QPDF* qpdf, std::string const& data)
+{
+ PointerHolder<Buffer> b = new Buffer(data.length());
+ unsigned char* bp = b->getBuffer();
+ memcpy(bp, (char*)data.c_str(), data.length());
+ return QPDFObjectHandle::newStream(qpdf, b);
+}
+
+QPDFObjectHandle
QPDFObjectHandle::shallowCopy()
{
assertInitialized();