Commit 7caa9ddf5a8b272c94fa5d4c079f2be8eabff983

Authored by Jay Berkenbilt
1 parent 532cc58d

Format code

libqpdf/QPDF.cc
@@ -711,8 +711,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset) @@ -711,8 +711,9 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
711 QPDFObjGen last_og{-1, 0}; 711 QPDFObjGen last_og{-1, 0};
712 for (auto const& item: m->xref_table) { 712 for (auto const& item: m->xref_table) {
713 auto id = item.first.getObj(); 713 auto id = item.first.getObj();
714 - if (id == last_og.getObj() && id > 0) 714 + if (id == last_og.getObj() && id > 0) {
715 removeObject(last_og); 715 removeObject(last_og);
  716 + }
716 last_og = item.first; 717 last_og = item.first;
717 } 718 }
718 } 719 }
@@ -2413,9 +2414,10 @@ QPDF::getCompressibleObjGens() @@ -2413,9 +2414,10 @@ QPDF::getCompressibleObjGens()
2413 if (obj.getObjectID() > 0) { 2414 if (obj.getObjectID() > 0) {
2414 QPDFObjGen og = obj.getObjGen(); 2415 QPDFObjGen og = obj.getObjGen();
2415 const size_t id = toS(og.getObj() - 1); 2416 const size_t id = toS(og.getObj() - 1);
2416 - if (id >= max_obj) 2417 + if (id >= max_obj) {
2417 throw std::logic_error( 2418 throw std::logic_error(
2418 "unexpected object id encountered in getCompressibleObjGens"); 2419 "unexpected object id encountered in getCompressibleObjGens");
  2420 + }
2419 if (visited[id]) { 2421 if (visited[id]) {
2420 QTC::TC("qpdf", "QPDF loop detected traversing objects"); 2422 QTC::TC("qpdf", "QPDF loop detected traversing objects");
2421 continue; 2423 continue;
libqpdf/QPDFJob.cc
@@ -3097,10 +3097,9 @@ QPDFJob::writeOutfile(QPDF& pdf) @@ -3097,10 +3097,9 @@ QPDFJob::writeOutfile(QPDF& pdf)
3097 try { 3097 try {
3098 QUtil::remove_file(backup.c_str()); 3098 QUtil::remove_file(backup.c_str());
3099 } catch (QPDFSystemError& e) { 3099 } catch (QPDFSystemError& e) {
3100 - *m->log->getError()  
3101 - << m->message_prefix << ": unable to delete original file (" << e.what() << ");"  
3102 - << " original file left in " << backup  
3103 - << ", but the input was successfully replaced\n"; 3100 + *m->log->getError() << m->message_prefix << ": unable to delete original file ("
  3101 + << e.what() << ");" << " original file left in " << backup
  3102 + << ", but the input was successfully replaced\n";
3104 } 3103 }
3105 } 3104 }
3106 } 3105 }
libqpdf/QPDFParser.cc
@@ -253,8 +253,9 @@ QPDFParser::parseRemainder(bool content_stream) @@ -253,8 +253,9 @@ QPDFParser::parseRemainder(bool content_stream)
253 dict[frame->key] = QPDF_Null::create(); 253 dict[frame->key] = QPDF_Null::create();
254 } 254 }
255 255
256 - if (!frame->olist.empty()) 256 + if (!frame->olist.empty()) {
257 fixMissingKeys(); 257 fixMissingKeys();
  258 + }
258 259
259 if (!frame->contents_string.empty() && dict.count("/Type") && 260 if (!frame->contents_string.empty() && dict.count("/Type") &&
260 dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") && 261 dict["/Type"].isNameAndEquals("/Sig") && dict.count("/ByteRange") &&
libqpdf/QPDF_Array.cc
1 #include <qpdf/QPDF_Array.hh> 1 #include <qpdf/QPDF_Array.hh>
2 2
3 -#include <qpdf/QTC.hh>  
4 #include <qpdf/QPDFObjectHandle.hh> 3 #include <qpdf/QPDFObjectHandle.hh>
5 #include <qpdf/QPDFObject_private.hh> 4 #include <qpdf/QPDFObject_private.hh>
  5 +#include <qpdf/QTC.hh>
6 6
7 static const QPDFObjectHandle null_oh = QPDFObjectHandle::newNull(); 7 static const QPDFObjectHandle null_oh = QPDFObjectHandle::newNull();
8 8
libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 #include <qpdf/Pipeline.hh> 7 #include <qpdf/Pipeline.hh>
8 8
9 -#include<vector> 9 +#include <vector>
10 10
11 class Pl_TIFFPredictor: public Pipeline 11 class Pl_TIFFPredictor: public Pipeline
12 { 12 {
libtests/json.cc
@@ -137,7 +137,7 @@ test_main() @@ -137,7 +137,7 @@ test_main()
137 // Check default constructed JSON object (order as per JSON.hh). 137 // Check default constructed JSON object (order as per JSON.hh).
138 JSON uninitialized; 138 JSON uninitialized;
139 std::string ws; 139 std::string ws;
140 - auto pl = Pl_String ("", nullptr, ws); 140 + auto pl = Pl_String("", nullptr, ws);
141 uninitialized.write(&pl); 141 uninitialized.write(&pl);
142 assert(ws == "null"); 142 assert(ws == "null");
143 assert(uninitialized.unparse() == "null"); 143 assert(uninitialized.unparse() == "null");