2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-11-15 17:17:08 +00:00

Merge pull request #1025 from zclifford/main

Remove use of non-standard `char_traits<unsigned char>` from Pl_Buffer
This commit is contained in:
Jay Berkenbilt 2023-08-26 11:20:10 -04:00 committed by GitHub
commit fc656816c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -33,6 +33,7 @@
#include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
#include <memory>
#include <vector>
class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
{
@ -77,7 +78,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
Members(Members const&) = delete;
bool ready{true};
std::basic_string<unsigned char> data;
std::vector<unsigned char> data;
};
std::shared_ptr<Members> m;

View File

@ -19,7 +19,7 @@ Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default)
void
Pl_Buffer::write(unsigned char const* buf, size_t len)
{
m->data.append(buf, len);
m->data.insert(m->data.end(), buf, buf + len);
m->ready = false;
if (getNext(true)) {
@ -43,7 +43,7 @@ Pl_Buffer::getBuffer()
throw std::logic_error("Pl_Buffer::getBuffer() called when not ready");
}
auto size = m->data.length();
auto size = m->data.size();
auto* b = new Buffer(size);
if (size > 0) {
unsigned char* p = b->getBuffer();
@ -65,7 +65,7 @@ Pl_Buffer::getMallocBuffer(unsigned char** buf, size_t* len)
if (!m->ready) {
throw std::logic_error("Pl_Buffer::getMallocBuffer() called when not ready");
}
auto size = m->data.length();
auto size = m->data.size();
*len = size;
if (size > 0) {
*buf = reinterpret_cast<unsigned char*>(malloc(size));