diff options
author | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-12-16 17:31:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-16 17:31:11 +0100 |
commit | b0b6d9f21fe77fb7b46469529bf252f0dbcaa551 (patch) | |
tree | 612562863dbf4364e41e2086b701b92761c18e72 /libqpdf/QPDFPageObjectHelper.cc | |
parent | d7a364b882be44c93dc4a843bcca2ae63e805c2c (diff) | |
parent | 368666899fe24885fbe05ea03688fa985645ebd9 (diff) | |
download | qpdf-b0b6d9f21fe77fb7b46469529bf252f0dbcaa551.tar.zst |
Merge pull request #1067 from m-holger/pl_buff
Reduce copying of Buffer contents
Diffstat (limited to 'libqpdf/QPDFPageObjectHelper.cc')
-rw-r--r-- | libqpdf/QPDFPageObjectHelper.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index fd6e5215..54bb5cac 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -175,14 +175,11 @@ InlineImageTracker::handleToken(QPDFTokenizer::Token const& token) size_t len = image_data.length(); if (len >= this->min_size) { QTC::TC("qpdf", "QPDFPageObjectHelper externalize inline image"); - Pl_Buffer b("image_data"); - b.writeString(image_data); - b.finish(); QPDFObjectHandle dict = convertIIDict(QPDFObjectHandle::parse(dict_str)); dict.replaceKey("/Length", QPDFObjectHandle::newInteger(QIntC::to_longlong(len))); std::string name = resources.getUniqueResourceName("/IIm", this->min_suffix); QPDFObjectHandle image = - QPDFObjectHandle::newStream(this->qpdf, b.getBufferSharedPointer()); + QPDFObjectHandle::newStream(this->qpdf, std::make_shared<Buffer>(std::move(image_data))); image.replaceDict(dict); resources.getKey("/XObject").replaceKey(name, image); write(name); |