Format code

This commit is contained in:
Jay Berkenbilt 2024-02-04 16:11:53 -05:00
parent 532cc58d7e
commit 7caa9ddf5a
6 changed files with 12 additions and 10 deletions

View File

@ -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;

View File

@ -3097,9 +3097,8 @@ 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
*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";
}
}

View File

@ -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") &&

View File

@ -1,8 +1,8 @@
#include <qpdf/QPDF_Array.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFObject_private.hh>
#include <qpdf/QTC.hh>
static const QPDFObjectHandle null_oh = QPDFObjectHandle::newNull();