Commit b85a590bc51796f0495be7550da7c4e9975ccaca

Authored by m-holger
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,14 +232,8 @@ void
232 Handlers::beginUnderOverlay(JSON const& j) 232 Handlers::beginUnderOverlay(JSON const& j)
233 { 233 {
234 // File has to be processed before items, so handle it here. 234 // File has to be processed before items, so handle it here.
235 - bool file_seen = false;  
236 std::string file; 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 QTC::TC("qpdf", "QPDFJob json over/under no file"); 237 QTC::TC("qpdf", "QPDFJob json over/under no file");
244 usage("file is required in underlay/overlay specification"); 238 usage("file is required in underlay/overlay specification");
245 } 239 }
@@ -488,14 +482,8 @@ Handlers::endPagesArray() @@ -488,14 +482,8 @@ Handlers::endPagesArray()
488 void 482 void
489 Handlers::beginPages(JSON j) 483 Handlers::beginPages(JSON j)
490 { 484 {
491 - bool file_seen = false;  
492 std::string file; 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 QTC::TC("qpdf", "QPDFJob json pages no file"); 487 QTC::TC("qpdf", "QPDFJob json pages no file");
500 usage("file is required in page specification"); 488 usage("file is required in page specification");
501 } 489 }