Commit 3f22bea084d8d64cba1a433726abd709caf8456b
1 parent
40f1946d
Use make_array_pointer_holder
This will be able to be replaced with QUtil::make_shared_array
Showing
4 changed files
with
12 additions
and
9 deletions
libqpdf/Pl_PNGFilter.cc
| 1 | 1 | #include <qpdf/Pl_PNGFilter.hh> |
| 2 | 2 | |
| 3 | 3 | #include <qpdf/QTC.hh> |
| 4 | +#include <qpdf/QUtil.hh> | |
| 5 | + | |
| 4 | 6 | #include <stdexcept> |
| 5 | 7 | #include <string.h> |
| 6 | 8 | #include <limits.h> |
| ... | ... | @@ -46,10 +48,10 @@ Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next, |
| 46 | 48 | "PNGFilter created with invalid columns value"); |
| 47 | 49 | } |
| 48 | 50 | this->bytes_per_row = bpr & UINT_MAX; |
| 49 | - this->buf1 = PointerHolder<unsigned char>( | |
| 50 | - true, new unsigned char[this->bytes_per_row + 1]); | |
| 51 | - this->buf2 = PointerHolder<unsigned char>( | |
| 52 | - true, new unsigned char[this->bytes_per_row + 1]); | |
| 51 | + this->buf1 = make_array_pointer_holder<unsigned char>( | |
| 52 | + this->bytes_per_row + 1); | |
| 53 | + this->buf2 = make_array_pointer_holder<unsigned char>( | |
| 54 | + this->bytes_per_row + 1); | |
| 53 | 55 | memset(this->buf1.get(), 0, this->bytes_per_row + 1); |
| 54 | 56 | memset(this->buf2.get(), 0, this->bytes_per_row + 1); |
| 55 | 57 | this->cur_row = this->buf1.get(); | ... | ... |
libqpdf/Pl_RC4.cc
| ... | ... | @@ -9,8 +9,7 @@ Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next, |
| 9 | 9 | out_bufsize(out_bufsize), |
| 10 | 10 | rc4(key_data, key_len) |
| 11 | 11 | { |
| 12 | - this->outbuf = PointerHolder<unsigned char>( | |
| 13 | - true, new unsigned char[out_bufsize]); | |
| 12 | + this->outbuf = make_array_pointer_holder<unsigned char>(out_bufsize); | |
| 14 | 13 | } |
| 15 | 14 | |
| 16 | 15 | Pl_RC4::~Pl_RC4() | ... | ... |
libqpdf/Pl_TIFFPredictor.cc
| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | #include <qpdf/QTC.hh> |
| 4 | 4 | #include <qpdf/BitStream.hh> |
| 5 | 5 | #include <qpdf/BitWriter.hh> |
| 6 | +#include <qpdf/QUtil.hh> | |
| 7 | + | |
| 6 | 8 | #include <stdexcept> |
| 7 | 9 | #include <vector> |
| 8 | 10 | #include <string.h> |
| ... | ... | @@ -38,8 +40,8 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(char const* identifier, Pipeline* next, |
| 38 | 40 | "TIFFPredictor created with invalid columns value"); |
| 39 | 41 | } |
| 40 | 42 | this->bytes_per_row = bpr & UINT_MAX; |
| 41 | - this->cur_row = PointerHolder<unsigned char>( | |
| 42 | - true, new unsigned char[this->bytes_per_row]); | |
| 43 | + this->cur_row = make_array_pointer_holder<unsigned char>( | |
| 44 | + this->bytes_per_row); | |
| 43 | 45 | memset(this->cur_row.get(), 0, this->bytes_per_row); |
| 44 | 46 | } |
| 45 | 47 | ... | ... |
libqpdf/QUtil.cc
| ... | ... | @@ -1269,7 +1269,7 @@ QUtil::read_file_into_memory( |
| 1269 | 1269 | fseek(f, 0, SEEK_END); |
| 1270 | 1270 | size = QIntC::to_size(QUtil::tell(f)); |
| 1271 | 1271 | fseek(f, 0, SEEK_SET); |
| 1272 | - file_buf = PointerHolder<char>(true, new char[size]); | |
| 1272 | + file_buf = make_array_pointer_holder<char>(size); | |
| 1273 | 1273 | char* buf_p = file_buf.get(); |
| 1274 | 1274 | size_t bytes_read = 0; |
| 1275 | 1275 | size_t len = 0; | ... | ... |