Commit 50bc82b4e035853bd06a9935722d6b5aec902133

Authored by m-holger
1 parent 9db2965f

Tidy QPDFJob::doJSONObjects

Showing 1 changed file with 4 additions and 7 deletions
libqpdf/QPDFJob.cc
@@ -1043,7 +1043,7 @@ QPDFJob::doJSONObjects(Pipeline* p, bool& first, QPDF& pdf) @@ -1043,7 +1043,7 @@ QPDFJob::doJSONObjects(Pipeline* p, bool& first, QPDF& pdf)
1043 bool first_object = true; 1043 bool first_object = true;
1044 JSON::writeDictionaryOpen(p, first_object, 1); 1044 JSON::writeDictionaryOpen(p, first_object, 1);
1045 bool all_objects = m->json_objects.empty(); 1045 bool all_objects = m->json_objects.empty();
1046 - std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); 1046 + auto wanted_og = getWantedJSONObjects();
1047 for (auto& obj: pdf.getAllObjects()) { 1047 for (auto& obj: pdf.getAllObjects()) {
1048 std::string key = obj.unparse(); 1048 std::string key = obj.unparse();
1049 if (this->m->json_version > 1) { 1049 if (this->m->json_version > 1) {
@@ -1063,11 +1063,8 @@ QPDFJob::doJSONObjects(Pipeline* p, bool&amp; first, QPDF&amp; pdf) @@ -1063,11 +1063,8 @@ QPDFJob::doJSONObjects(Pipeline* p, bool&amp; first, QPDF&amp; pdf)
1063 if (this->m->json_objects.count("trailer")) { 1063 if (this->m->json_objects.count("trailer")) {
1064 json_objects.insert("trailer"); 1064 json_objects.insert("trailer");
1065 } 1065 }
1066 - auto wanted = getWantedJSONObjects();  
1067 - for (auto const& og: wanted) {  
1068 - std::ostringstream s;  
1069 - s << "obj:" << og.unparse(' ') << " R";  
1070 - json_objects.insert(s.str()); 1066 + for (auto og: getWantedJSONObjects()) {
  1067 + json_objects.emplace("obj:" + og.unparse(' ') + " R");
1071 } 1068 }
1072 pdf.writeJSON( 1069 pdf.writeJSON(
1073 this->m->json_version, 1070 this->m->json_version,
@@ -1088,7 +1085,7 @@ QPDFJob::doJSONObjectinfo(Pipeline* p, bool&amp; first, QPDF&amp; pdf) @@ -1088,7 +1085,7 @@ QPDFJob::doJSONObjectinfo(Pipeline* p, bool&amp; first, QPDF&amp; pdf)
1088 bool first_object = true; 1085 bool first_object = true;
1089 JSON::writeDictionaryOpen(p, first_object, 1); 1086 JSON::writeDictionaryOpen(p, first_object, 1);
1090 bool all_objects = m->json_objects.empty(); 1087 bool all_objects = m->json_objects.empty();
1091 - std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); 1088 + auto wanted_og = getWantedJSONObjects();
1092 for (auto& obj: pdf.getAllObjects()) { 1089 for (auto& obj: pdf.getAllObjects()) {
1093 if (all_objects || wanted_og.count(obj.getObjGen())) { 1090 if (all_objects || wanted_og.count(obj.getObjGen())) {
1094 auto j_details = JSON::makeDictionary(); 1091 auto j_details = JSON::makeDictionary();