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}; QPDFObjGen last_og{-1, 0};
for (auto const& item: m->xref_table) { for (auto const& item: m->xref_table) {
auto id = item.first.getObj(); auto id = item.first.getObj();
if (id == last_og.getObj() && id > 0) if (id == last_og.getObj() && id > 0) {
removeObject(last_og); removeObject(last_og);
}
last_og = item.first; last_og = item.first;
} }
} }
@ -2413,9 +2414,10 @@ QPDF::getCompressibleObjGens()
if (obj.getObjectID() > 0) { if (obj.getObjectID() > 0) {
QPDFObjGen og = obj.getObjGen(); QPDFObjGen og = obj.getObjGen();
const size_t id = toS(og.getObj() - 1); const size_t id = toS(og.getObj() - 1);
if (id >= max_obj) if (id >= max_obj) {
throw std::logic_error( throw std::logic_error(
"unexpected object id encountered in getCompressibleObjGens"); "unexpected object id encountered in getCompressibleObjGens");
}
if (visited[id]) { if (visited[id]) {
QTC::TC("qpdf", "QPDF loop detected traversing objects"); QTC::TC("qpdf", "QPDF loop detected traversing objects");
continue; continue;

View File

@ -3097,10 +3097,9 @@ QPDFJob::writeOutfile(QPDF& pdf)
try { try {
QUtil::remove_file(backup.c_str()); QUtil::remove_file(backup.c_str());
} catch (QPDFSystemError& e) { } catch (QPDFSystemError& e) {
*m->log->getError() *m->log->getError() << m->message_prefix << ": unable to delete original file ("
<< m->message_prefix << ": unable to delete original file (" << e.what() << ");" << e.what() << ");" << " original file left in " << backup
<< " original file left in " << backup << ", but the input was successfully replaced\n";
<< ", but the input was successfully replaced\n";
} }
} }
} }

View File

@ -253,8 +253,9 @@ QPDFParser::parseRemainder(bool content_stream)
dict[frame->key] = QPDF_Null::create(); dict[frame->key] = QPDF_Null::create();
} }
if (!frame->olist.empty()) if (!frame->olist.empty()) {
fixMissingKeys(); fixMissingKeys();
}
if (!frame->contents_string.empty() && dict.count("/Type") && if (!frame->contents_string.empty() && dict.count("/Type") &&
dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") && dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") &&

View File

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

View File

@ -6,7 +6,7 @@
#include <qpdf/Pipeline.hh> #include <qpdf/Pipeline.hh>
#include<vector> #include <vector>
class Pl_TIFFPredictor: public Pipeline class Pl_TIFFPredictor: public Pipeline
{ {

View File

@ -137,7 +137,7 @@ test_main()
// Check default constructed JSON object (order as per JSON.hh). // Check default constructed JSON object (order as per JSON.hh).
JSON uninitialized; JSON uninitialized;
std::string ws; std::string ws;
auto pl = Pl_String ("", nullptr, ws); auto pl = Pl_String("", nullptr, ws);
uninitialized.write(&pl); uninitialized.write(&pl);
assert(ws == "null"); assert(ws == "null");
assert(uninitialized.unparse() == "null"); assert(uninitialized.unparse() == "null");