Commit d11622b6fd8a2d050414c3e6110f3ad68f7502af

Authored by m-holger
1 parent 81823f40

Change Pl_Buffer to use std::string for storage

include/qpdf/Pl_Buffer.hh
... ... @@ -33,7 +33,7 @@
33 33 #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785)
34 34  
35 35 #include <memory>
36   -#include <vector>
  36 +#include <string>
37 37  
38 38 class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
39 39 {
... ... @@ -78,7 +78,7 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
78 78 Members(Members const&) = delete;
79 79  
80 80 bool ready{true};
81   - std::vector<unsigned char> data;
  81 + std::string data;
82 82 };
83 83  
84 84 std::shared_ptr<Members> m;
... ...
libqpdf/Pl_Buffer.cc
... ... @@ -19,7 +19,7 @@ Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default)
19 19 void
20 20 Pl_Buffer::write(unsigned char const* buf, size_t len)
21 21 {
22   - m->data.insert(m->data.end(), buf, buf + len);
  22 + m->data.append(reinterpret_cast<char const*>(buf), len);
23 23 m->ready = false;
24 24  
25 25 if (getNext(true)) {
... ...