mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-31 02:48:31 +00:00
Simplify address arithmetic in Pl_TIFFPredictor
This commit is contained in:
parent
5b7a44e1cc
commit
73dec35209
@ -37,23 +37,21 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(
|
||||
void
|
||||
Pl_TIFFPredictor::write(unsigned char const* data, size_t len)
|
||||
{
|
||||
size_t left = this->bytes_per_row - cur_row.size();
|
||||
size_t offset = 0;
|
||||
while (len >= left) {
|
||||
auto end = data + len;
|
||||
auto row_end = data + (bytes_per_row - cur_row.size());
|
||||
while (row_end <= end) {
|
||||
// finish off current row
|
||||
cur_row.insert(cur_row.end(), data + offset, data + offset + left);
|
||||
offset += left;
|
||||
len -= left;
|
||||
cur_row.insert(cur_row.end(), data, row_end);
|
||||
data = row_end;
|
||||
row_end += bytes_per_row;
|
||||
|
||||
processRow();
|
||||
|
||||
// Prepare for next row
|
||||
this->cur_row.clear();
|
||||
left = this->bytes_per_row;
|
||||
}
|
||||
if (len) {
|
||||
cur_row.insert(cur_row.end(), data + offset, data + offset + len);
|
||||
cur_row.clear();
|
||||
}
|
||||
|
||||
cur_row.insert(cur_row.end(), data, end);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user