aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_ASCII85Decoder.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-08 15:18:08 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-08 17:51:15 +0100
commitcb769c62e55599e9f980001830bc61d9fcaa64a9 (patch)
tree0bf980c385a61cbc8720cf990762ffc1200f9d6a /libqpdf/Pl_ASCII85Decoder.cc
parent716381f65a2b2dc72f8da2426ba71aeab02c507f (diff)
downloadqpdf-cb769c62e55599e9f980001830bc61d9fcaa64a9.tar.zst
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.
Diffstat (limited to 'libqpdf/Pl_ASCII85Decoder.cc')
-rw-r--r--libqpdf/Pl_ASCII85Decoder.cc140
1 files changed, 70 insertions, 70 deletions
diff --git a/libqpdf/Pl_ASCII85Decoder.cc b/libqpdf/Pl_ASCII85Decoder.cc
index 21926d95..c8e6d860 100644
--- a/libqpdf/Pl_ASCII85Decoder.cc
+++ b/libqpdf/Pl_ASCII85Decoder.cc
@@ -21,77 +21,77 @@ Pl_ASCII85Decoder::write(unsigned char* buf, size_t len)
{
if (eod > 1)
{
- return;
+ return;
}
for (size_t i = 0; i < len; ++i)
{
- if (eod > 1)
- {
- break;
- }
- else if (eod == 1)
- {
- if (buf[i] == '>')
- {
- flush();
- eod = 2;
- }
- else
- {
- throw std::runtime_error(
- "broken end-of-data sequence in base 85 data");
- }
- }
- else
- {
- switch (buf[i])
- {
- case ' ':
- case '\f':
- case '\v':
- case '\t':
- case '\r':
- case '\n':
- QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
- // ignore whitespace
- break;
+ if (eod > 1)
+ {
+ break;
+ }
+ else if (eod == 1)
+ {
+ if (buf[i] == '>')
+ {
+ flush();
+ eod = 2;
+ }
+ else
+ {
+ throw std::runtime_error(
+ "broken end-of-data sequence in base 85 data");
+ }
+ }
+ else
+ {
+ switch (buf[i])
+ {
+ case ' ':
+ case '\f':
+ case '\v':
+ case '\t':
+ case '\r':
+ case '\n':
+ QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
+ // ignore whitespace
+ break;
- case '~':
- eod = 1;
- break;
+ case '~':
+ eod = 1;
+ break;
- case 'z':
- if (pos != 0)
- {
- throw std::runtime_error(
- "unexpected z during base 85 decode");
- }
- else
- {
- QTC::TC("libtests", "Pl_ASCII85Decoder read z");
+ case 'z':
+ if (pos != 0)
+ {
+ throw std::runtime_error(
+ "unexpected z during base 85 decode");
+ }
+ else
+ {
+ QTC::TC("libtests", "Pl_ASCII85Decoder read z");
unsigned char zeroes[4];
memset(zeroes, '\0', 4);
- getNext()->write(zeroes, 4);
- }
- break;
+ getNext()->write(zeroes, 4);
+ }
+ break;
- default:
- if ((buf[i] < 33) || (buf[i] > 117))
- {
- throw std::runtime_error(
- "character out of range during base 85 decode");
- }
- else
- {
- this->inbuf[this->pos++] = buf[i];
- if (pos == 5)
- {
- flush();
- }
- }
- break;
- }
- }
+ default:
+ if ((buf[i] < 33) || (buf[i] > 117))
+ {
+ throw std::runtime_error(
+ "character out of range during base 85 decode");
+ }
+ else
+ {
+ this->inbuf[this->pos++] = buf[i];
+ if (pos == 5)
+ {
+ flush();
+ }
+ }
+ break;
+ }
+ }
}
}
@@ -100,26 +100,26 @@ Pl_ASCII85Decoder::flush()
{
if (this->pos == 0)
{
- QTC::TC("libtests", "Pl_ASCII85Decoder no-op flush");
- return;
+ QTC::TC("libtests", "Pl_ASCII85Decoder no-op flush");
+ return;
}
unsigned long lval = 0;
for (int i = 0; i < 5; ++i)
{
- lval *= 85;
- lval += (this->inbuf[i] - 33U);
+ lval *= 85;
+ lval += (this->inbuf[i] - 33U);
}
unsigned char outbuf[4];
memset(outbuf, 0, 4);
for (int i = 3; i >= 0; --i)
{
- outbuf[i] = lval & 0xff;
- lval >>= 8;
+ outbuf[i] = lval & 0xff;
+ lval >>= 8;
}
QTC::TC("libtests", "Pl_ASCII85Decoder partial flush",
- (this->pos == 5) ? 0 : 1);
+ (this->pos == 5) ? 0 : 1);
// Reset before calling getNext()->write in case that throws an
// exception.
auto t = this->pos - 1;