aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-07 17:29:12 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-07 23:38:22 +0100
commit3f22bea084d8d64cba1a433726abd709caf8456b (patch)
tree4bf3deb37860d144f36d4b651bb7d1a6b4060876 /libqpdf
parent40f1946df8acb0bb7fefdc3ab31f6285bb11d032 (diff)
downloadqpdf-3f22bea084d8d64cba1a433726abd709caf8456b.tar.zst
Use make_array_pointer_holder
This will be able to be replaced with QUtil::make_shared_array
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/Pl_PNGFilter.cc10
-rw-r--r--libqpdf/Pl_RC4.cc3
-rw-r--r--libqpdf/Pl_TIFFPredictor.cc6
-rw-r--r--libqpdf/QUtil.cc2
4 files changed, 12 insertions, 9 deletions
diff --git a/libqpdf/Pl_PNGFilter.cc b/libqpdf/Pl_PNGFilter.cc
index 5f2ae54d..b9aa6b2b 100644
--- a/libqpdf/Pl_PNGFilter.cc
+++ b/libqpdf/Pl_PNGFilter.cc
@@ -1,6 +1,8 @@
#include <qpdf/Pl_PNGFilter.hh>
#include <qpdf/QTC.hh>
+#include <qpdf/QUtil.hh>
+
#include <stdexcept>
#include <string.h>
#include <limits.h>
@@ -46,10 +48,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next,
"PNGFilter created with invalid columns value");
}
this->bytes_per_row = bpr & UINT_MAX;
- this->buf1 = PointerHolder<unsigned char>(
- true, new unsigned char[this->bytes_per_row + 1]);
- this->buf2 = PointerHolder<unsigned char>(
- true, new unsigned char[this->bytes_per_row + 1]);
+ this->buf1 = make_array_pointer_holder<unsigned char>(
+ this->bytes_per_row + 1);
+ this->buf2 = make_array_pointer_holder<unsigned char>(
+ this->bytes_per_row + 1);
memset(this->buf1.get(), 0, this->bytes_per_row + 1);
memset(this->buf2.get(), 0, this->bytes_per_row + 1);
this->cur_row = this->buf1.get();
diff --git a/libqpdf/Pl_RC4.cc b/libqpdf/Pl_RC4.cc
index 8e3548e5..26d9303f 100644
--- a/libqpdf/Pl_RC4.cc
+++ b/libqpdf/Pl_RC4.cc
@@ -9,8 +9,7 @@ Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next,
out_bufsize(out_bufsize),
rc4(key_data, key_len)
{
- this->outbuf = PointerHolder<unsigned char>(
- true, new unsigned char[out_bufsize]);
+ this->outbuf = make_array_pointer_holder<unsigned char>(out_bufsize);
}
Pl_RC4::~Pl_RC4()
diff --git a/libqpdf/Pl_TIFFPredictor.cc b/libqpdf/Pl_TIFFPredictor.cc
index 3facfec2..5705eca3 100644
--- a/libqpdf/Pl_TIFFPredictor.cc
+++ b/libqpdf/Pl_TIFFPredictor.cc
@@ -3,6 +3,8 @@
#include <qpdf/QTC.hh>
#include <qpdf/BitStream.hh>
#include <qpdf/BitWriter.hh>
+#include <qpdf/QUtil.hh>
+
#include <stdexcept>
#include <vector>
#include <string.h>
@@ -38,8 +40,8 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(char const* identifier, Pipeline* next,
"TIFFPredictor created with invalid columns value");
}
this->bytes_per_row = bpr & UINT_MAX;
- this->cur_row = PointerHolder<unsigned char>(
- true, new unsigned char[this->bytes_per_row]);
+ this->cur_row = make_array_pointer_holder<unsigned char>(
+ this->bytes_per_row);
memset(this->cur_row.get(), 0, this->bytes_per_row);
}
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
index 1f179fd5..3c90bb90 100644
--- a/libqpdf/QUtil.cc
+++ b/libqpdf/QUtil.cc
@@ -1269,7 +1269,7 @@ QUtil::read_file_into_memory(
fseek(f, 0, SEEK_END);
size = QIntC::to_size(QUtil::tell(f));
fseek(f, 0, SEEK_SET);
- file_buf = PointerHolder<char>(true, new char[size]);
+ file_buf = make_array_pointer_holder<char>(size);
char* buf_p = file_buf.get();
size_t bytes_read = 0;
size_t len = 0;