aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/OffsetInputSource.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-02 23:14:10 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-04 14:10:40 +0200
commit12f1eb15ca3fed6310402847559a7c99d3c77847 (patch)
tree8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libqpdf/OffsetInputSource.cc
parentf20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff)
downloadqpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst
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
Diffstat (limited to 'libqpdf/OffsetInputSource.cc')
-rw-r--r--libqpdf/OffsetInputSource.cc23
1 files changed, 8 insertions, 15 deletions
diff --git a/libqpdf/OffsetInputSource.cc b/libqpdf/OffsetInputSource.cc
index fabca397..4a828386 100644
--- a/libqpdf/OffsetInputSource.cc
+++ b/libqpdf/OffsetInputSource.cc
@@ -4,13 +4,12 @@
#include <sstream>
#include <stdexcept>
-OffsetInputSource::OffsetInputSource(PointerHolder<InputSource> proxied,
- qpdf_offset_t global_offset) :
+OffsetInputSource::OffsetInputSource(
+ PointerHolder<InputSource> proxied, qpdf_offset_t global_offset) :
proxied(proxied),
global_offset(global_offset)
{
- if (global_offset < 0)
- {
+ if (global_offset < 0) {
throw std::logic_error(
"OffsetInputSource constructed with negative offset");
}
@@ -43,25 +42,19 @@ OffsetInputSource::tell()
void
OffsetInputSource::seek(qpdf_offset_t offset, int whence)
{
- if (whence == SEEK_SET)
- {
- if (offset > this->max_safe_offset)
- {
+ if (whence == SEEK_SET) {
+ if (offset > this->max_safe_offset) {
std::ostringstream msg;
msg.imbue(std::locale::classic());
- msg << "seeking to " << offset
- << " offset by " << global_offset
+ msg << "seeking to " << offset << " offset by " << global_offset
<< " would cause an overflow of the offset type";
throw std::range_error(msg.str());
}
this->proxied->seek(offset + global_offset, whence);
- }
- else
- {
+ } else {
this->proxied->seek(offset, whence);
}
- if (tell() < 0)
- {
+ if (tell() < 0) {
throw std::runtime_error(
"offset input source: seek before beginning of file");
}