From cb769c62e55599e9f980001830bc61d9fcaa64a9 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 8 Feb 2022 09:18:08 -0500 Subject: WHITESPACE ONLY -- expand tabs in source code This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon. --- libqpdf/Pl_PNGFilter.cc | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'libqpdf/Pl_PNGFilter.cc') diff --git a/libqpdf/Pl_PNGFilter.cc b/libqpdf/Pl_PNGFilter.cc index b9aa6b2b..1dca43bb 100644 --- a/libqpdf/Pl_PNGFilter.cc +++ b/libqpdf/Pl_PNGFilter.cc @@ -13,7 +13,7 @@ static int abs_diff(int a, int b) } Pl_PNGFilter::Pl_PNGFilter(char const* identifier, Pipeline* next, - action_e action, unsigned int columns, + action_e action, unsigned int columns, unsigned int samples_per_pixel, unsigned int bits_per_sample) : Pipeline(identifier, next), @@ -74,24 +74,24 @@ Pl_PNGFilter::write(unsigned char* data, size_t len) size_t offset = 0; while (len >= left) { - // finish off current row - memcpy(this->cur_row + this->pos, data + offset, left); - offset += left; - len -= left; + // finish off current row + memcpy(this->cur_row + this->pos, data + offset, left); + offset += left; + len -= left; - processRow(); + processRow(); - // Swap rows - unsigned char* t = this->prev_row; - this->prev_row = this->cur_row; - this->cur_row = t ? t : this->buf2.get(); - memset(this->cur_row, 0, this->bytes_per_row + 1); - left = this->incoming; - this->pos = 0; + // Swap rows + unsigned char* t = this->prev_row; + this->prev_row = this->cur_row; + this->cur_row = t ? t : this->buf2.get(); + memset(this->cur_row, 0, this->bytes_per_row + 1); + left = this->incoming; + this->pos = 0; } if (len) { - memcpy(this->cur_row + this->pos, data + offset, len); + memcpy(this->cur_row + this->pos, data + offset, len); } this->pos += len; } @@ -101,11 +101,11 @@ Pl_PNGFilter::processRow() { if (this->action == a_encode) { - encodeRow(); + encodeRow(); } else { - decodeRow(); + decodeRow(); } } @@ -250,16 +250,16 @@ Pl_PNGFilter::encodeRow() getNext()->write(&ch, 1); if (this->prev_row) { - for (unsigned int i = 0; i < this->bytes_per_row; ++i) - { - ch = static_cast( + for (unsigned int i = 0; i < this->bytes_per_row; ++i) + { + ch = static_cast( this->cur_row[i] - this->prev_row[i]); - getNext()->write(&ch, 1); - } + getNext()->write(&ch, 1); + } } else { - getNext()->write(this->cur_row, this->bytes_per_row); + getNext()->write(this->cur_row, this->bytes_per_row); } } @@ -268,8 +268,8 @@ Pl_PNGFilter::finish() { if (this->pos) { - // write partial row - processRow(); + // write partial row + processRow(); } this->prev_row = 0; this->cur_row = buf1.get(); -- cgit v1.2.3-70-g09d2