aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_LZWDecoder.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-05-21 19:35:09 +0200
committerJay Berkenbilt <ejb@ql.org>2023-05-21 19:35:09 +0200
commit60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 (patch)
treea707602da466c02ff1a54b3263c3a881cd7204a4 /libqpdf/Pl_LZWDecoder.cc
parent6b077332d38c093de2618d5e1481b42222106065 (diff)
downloadqpdf-60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2.tar.zst
Rerun clang-format
Diffstat (limited to 'libqpdf/Pl_LZWDecoder.cc')
-rw-r--r--libqpdf/Pl_LZWDecoder.cc18
1 files changed, 6 insertions, 12 deletions
diff --git a/libqpdf/Pl_LZWDecoder.cc b/libqpdf/Pl_LZWDecoder.cc
index aa9257fb..8e5fd9d1 100644
--- a/libqpdf/Pl_LZWDecoder.cc
+++ b/libqpdf/Pl_LZWDecoder.cc
@@ -6,8 +6,7 @@
#include <cstring>
#include <stdexcept>
-Pl_LZWDecoder::Pl_LZWDecoder(
- char const* identifier, Pipeline* next, bool early_code_change) :
+Pl_LZWDecoder::Pl_LZWDecoder(char const* identifier, Pipeline* next, bool early_code_change) :
Pipeline(identifier, next),
code_size(9),
next(0),
@@ -90,15 +89,13 @@ Pl_LZWDecoder::getFirstChar(unsigned int code)
} else if (code > 257) {
unsigned int idx = code - 258;
if (idx >= table.size()) {
- throw std::runtime_error(
- "Pl_LZWDecoder::getFirstChar: table overflow");
+ throw std::runtime_error("Pl_LZWDecoder::getFirstChar: table overflow");
}
Buffer& b = table.at(idx);
result = b.getBuffer()[0];
} else {
throw std::runtime_error(
- "Pl_LZWDecoder::getFirstChar called with invalid code (" +
- std::to_string(code) + ")");
+ "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
}
return result;
}
@@ -117,8 +114,7 @@ Pl_LZWDecoder::addToTable(unsigned char next)
} else if (this->last_code > 257) {
unsigned int idx = this->last_code - 258;
if (idx >= table.size()) {
- throw std::runtime_error(
- "Pl_LZWDecoder::addToTable: table overflow");
+ throw std::runtime_error("Pl_LZWDecoder::addToTable: table overflow");
}
Buffer& b = table.at(idx);
last_data = b.getBuffer();
@@ -182,8 +178,7 @@ Pl_LZWDecoder::handleCode(unsigned int code)
}
addToTable(next);
unsigned int change_idx = new_idx + code_change_delta;
- if ((change_idx == 511) || (change_idx == 1023) ||
- (change_idx == 2047)) {
+ if ((change_idx == 511) || (change_idx == 1023) || (change_idx == 2047)) {
++this->code_size;
}
}
@@ -194,8 +189,7 @@ Pl_LZWDecoder::handleCode(unsigned int code)
} else {
unsigned int idx = code - 258;
if (idx >= table.size()) {
- throw std::runtime_error(
- "Pl_LZWDecoder::handleCode: table overflow");
+ throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
}
Buffer& b = table.at(idx);
getNext()->write(b.getBuffer(), b.getSize());