Commit a3e94eb4623b4e406ba26aac4654df35153047a7
1 parent
fe92a61d
Refactor: replace `isNull` calls with `null`, remove redundant `QTC::TC` calls i…
…n `QPDFAcroFormDocumentHelper`.
Showing
2 changed files
with
5 additions
and
17 deletions
libqpdf/QPDFAcroFormDocumentHelper.cc
| ... | ... | @@ -487,11 +487,7 @@ QPDFAcroFormDocumentHelper::adjustInheritedFields( |
| 487 | 487 | if (field.getObjectHandle().hasKey(key)) { |
| 488 | 488 | return true; |
| 489 | 489 | } |
| 490 | - auto oh = field.getInheritableFieldValue(key); | |
| 491 | - if (!oh.isNull()) { | |
| 492 | - return true; | |
| 493 | - } | |
| 494 | - return false; | |
| 490 | + return !field.getInheritableFieldValue(key).null(); | |
| 495 | 491 | }; |
| 496 | 492 | |
| 497 | 493 | if (override_da || override_q) { |
| ... | ... | @@ -499,19 +495,17 @@ QPDFAcroFormDocumentHelper::adjustInheritedFields( |
| 499 | 495 | if (override_da && (!has_explicit(cur_field, "/DA"))) { |
| 500 | 496 | std::string da = cur_field.getDefaultAppearance(); |
| 501 | 497 | if (da != from_default_da) { |
| 502 | - QTC::TC("qpdf", "QPDFAcroFormDocumentHelper override da"); | |
| 503 | 498 | obj.replaceKey("/DA", QPDFObjectHandle::newUnicodeString(from_default_da)); |
| 504 | 499 | } |
| 505 | 500 | } |
| 506 | 501 | if (override_q && (!has_explicit(cur_field, "/Q"))) { |
| 507 | 502 | int q = cur_field.getQuadding(); |
| 508 | 503 | if (q != from_default_q) { |
| 509 | - QTC::TC("qpdf", "QPDFAcroFormDocumentHelper override q"); | |
| 510 | 504 | obj.replaceKey("/Q", QPDFObjectHandle::newInteger(from_default_q)); |
| 511 | - } | |
| 512 | 505 | } |
| 513 | 506 | } |
| 514 | 507 | } |
| 508 | +} | |
| 515 | 509 | |
| 516 | 510 | namespace |
| 517 | 511 | { |
| ... | ... | @@ -675,17 +669,15 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( |
| 675 | 669 | std::string const& old_key = i2.first; |
| 676 | 670 | std::string const& new_key = i2.second; |
| 677 | 671 | auto existing_new = subdict.getKey(new_key); |
| 678 | - if (!existing_new.isNull()) { | |
| 672 | + if (!existing_new.null()) { | |
| 679 | 673 | // The resource dictionary already has a key in it matching what we remapped an old |
| 680 | 674 | // key to, so we'll have to move it out of the way. Stick it in merge_with, which we |
| 681 | 675 | // will re-merge with the dictionary when we're done. We know merge_with already has |
| 682 | 676 | // dictionaries for all the top keys. |
| 683 | - QTC::TC("qpdf", "QPDFAcroFormDocumentHelper ap conflict"); | |
| 684 | 677 | merge_with.getKey(top_key).replaceKey(new_key, existing_new); |
| 685 | 678 | } |
| 686 | 679 | auto existing_old = subdict.getKey(old_key); |
| 687 | - if (!existing_old.isNull()) { | |
| 688 | - QTC::TC("qpdf", "QPDFAcroFormDocumentHelper ap rename"); | |
| 680 | + if (!existing_old.null()) { | |
| 689 | 681 | subdict.replaceKey(new_key, existing_old); |
| 690 | 682 | subdict.removeKey(old_key); |
| 691 | 683 | } |
| ... | ... | @@ -878,7 +870,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( |
| 878 | 870 | bool have_parent = false; |
| 879 | 871 | if (ffield_oh.isStream()) { |
| 880 | 872 | ffield.warn("ignoring form field that's a stream"); |
| 881 | - } else if ((!ffield_oh.isNull()) && (!ffield_oh.isIndirect())) { | |
| 873 | + } else if (!ffield_oh.null() && !ffield_oh.isIndirect()) { | |
| 882 | 874 | ffield.warn("ignoring form field not indirect"); |
| 883 | 875 | } else if (!ffield.null()) { |
| 884 | 876 | // A field and its associated annotation can be the same object. This matters because we | ... | ... |
qpdf/qpdf.testcov
| ... | ... | @@ -509,11 +509,7 @@ QPDFJob pages keeping field from original 0 |
| 509 | 509 | QPDFObjectHandle merge reuse 0 |
| 510 | 510 | QPDFObjectHandle merge generate 0 |
| 511 | 511 | QPDFFormFieldObjectHelper get font from /DR 0 |
| 512 | -QPDFAcroFormDocumentHelper override da 0 | |
| 513 | -QPDFAcroFormDocumentHelper override q 0 | |
| 514 | 512 | QPDFAcroFormDocumentHelper replaced DA token 0 |
| 515 | -QPDFAcroFormDocumentHelper ap conflict 0 | |
| 516 | -QPDFAcroFormDocumentHelper ap rename 0 | |
| 517 | 513 | QPDFAcroFormDocumentHelper /DA parse error 0 |
| 518 | 514 | QPDFAcroFormDocumentHelper AP parse error 1 |
| 519 | 515 | QPDFJob copy fields not this file 0 | ... | ... |