summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-05-25 15:10:47 +0200
committerm-holger <m-holger@kubitscheck.org>2023-06-17 18:18:31 +0200
commit0f2ef5e85bce0d64683e8071151711f21fa3e052 (patch)
tree5aee7e0f1c37f1acca3f4d4f7a390d5e409b2b81 /include
parentacd0acf16931ce92bc908e4960c5a1e43d53b550 (diff)
downloadqpdf-0f2ef5e85bce0d64683e8071151711f21fa3e052.tar.zst
Add new Buffer method copy and deprecate copy constructor / assignment operator
Also fix accidental Buffer copy in Pl_LZWDecoder::addToTable.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Buffer.hh16
1 files changed, 12 insertions, 4 deletions
diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh
index 719a6bd5..c0669c6c 100644
--- a/include/qpdf/Buffer.hh
+++ b/include/qpdf/Buffer.hh
@@ -41,10 +41,10 @@ class Buffer
QPDF_DLL
Buffer(unsigned char* buf, size_t size);
- QPDF_DLL
- Buffer(Buffer const&);
- QPDF_DLL
- Buffer& operator=(Buffer const&);
+ [[deprecated("Move Buffer or use Buffer::copy instead")]] QPDF_DLL Buffer(Buffer const&);
+ [[deprecated("Move Buffer or use Buffer::copy instead")]] QPDF_DLL Buffer&
+ operator=(Buffer const&);
+
QPDF_DLL
Buffer(Buffer&&) noexcept;
QPDF_DLL
@@ -56,6 +56,14 @@ class Buffer
QPDF_DLL
unsigned char* getBuffer();
+ // Create a new copy of the Buffer. The new Buffer owns an independent copy of the data.
+ QPDF_DLL
+ Buffer copy() const;
+
+ // Only used during CI testing.
+ // ABI: remove when removing copy constructor / assignment operator
+ static void setTestMode() noexcept;
+
private:
class Members
{