Commit aeb66311c27804f6521df8acec83852075513979

Authored by m-holger
1 parent 53f6c0a5

Use QPDFObjGen::set in QPDF::getCompressibleObjGens

Showing 1 changed file with 2 additions and 3 deletions
libqpdf/QPDF.cc
@@ -2511,7 +2511,7 @@ QPDF::getCompressibleObjGens() @@ -2511,7 +2511,7 @@ QPDF::getCompressibleObjGens()
2511 QPDFObjectHandle encryption_dict = this->m->trailer.getKey("/Encrypt"); 2511 QPDFObjectHandle encryption_dict = this->m->trailer.getKey("/Encrypt");
2512 QPDFObjGen encryption_dict_og = encryption_dict.getObjGen(); 2512 QPDFObjGen encryption_dict_og = encryption_dict.getObjGen();
2513 2513
2514 - std::set<QPDFObjGen> visited; 2514 + QPDFObjGen::set visited;
2515 std::list<QPDFObjectHandle> queue; 2515 std::list<QPDFObjectHandle> queue;
2516 queue.push_front(this->m->trailer); 2516 queue.push_front(this->m->trailer);
2517 std::vector<QPDFObjGen> result; 2517 std::vector<QPDFObjGen> result;
@@ -2520,7 +2520,7 @@ QPDF::getCompressibleObjGens() @@ -2520,7 +2520,7 @@ QPDF::getCompressibleObjGens()
2520 queue.pop_front(); 2520 queue.pop_front();
2521 if (obj.isIndirect()) { 2521 if (obj.isIndirect()) {
2522 QPDFObjGen og = obj.getObjGen(); 2522 QPDFObjGen og = obj.getObjGen();
2523 - if (visited.count(og)) { 2523 + if (!visited.add(og)) {
2524 QTC::TC("qpdf", "QPDF loop detected traversing objects"); 2524 QTC::TC("qpdf", "QPDF loop detected traversing objects");
2525 continue; 2525 continue;
2526 } 2526 }
@@ -2532,7 +2532,6 @@ QPDF::getCompressibleObjGens() @@ -2532,7 +2532,6 @@ QPDF::getCompressibleObjGens()
2532 obj.hasKey("/Contents")))) { 2532 obj.hasKey("/Contents")))) {
2533 result.push_back(og); 2533 result.push_back(og);
2534 } 2534 }
2535 - visited.insert(og);  
2536 } 2535 }
2537 if (obj.isStream()) { 2536 if (obj.isStream()) {
2538 QPDFObjectHandle dict = obj.getDict(); 2537 QPDFObjectHandle dict = obj.getDict();