diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-01-22 19:25:17 +0100 |
---|---|---|
committer | Jay Berkenbilt <jberkenbilt@users.noreply.github.com> | 2023-01-23 13:00:58 +0100 |
commit | d16308b3f5b111a23e0290e14b54fda4455265f0 (patch) | |
tree | deb6775400fee588ea516077c4a82f835aa9c0f1 /libqpdf/QPDFWriter.cc | |
parent | e8cdc4628634c44aa5bae0230050e4336551fe32 (diff) | |
download | qpdf-d16308b3f5b111a23e0290e14b54fda4455265f0.tar.zst |
Tune QPDFWriter::writeString etc methods
Use string_view parameters and call pipeline write methods directly.
Diffstat (limited to 'libqpdf/QPDFWriter.cc')
-rw-r--r-- | libqpdf/QPDFWriter.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 06858eb3..907cc105 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -982,9 +982,10 @@ QPDFWriter::writeBinary(unsigned long long val, unsigned int bytes) } void -QPDFWriter::writeString(std::string const& str) +QPDFWriter::writeString(std::string_view str) { - this->m->pipeline->writeString(str); + m->pipeline->write( + reinterpret_cast<unsigned char const*>(str.data()), str.size()); } void @@ -994,18 +995,20 @@ QPDFWriter::writeBuffer(std::shared_ptr<Buffer>& b) } void -QPDFWriter::writeStringQDF(std::string const& str) +QPDFWriter::writeStringQDF(std::string_view str) { - if (this->m->qdf_mode) { - writeString(str); + if (m->qdf_mode) { + m->pipeline->write( + reinterpret_cast<unsigned char const*>(str.data()), str.size()); } } void -QPDFWriter::writeStringNoQDF(std::string const& str) +QPDFWriter::writeStringNoQDF(std::string_view str) { - if (!this->m->qdf_mode) { - writeString(str); + if (!m->qdf_mode) { + m->pipeline->write( + reinterpret_cast<unsigned char const*>(str.data()), str.size()); } } |