diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-02-08 15:18:08 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-02-08 17:51:15 +0100 |
commit | cb769c62e55599e9f980001830bc61d9fcaa64a9 (patch) | |
tree | 0bf980c385a61cbc8720cf990762ffc1200f9d6a /libqpdf/Pl_ASCIIHexDecoder.cc | |
parent | 716381f65a2b2dc72f8da2426ba71aeab02c507f (diff) | |
download | qpdf-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_ASCIIHexDecoder.cc')
-rw-r--r-- | libqpdf/Pl_ASCIIHexDecoder.cc | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 6fe4d959..594d4ed5 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -24,53 +24,53 @@ Pl_ASCIIHexDecoder::write(unsigned char* buf, size_t len) { if (this->eod) { - return; + return; } for (size_t i = 0; i < len; ++i) { - char ch = static_cast<char>(toupper(buf[i])); - switch (ch) - { - case ' ': - case '\f': - case '\v': - case '\t': - case '\r': - case '\n': - QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space"); - // ignore whitespace - break; + char ch = static_cast<char>(toupper(buf[i])); + switch (ch) + { + case ' ': + case '\f': + case '\v': + case '\t': + case '\r': + case '\n': + QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space"); + // ignore whitespace + break; - case '>': - this->eod = true; - flush(); - break; + case '>': + this->eod = true; + flush(); + break; - default: - if (((ch >= '0') && (ch <= '9')) || - ((ch >= 'A') && (ch <= 'F'))) - { - this->inbuf[this->pos++] = ch; - if (this->pos == 2) - { - flush(); - } - } - else - { - char t[2]; - t[0] = ch; - t[1] = 0; - throw std::runtime_error( - std::string("character out of range" - " during base Hex decode: ") + t); - } - break; - } - if (this->eod) - { - break; - } + default: + if (((ch >= '0') && (ch <= '9')) || + ((ch >= 'A') && (ch <= 'F'))) + { + this->inbuf[this->pos++] = ch; + if (this->pos == 2) + { + flush(); + } + } + else + { + char t[2]; + t[0] = ch; + t[1] = 0; + throw std::runtime_error( + std::string("character out of range" + " during base Hex decode: ") + t); + } + break; + } + if (this->eod) + { + break; + } } } @@ -79,25 +79,25 @@ Pl_ASCIIHexDecoder::flush() { if (this->pos == 0) { - QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush"); - return; + QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush"); + return; } int b[2]; for (int i = 0; i < 2; ++i) { - if (this->inbuf[i] >= 'A') - { - b[i] = this->inbuf[i] - 'A' + 10; - } - else - { - b[i] = this->inbuf[i] - '0'; - } + if (this->inbuf[i] >= 'A') + { + b[i] = this->inbuf[i] - 'A' + 10; + } + else + { + b[i] = this->inbuf[i] - '0'; + } } unsigned char ch = static_cast<unsigned char>((b[0] << 4) + b[1]); QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", - (this->pos == 2) ? 0 : 1); + (this->pos == 2) ? 0 : 1); // Reset before calling getNext()->write in case that throws an // exception. this->pos = 0; |