From 7caa9ddf5a8b272c94fa5d4c079f2be8eabff983 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 4 Feb 2024 16:11:53 -0500 Subject: [PATCH] Format code --- libqpdf/QPDF.cc | 6 ++++-- libqpdf/QPDFJob.cc | 7 +++---- libqpdf/QPDFParser.cc | 3 ++- libqpdf/QPDF_Array.cc | 2 +- libqpdf/qpdf/Pl_TIFFPredictor.hh | 2 +- libtests/json.cc | 2 +- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 01158ce2..fdd75359 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -711,8 +711,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset) QPDFObjGen last_og{-1, 0}; for (auto const& item: m->xref_table) { auto id = item.first.getObj(); - if (id == last_og.getObj() && id > 0) + if (id == last_og.getObj() && id > 0) { removeObject(last_og); + } last_og = item.first; } } @@ -2413,9 +2414,10 @@ QPDF::getCompressibleObjGens() if (obj.getObjectID() > 0) { QPDFObjGen og = obj.getObjGen(); const size_t id = toS(og.getObj() - 1); - if (id >= max_obj) + if (id >= max_obj) { throw std::logic_error( "unexpected object id encountered in getCompressibleObjGens"); + } if (visited[id]) { QTC::TC("qpdf", "QPDF loop detected traversing objects"); continue; diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 07abaa49..a699e38d 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -3097,10 +3097,9 @@ QPDFJob::writeOutfile(QPDF& pdf) try { QUtil::remove_file(backup.c_str()); } catch (QPDFSystemError& e) { - *m->log->getError() - << m->message_prefix << ": unable to delete original file (" << e.what() << ");" - << " original file left in " << backup - << ", but the input was successfully replaced\n"; + *m->log->getError() << m->message_prefix << ": unable to delete original file (" + << e.what() << ");" << " original file left in " << backup + << ", but the input was successfully replaced\n"; } } } diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc index 2551cf93..56448364 100644 --- a/libqpdf/QPDFParser.cc +++ b/libqpdf/QPDFParser.cc @@ -253,8 +253,9 @@ QPDFParser::parseRemainder(bool content_stream) dict[frame->key] = QPDF_Null::create(); } - if (!frame->olist.empty()) + if (!frame->olist.empty()) { fixMissingKeys(); + } if (!frame->contents_string.empty() && dict.count("/Type") && dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") && diff --git a/libqpdf/QPDF_Array.cc b/libqpdf/QPDF_Array.cc index 7d6f4539..789acc35 100644 --- a/libqpdf/QPDF_Array.cc +++ b/libqpdf/QPDF_Array.cc @@ -1,8 +1,8 @@ #include -#include #include #include +#include static const QPDFObjectHandle null_oh = QPDFObjectHandle::newNull(); diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh index 276ed54d..3f448f16 100644 --- a/libqpdf/qpdf/Pl_TIFFPredictor.hh +++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh @@ -6,7 +6,7 @@ #include -#include +#include class Pl_TIFFPredictor: public Pipeline { diff --git a/libtests/json.cc b/libtests/json.cc index 67c8534f..e84ef0a0 100644 --- a/libtests/json.cc +++ b/libtests/json.cc @@ -137,7 +137,7 @@ test_main() // Check default constructed JSON object (order as per JSON.hh). JSON uninitialized; std::string ws; - auto pl = Pl_String ("", nullptr, ws); + auto pl = Pl_String("", nullptr, ws); uninitialized.write(&pl); assert(ws == "null"); assert(uninitialized.unparse() == "null");