Commit 50bc82b4e035853bd06a9935722d6b5aec902133
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 | 1043 | bool first_object = true; |
| 1044 | 1044 | JSON::writeDictionaryOpen(p, first_object, 1); |
| 1045 | 1045 | bool all_objects = m->json_objects.empty(); |
| 1046 | - std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); | |
| 1046 | + auto wanted_og = getWantedJSONObjects(); | |
| 1047 | 1047 | for (auto& obj: pdf.getAllObjects()) { |
| 1048 | 1048 | std::string key = obj.unparse(); |
| 1049 | 1049 | if (this->m->json_version > 1) { |
| ... | ... | @@ -1063,11 +1063,8 @@ QPDFJob::doJSONObjects(Pipeline* p, bool& first, QPDF& pdf) |
| 1063 | 1063 | if (this->m->json_objects.count("trailer")) { |
| 1064 | 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 | 1069 | pdf.writeJSON( |
| 1073 | 1070 | this->m->json_version, |
| ... | ... | @@ -1088,7 +1085,7 @@ QPDFJob::doJSONObjectinfo(Pipeline* p, bool& first, QPDF& pdf) |
| 1088 | 1085 | bool first_object = true; |
| 1089 | 1086 | JSON::writeDictionaryOpen(p, first_object, 1); |
| 1090 | 1087 | bool all_objects = m->json_objects.empty(); |
| 1091 | - std::set<QPDFObjGen> wanted_og = getWantedJSONObjects(); | |
| 1088 | + auto wanted_og = getWantedJSONObjects(); | |
| 1092 | 1089 | for (auto& obj: pdf.getAllObjects()) { |
| 1093 | 1090 | if (all_objects || wanted_og.count(obj.getObjGen())) { |
| 1094 | 1091 | auto j_details = JSON::makeDictionary(); | ... | ... |