From 12f1eb15ca3fed6310402847559a7c99d3c77847 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 2 Apr 2022 17:14:10 -0400 Subject: Programmatically apply new formatting to code Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done --- libqpdf/Pl_ASCIIHexDecoder.cc | 63 ++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 37 deletions(-) (limited to 'libqpdf/Pl_ASCIIHexDecoder.cc') diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index 594d4ed5..654d9449 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -1,9 +1,9 @@ #include #include +#include #include #include -#include Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : Pipeline(identifier, next), @@ -22,53 +22,45 @@ Pl_ASCIIHexDecoder::~Pl_ASCIIHexDecoder() void Pl_ASCIIHexDecoder::write(unsigned char* buf, size_t len) { - if (this->eod) - { + if (this->eod) { return; } - for (size_t i = 0; i < len; ++i) - { + for (size_t i = 0; i < len; ++i) { char ch = static_cast(toupper(buf[i])); - switch (ch) - { - case ' ': - case '\f': - case '\v': - case '\t': - case '\r': - case '\n': + switch (ch) { + case ' ': + case '\f': + case '\v': + case '\t': + case '\r': + case '\n': QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space"); // ignore whitespace break; - case '>': + case '>': this->eod = true; flush(); break; - default: - if (((ch >= '0') && (ch <= '9')) || - ((ch >= 'A') && (ch <= 'F'))) - { + default: + if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F'))) { this->inbuf[this->pos++] = ch; - if (this->pos == 2) - { + if (this->pos == 2) { flush(); } - } - else - { + } 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); + " during base Hex decode: ") + + t); } break; } - if (this->eod) - { + if (this->eod) { break; } } @@ -77,27 +69,24 @@ Pl_ASCIIHexDecoder::write(unsigned char* buf, size_t len) void Pl_ASCIIHexDecoder::flush() { - if (this->pos == 0) - { + if (this->pos == 0) { QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush"); return; } int b[2]; - for (int i = 0; i < 2; ++i) - { - if (this->inbuf[i] >= 'A') - { + for (int i = 0; i < 2; ++i) { + if (this->inbuf[i] >= 'A') { b[i] = this->inbuf[i] - 'A' + 10; - } - else - { + } else { b[i] = this->inbuf[i] - '0'; } } unsigned char ch = static_cast((b[0] << 4) + b[1]); - QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", - (this->pos == 2) ? 0 : 1); + QTC::TC( + "libtests", + "Pl_ASCIIHexDecoder partial flush", + (this->pos == 2) ? 0 : 1); // Reset before calling getNext()->write in case that throws an // exception. this->pos = 0; -- cgit v1.2.3-54-g00ecf