aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libqpdf/Pl_TIFFPredictor.cc13
-rw-r--r--libqpdf/qpdf/Pl_TIFFPredictor.hh4
2 files changed, 9 insertions, 8 deletions
diff --git a/libqpdf/Pl_TIFFPredictor.cc b/libqpdf/Pl_TIFFPredictor.cc
index 51594d11..c8e0b5ba 100644
--- a/libqpdf/Pl_TIFFPredictor.cc
+++ b/libqpdf/Pl_TIFFPredictor.cc
@@ -35,8 +35,7 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(
throw std::runtime_error("TIFFPredictor created with invalid columns value");
}
this->bytes_per_row = bpr & UINT_MAX;
- this->cur_row = QUtil::make_shared_array<unsigned char>(this->bytes_per_row);
- memset(this->cur_row.get(), 0, this->bytes_per_row);
+ this->cur_row.assign(this->bytes_per_row, 0);
}
void
@@ -46,19 +45,19 @@ Pl_TIFFPredictor::write(unsigned char const* data, size_t len)
size_t offset = 0;
while (len >= left) {
// finish off current row
- memcpy(this->cur_row.get() + this->pos, data + offset, left);
+ memcpy(this->cur_row.data() + this->pos, data + offset, left);
offset += left;
len -= left;
processRow();
// Prepare for next row
- memset(this->cur_row.get(), 0, this->bytes_per_row);
+ this->cur_row.assign(this->bytes_per_row, 0);
left = this->bytes_per_row;
this->pos = 0;
}
if (len) {
- memcpy(this->cur_row.get() + this->pos, data + offset, len);
+ memcpy(this->cur_row.data() + this->pos, data + offset, len);
}
this->pos += len;
}
@@ -68,7 +67,7 @@ Pl_TIFFPredictor::processRow()
{
QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
BitWriter bw(this->getNext());
- BitStream in(this->cur_row.get(), this->bytes_per_row);
+ BitStream in(this->cur_row.data(), this->bytes_per_row);
std::vector<long long> prev;
for (unsigned int i = 0; i < this->samples_per_pixel; ++i) {
long long sample = in.getBitsSigned(this->bits_per_sample);
@@ -100,6 +99,6 @@ Pl_TIFFPredictor::finish()
processRow();
}
this->pos = 0;
- memset(this->cur_row.get(), 0, this->bytes_per_row);
+ this->cur_row.assign(this->bytes_per_row, 0);
getNext()->finish();
}
diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh
index 21757593..7e35350d 100644
--- a/libqpdf/qpdf/Pl_TIFFPredictor.hh
+++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -6,6 +6,8 @@
#include <qpdf/Pipeline.hh>
+#include<vector>
+
class Pl_TIFFPredictor: public Pipeline
{
public:
@@ -31,7 +33,7 @@ class Pl_TIFFPredictor: public Pipeline
unsigned int bytes_per_row;
unsigned int samples_per_pixel;
unsigned int bits_per_sample;
- std::shared_ptr<unsigned char> cur_row;
+ std::vector<unsigned char> cur_row;
size_t pos;
};