Commit b85a590bc51796f0495be7550da7c4e9975ccaca
1 parent
a41b7899
Tweak Handlers::beginUnderOverlay and beginPages
Showing
1 changed file
with
2 additions
and
14 deletions
libqpdf/QPDFJob_json.cc
| ... | ... | @@ -232,14 +232,8 @@ void |
| 232 | 232 | Handlers::beginUnderOverlay(JSON const& j) |
| 233 | 233 | { |
| 234 | 234 | // File has to be processed before items, so handle it here. |
| 235 | - bool file_seen = false; | |
| 236 | 235 | std::string file; |
| 237 | - j.forEachDictItem([&](std::string const& key, JSON const& value) { | |
| 238 | - if (key == "file") { | |
| 239 | - file_seen = value.getString(file); | |
| 240 | - } | |
| 241 | - }); | |
| 242 | - if (!file_seen) { | |
| 236 | + if (!j.getDictItem("file").getString(file)) { | |
| 243 | 237 | QTC::TC("qpdf", "QPDFJob json over/under no file"); |
| 244 | 238 | usage("file is required in underlay/overlay specification"); |
| 245 | 239 | } |
| ... | ... | @@ -488,14 +482,8 @@ Handlers::endPagesArray() |
| 488 | 482 | void |
| 489 | 483 | Handlers::beginPages(JSON j) |
| 490 | 484 | { |
| 491 | - bool file_seen = false; | |
| 492 | 485 | std::string file; |
| 493 | - j.forEachDictItem([&](std::string const& key, JSON const& value) { | |
| 494 | - if (key == "file") { | |
| 495 | - file_seen = value.getString(file); | |
| 496 | - } | |
| 497 | - }); | |
| 498 | - if (!file_seen) { | |
| 486 | + if (!j.getDictItem("file").getString(file)) { | |
| 499 | 487 | QTC::TC("qpdf", "QPDFJob json pages no file"); |
| 500 | 488 | usage("file is required in page specification"); |
| 501 | 489 | } | ... | ... |