From fee7489ee4c90c6dbd11e57ecc8e888c8f038716 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 17 Dec 2021 07:33:42 -0500 Subject: Add Pl_Buffer::getMallocBuffer --- include/qpdf/Pl_Buffer.hh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh index 07bc2372..8c402cd4 100644 --- a/include/qpdf/Pl_Buffer.hh +++ b/include/qpdf/Pl_Buffer.hh @@ -55,6 +55,15 @@ class Pl_Buffer: public Pipeline QPDF_DLL Buffer* getBuffer(); + // getMallocBuffer behaves in the same was as getBuffer except the + // buffer is allocated with malloc(), making it suitable for use + // when calling from other languages. If there is no data, *buf is + // set to a null pointer and *len is set to 0. Otherwise, *buf is + // a buffer of size *len allocated with malloc(). It is the + // caller's responsibility to call free() on the buffer. + QPDF_DLL + void getMallocBuffer(unsigned char **buf, size_t* len); + private: class Members { -- cgit v1.2.3-54-g00ecf