Commit 778a9721f03e0dcb45eb1e69d39cb2d78db7b482

Authored by m-holger
Committed by GitHub
2 parents baa2f2b4 77cf2387

Merge pull request #1534 from m-holger/null

Replace calls to `isNull`with calls to `null`
libqpdf/QPDF.cc
... ... @@ -578,49 +578,41 @@ QPDF::reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top)
578 578 }
579 579  
580 580 if (foreign.isPagesObject()) {
581   - QTC::TC("qpdf", "QPDF not copying pages object");
582 581 return;
583 582 }
584 583  
585 584 if (foreign.isIndirect()) {
586 585 QPDFObjGen foreign_og(foreign.getObjGen());
587 586 if (!obj_copier.visiting.add(foreign_og)) {
588   - QTC::TC("qpdf", "QPDF loop reserving objects");
589 587 return;
590 588 }
591 589 if (obj_copier.object_map.contains(foreign_og)) {
592   - QTC::TC("qpdf", "QPDF already reserved object");
593   - if (!(top && foreign.isPageObject() && obj_copier.object_map[foreign_og].isNull())) {
  590 + if (!(top && foreign.isPageObject() && obj_copier.object_map[foreign_og].null())) {
594 591 obj_copier.visiting.erase(foreign);
595 592 return;
596 593 }
597 594 } else {
598   - QTC::TC("qpdf", "QPDF copy indirect");
599 595 obj_copier.object_map[foreign_og] =
600 596 foreign.isStream() ? newStream() : newIndirectNull();
601   - if ((!top) && foreign.isPageObject()) {
602   - QTC::TC("qpdf", "QPDF not crossing page boundary");
  597 + if (!top && foreign.isPageObject()) {
603 598 obj_copier.visiting.erase(foreign_og);
604 599 return;
605 600 }
606 601 }
607   - obj_copier.to_copy.push_back(foreign);
  602 + obj_copier.to_copy.emplace_back(foreign);
608 603 }
609 604  
610 605 if (foreign_tc == ::ot_array) {
611   - QTC::TC("qpdf", "QPDF reserve array");
612 606 for (auto const& item: foreign.as_array()) {
613 607 reserveObjects(item, obj_copier, false);
614 608 }
615 609 } else if (foreign_tc == ::ot_dictionary) {
616   - QTC::TC("qpdf", "QPDF reserve dictionary");
617 610 for (auto const& item: foreign.as_dictionary()) {
618 611 if (!item.second.null()) {
619 612 reserveObjects(item.second, obj_copier, false);
620 613 }
621 614 }
622 615 } else if (foreign_tc == ::ot_stream) {
623   - QTC::TC("qpdf", "QPDF reserve stream");
624 616 reserveObjects(foreign.getDict(), obj_copier, false);
625 617 }
626 618  
... ...
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,14 +495,12 @@ 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 505 }
512 506 }
... ... @@ -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
... ...
libqpdf/QPDFFormFieldObjectHelper.cc
... ... @@ -25,7 +25,7 @@ QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper() :
25 25 bool
26 26 QPDFFormFieldObjectHelper::isNull()
27 27 {
28   - return oh().isNull();
  28 + return oh().null();
29 29 }
30 30  
31 31 QPDFFormFieldObjectHelper
... ... @@ -39,7 +39,7 @@ QPDFFormFieldObjectHelper::getTopLevelField(bool* is_different)
39 39 {
40 40 auto top_field = oh();
41 41 QPDFObjGen::set seen;
42   - while (seen.add(top_field) && !top_field.getKeyIfDict("/Parent").isNull()) {
  42 + while (seen.add(top_field) && !top_field.getKeyIfDict("/Parent").null()) {
43 43 top_field = top_field.getKey("/Parent");
44 44 if (is_different) {
45 45 *is_different = true;
... ... @@ -72,13 +72,12 @@ QPDFFormFieldObjectHelper::getInheritableFieldValue(std::string const& name)
72 72 return QPDFObjectHandle::newNull();
73 73 }
74 74 QPDFObjectHandle result(node.getKey(name));
75   - if (result.isNull()) {
  75 + if (result.null()) {
76 76 QPDFObjGen::set seen;
77 77 while (seen.add(node) && node.hasKey("/Parent")) {
78 78 node = node.getKey("/Parent");
79 79 result = node.getKey(name);
80   - if (!result.isNull()) {
81   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper non-trivial inheritance");
  80 + if (!result.null()) {
82 81 return result;
83 82 }
84 83 }
... ... @@ -118,10 +117,9 @@ QPDFFormFieldObjectHelper::getFullyQualifiedName()
118 117 std::string result;
119 118 QPDFObjectHandle node = oh();
120 119 QPDFObjGen::set seen;
121   - while (!node.isNull() && seen.add(node)) {
  120 + while (!node.null() && seen.add(node)) {
122 121 if (node.getKey("/T").isString()) {
123 122 if (!result.empty()) {
124   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper non-trivial qualified name");
125 123 result = "." + result;
126 124 }
127 125 result = node.getKey("/T").getUTF8Value() + result;
... ... @@ -360,18 +358,17 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name)
360 358 // is a member, set /AS to /Off.
361 359 // Note that we never turn on /NeedAppearances when setting a radio button field.
362 360 QPDFObjectHandle parent = oh().getKey("/Parent");
363   - if (parent.isDictionary() && parent.getKey("/Parent").isNull()) {
  361 + if (parent.isDictionary() && parent.getKey("/Parent").null()) {
364 362 QPDFFormFieldObjectHelper ph(parent);
365 363 if (ph.isRadioButton()) {
366 364 // This is most likely one of the individual buttons. Try calling on the parent.
367   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper set parent radio button");
368 365 ph.setRadioButtonValue(name);
369 366 return;
370 367 }
371 368 }
372 369  
373 370 QPDFObjectHandle kids = oh().getKey("/Kids");
374   - if (!(isRadioButton() && parent.isNull() && kids.isArray())) {
  371 + if (!(isRadioButton() && parent.null() && kids.isArray())) {
375 372 warn("don't know how to set the value of this field as a radio button");
376 373 return;
377 374 }
... ... @@ -384,7 +381,6 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name)
384 381 for (auto const& grandkid: kid.getKey("/Kids").as_array()) {
385 382 AP = grandkid.getKey("/AP");
386 383 if (!AP.null()) {
387   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper radio button grandkid");
388 384 annot = grandkid;
389 385 break;
390 386 }
... ... @@ -393,16 +389,13 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name)
393 389 annot = kid;
394 390 }
395 391 if (!annot) {
396   - QTC::TC("qpdf", "QPDFObjectHandle broken radio button");
397 392 warn("unable to set the value of this radio button");
398 393 continue;
399 394 }
400 395 if (AP.isDictionary() && AP.getKey("/N").isDictionary() &&
401 396 AP.getKey("/N").hasKey(name.getName())) {
402   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper turn on radio button");
403 397 annot.replaceKey("/AS", name);
404 398 } else {
405   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper turn off radio button");
406 399 annot.replaceKey("/AS", QPDFObjectHandle::newName("/Off"));
407 400 }
408 401 }
... ... @@ -749,7 +742,7 @@ void
749 742 QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& aoh)
750 743 {
751 744 QPDFObjectHandle AS = aoh.getAppearanceStream("/N");
752   - if (AS.isNull()) {
  745 + if (AS.null()) {
753 746 QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AS from scratch");
754 747 QPDFObjectHandle::Rectangle rect = aoh.getRect();
755 748 QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
... ... @@ -759,8 +752,7 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao
759 752 AS = QPDFObjectHandle::newStream(oh().getOwningQPDF(), "/Tx BMC\nEMC\n");
760 753 AS.replaceDict(dict);
761 754 QPDFObjectHandle AP = aoh.getAppearanceDictionary();
762   - if (AP.isNull()) {
763   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AP from scratch");
  755 + if (AP.null()) {
764 756 aoh.getObjectHandle().replaceKey("/AP", QPDFObjectHandle::newDictionary());
765 757 AP = aoh.getAppearanceDictionary();
766 758 }
... ... @@ -808,7 +800,6 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao
808 800 found_font_in_dr = font.isDictionary();
809 801 }
810 802 if (found_font_in_dr && resources.isDictionary()) {
811   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper get font from /DR");
812 803 if (resources.isIndirect()) {
813 804 resources = resources.getQPDF().makeIndirectObject(resources.shallowCopy());
814 805 AS.getDict().replaceKey("/Resources", resources);
... ... @@ -821,7 +812,6 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao
821 812 if (font.isDictionary() && font.getKey("/Encoding").isName()) {
822 813 std::string encoding = font.getKey("/Encoding").getName();
823 814 if (encoding == "/WinAnsiEncoding") {
824   - QTC::TC("qpdf", "QPDFFormFieldObjectHelper WinAnsi");
825 815 encoder = &QUtil::utf8_to_win_ansi;
826 816 } else if (encoding == "/MacRomanEncoding") {
827 817 encoder = &QUtil::utf8_to_mac_roman;
... ...
libqpdf/QPDFJob.cc
... ... @@ -464,7 +464,7 @@ QPDFJob::createQPDF()
464 464 if (m->remove_info) {
465 465 auto trailer = pdf.getTrailer();
466 466 auto mod_date = trailer.getKey("/Info").getKeyIfDict("/ModDate");
467   - if (mod_date.isNull()) {
  467 + if (mod_date.null()) {
468 468 trailer.removeKey("/Info");
469 469 } else {
470 470 auto info = trailer.replaceKeyAndGetNew(
... ... @@ -2064,7 +2064,7 @@ static void
2064 2064 maybe_set_pagemode(QPDF& pdf, std::string const& pagemode)
2065 2065 {
2066 2066 auto root = pdf.getRoot();
2067   - if (root.getKey("/PageMode").isNull()) {
  2067 + if (root.getKey("/PageMode").null()) {
2068 2068 root.replaceKey("/PageMode", QPDFObjectHandle::newName(pagemode));
2069 2069 }
2070 2070 }
... ...
libqpdf/QPDFOutlineDocumentHelper.cc
1 1 #include <qpdf/QPDFOutlineDocumentHelper.hh>
2 2  
  3 +#include <qpdf/QPDFObjectHandle_private.hh>
3 4 #include <qpdf/QTC.hh>
4 5  
5 6 class QPDFOutlineDocumentHelper::Members
... ... @@ -36,7 +37,7 @@ QPDFOutlineDocumentHelper::QPDFOutlineDocumentHelper(QPDF&amp; qpdf) :
36 37 }
37 38 QPDFObjectHandle cur = outlines.getKey("/First");
38 39 QPDFObjGen::set seen;
39   - while (!cur.isNull() && seen.add(cur)) {
  40 + while (!cur.null() && seen.add(cur)) {
40 41 m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
41 42 cur = cur.getKey("/Next");
42 43 }
... ...
libqpdf/QPDFOutlineObjectHelper.cc
1 1 #include <qpdf/QPDFOutlineObjectHelper.hh>
2 2  
  3 +#include <qpdf/QPDFObjectHandle_private.hh>
3 4 #include <qpdf/QPDFOutlineDocumentHelper.hh>
4 5 #include <qpdf/QTC.hh>
5 6  
... ... @@ -19,13 +20,12 @@ QPDFOutlineObjectHelper::QPDFOutlineObjectHelper(
19 20 return;
20 21 }
21 22 if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
22   - QTC::TC("qpdf", "QPDFOutlineObjectHelper loop");
23 23 return;
24 24 }
25 25  
26 26 QPDFObjGen::set children;
27 27 QPDFObjectHandle cur = a_oh.getKey("/First");
28   - while (!cur.isNull() && cur.isIndirect() && children.add(cur)) {
  28 + while (!cur.null() && cur.isIndirect() && children.add(cur)) {
29 29 QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
30 30 new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
31 31 m->kids.push_back(new_ooh);
... ...
libqpdf/QPDFPageDocumentHelper.cc
1 1 #include <qpdf/QPDFPageDocumentHelper.hh>
2 2  
3 3 #include <qpdf/QPDFAcroFormDocumentHelper.hh>
  4 +#include <qpdf/QPDFObjectHandle_private.hh>
4 5 #include <qpdf/QPDF_private.hh>
5 6 #include <qpdf/QTC.hh>
6 7 #include <qpdf/QUtil.hh>
... ... @@ -127,7 +128,7 @@ QPDFPageDocumentHelper::flattenAnnotationsForPage(
127 128 ++next_fx;
128 129 }
129 130 new_content += content;
130   - } else if (process && !aoh.getAppearanceDictionary().isNull()) {
  131 + } else if (process && !aoh.getAppearanceDictionary().null()) {
131 132 // If an annotation has no selected appearance stream, just drop the annotation when
132 133 // flattening. This can happen for unchecked checkboxes and radio buttons, popup windows
133 134 // associated with comments that aren't visible, and other types of annotations that
... ...
libqpdf/QPDFPageLabelDocumentHelper.cc
1 1 #include <qpdf/QPDFPageLabelDocumentHelper.hh>
2 2  
3   -#include <qpdf/QTC.hh>
  3 +#include <qpdf/QPDFObjectHandle_private.hh>
4 4  
5 5 class QPDFPageLabelDocumentHelper::Members
6 6 {
... ... @@ -72,7 +72,7 @@ QPDFPageLabelDocumentHelper::getLabelsForPageRange(
72 72 // prior entry. If there is no entry for the first page, fabricate one that would match how the
73 73 // page would look in a new file in which it also didn't have an explicit label.
74 74 QPDFObjectHandle label = getLabelForPage(start_idx);
75   - if (label.isNull()) {
  75 + if (label.null()) {
76 76 label = QPDFObjectHandle::newDictionary();
77 77 label.replaceKey("/St", QPDFObjectHandle::newInteger(1 + new_start_idx));
78 78 }
... ...
libqpdf/QPDFPageObjectHelper.cc
... ... @@ -238,15 +238,14 @@ QPDFPageObjectHelper::getAttribute(
238 238 auto dict = is_form_xobject ? oh().getDict() : oh();
239 239 auto result = dict.getKey(name);
240 240  
241   - if (!is_form_xobject && result.isNull() &&
  241 + if (!is_form_xobject && result.null() &&
242 242 (name == "/MediaBox" || name == "/CropBox" || name == "/Resources" || name == "/Rotate")) {
243 243 QPDFObjectHandle node = dict;
244 244 QPDFObjGen::set seen{};
245 245 while (seen.add(node) && node.hasKey("/Parent")) {
246 246 node = node.getKey("/Parent");
247 247 result = node.getKey(name);
248   - if (!result.isNull()) {
249   - QTC::TC("qpdf", "QPDFPageObjectHelper non-trivial inheritance");
  248 + if (!result.null()) {
250 249 inherited = true;
251 250 break;
252 251 }
... ... @@ -256,10 +255,9 @@ QPDFPageObjectHelper::getAttribute(
256 255 QTC::TC("qpdf", "QPDFPageObjectHelper copy shared attribute", is_form_xobject ? 0 : 1);
257 256 result = dict.replaceKeyAndGetNew(name, result.shallowCopy());
258 257 }
259   - if (result.isNull() && get_fallback) {
  258 + if (result.null() && get_fallback) {
260 259 result = get_fallback();
261   - if (copy_if_fallback && !result.isNull()) {
262   - QTC::TC("qpdf", "QPDFPageObjectHelper copied fallback");
  260 + if (copy_if_fallback && !result.null()) {
263 261 result = dict.replaceKeyAndGetNew(name, result.shallowCopy());
264 262 } else {
265 263 QTC::TC("qpdf", "QPDFPageObjectHelper used fallback without copying");
... ... @@ -670,7 +668,7 @@ QPDFPageObjectHelper::getMatrixForTransformations(bool invert)
670 668 }
671 669 QPDFObjectHandle rotate_obj = getAttribute("/Rotate", false);
672 670 QPDFObjectHandle scale_obj = getAttribute("/UserUnit", false);
673   - if (!(rotate_obj.isNull() && scale_obj.isNull())) {
  671 + if (!(rotate_obj.null() && scale_obj.null())) {
674 672 QPDFObjectHandle::Rectangle rect = bbox.getArrayAsRectangle();
675 673 double width = rect.urx - rect.llx;
676 674 double height = rect.ury - rect.lly;
... ... @@ -724,7 +722,7 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations)
724 722 result.replaceStreamData(provider, QPDFObjectHandle::newNull(), QPDFObjectHandle::newNull());
725 723 QPDFObjectHandle rotate_obj = getAttribute("/Rotate", false);
726 724 QPDFObjectHandle scale_obj = getAttribute("/UserUnit", false);
727   - if (handle_transformations && (!(rotate_obj.isNull() && scale_obj.isNull()))) {
  725 + if (handle_transformations && !(rotate_obj.null() && scale_obj.null())) {
728 726 newdict.replaceKey("/Matrix", QPDFObjectHandle::newArray(getMatrixForTransformations()));
729 727 }
730 728  
... ... @@ -963,8 +961,7 @@ QPDFPageObjectHelper::flattenRotation(QPDFAcroFormDocumentHelper* afdh)
963 961 oh().addPageContents(qpdf.newStream("\nQ\n"), false);
964 962 oh().removeKey("/Rotate");
965 963 QPDFObjectHandle rotate_obj = getAttribute("/Rotate", false);
966   - if (!rotate_obj.isNull()) {
967   - QTC::TC("qpdf", "QPDFPageObjectHelper flatten inherit rotate");
  964 + if (!rotate_obj.null()) {
968 965 oh().replaceKey("/Rotate", QPDFObjectHandle::newInteger(0));
969 966 }
970 967  
... ...
libqpdf/QPDFStreamFilter.cc
1 1 #include <qpdf/QPDFStreamFilter.hh>
2 2  
  3 +#include <qpdf/QPDFObjectHandle_private.hh>
  4 +
3 5 bool
4 6 QPDFStreamFilter::setDecodeParms(QPDFObjectHandle decode_parms)
5 7 {
6   - return decode_parms.isNull();
  8 + return decode_parms.null();
7 9 }
8 10  
9 11 bool
... ...
libqpdf/QPDFWriter.cc
... ... @@ -1782,12 +1782,11 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
1782 1782 write(" /Filter /FlateDecode");
1783 1783 }
1784 1784 write(" /N ").write(offsets.size()).write_qdf("\n ").write(" /First ").write(first);
1785   - if (!object.isNull()) {
  1785 + if (!object.null()) {
1786 1786 // If the original object has an /Extends key, preserve it.
1787 1787 QPDFObjectHandle dict = object.getDict();
1788 1788 QPDFObjectHandle extends = dict.getKey("/Extends");
1789 1789 if (extends.isIndirect()) {
1790   - QTC::TC("qpdf", "QPDFWriter copy Extends");
1791 1790 write_qdf("\n ").write(" /Extends ");
1792 1791 unparseChild(extends, 1, f_in_ostream);
1793 1792 }
... ...
libqpdf/QPDF_Dictionary.cc
... ... @@ -40,7 +40,7 @@ BaseDictionary::getKeys()
40 40 {
41 41 std::set<std::string> result;
42 42 for (auto& iter: dict()->items) {
43   - if (!iter.second.isNull()) {
  43 + if (!iter.second.null()) {
44 44 result.insert(iter.first);
45 45 }
46 46 }
... ...
libqpdf/QPDF_Stream.cc
... ... @@ -376,7 +376,7 @@ Stream::filterable(
376 376  
377 377 auto filter_obj = s->stream_dict.getKey("/Filter");
378 378  
379   - if (filter_obj.isNull()) {
  379 + if (filter_obj.null()) {
380 380 // No filters
381 381 return true;
382 382 }
... ...
libqpdf/QPDF_encryption.cc
... ... @@ -681,7 +681,7 @@ QPDF::EncryptionParameters::initialize(QPDF&amp; qpdf)
681 681 (encryption_dict.getKey("/Filter").getName() == "/Standard"))) {
682 682 throw unsupported("unsupported encryption filter");
683 683 }
684   - if (!encryption_dict.getKey("/SubFilter").isNull()) {
  684 + if (!encryption_dict.getKey("/SubFilter").null()) {
685 685 qpdf.warn(unsupported("file uses encryption SubFilters, which qpdf does not support"));
686 686 }
687 687  
... ...
libqpdf/QPDF_linearization.cc
... ... @@ -167,7 +167,7 @@ QPDF::readLinearizationData()
167 167 QPDFObjectHandle P = m->lindict.getKey("/P");
168 168  
169 169 if (!(H.isArray() && O.isInteger() && E.isInteger() && N.isInteger() && T.isInteger() &&
170   - (P.isInteger() || P.isNull()))) {
  170 + (P.isInteger() || P.null()))) {
171 171 throw damagedPDF(
172 172 "linearization dictionary",
173 173 "some keys in linearization dictionary are of the wrong type");
... ... @@ -577,7 +577,7 @@ QPDF::getUncompressedObject(QPDFObjectHandle&amp; oh, QPDFWriter::ObjTable const&amp; ob
577 577 {
578 578 if (obj.contains(oh)) {
579 579 if (auto id = obj[oh].object_stream; id > 0) {
580   - return oh.isNull() ? oh : getObject(id, 0);
  580 + return oh.null() ? oh : getObject(id, 0);
581 581 }
582 582 }
583 583 return oh;
... ... @@ -1284,7 +1284,7 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1284 1284 thumb = getUncompressedObject(thumb, object_stream_data);
1285 1285 QPDFObjGen thumb_og(thumb.getObjGen());
1286 1286 // Output the thumbnail itself
1287   - if (lc_thumbnail_private.erase(thumb_og) && !thumb.isNull()) {
  1287 + if (lc_thumbnail_private.erase(thumb_og) && !thumb.null()) {
1288 1288 m->part9.emplace_back(thumb);
1289 1289 } else {
1290 1290 // No internal error this time...there's nothing to stop this object from having
... ... @@ -1394,7 +1394,7 @@ QPDF::pushOutlinesToPart(
1394 1394 {
1395 1395 QPDFObjectHandle root = getRoot();
1396 1396 QPDFObjectHandle outlines = root.getKey("/Outlines");
1397   - if (outlines.isNull()) {
  1397 + if (outlines.null()) {
1398 1398 return;
1399 1399 }
1400 1400 outlines = getUncompressedObject(outlines, object_stream_data);
... ...
libqpdf/QPDF_objects.cc
... ... @@ -910,8 +910,7 @@ QPDF::processXRefIndex(
910 910 }
911 911 QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
912 912 return {num_entries, indx};
913   - } else if (Index_obj.isNull()) {
914   - QTC::TC("qpdf", "QPDF xref /Index is null");
  913 + } else if (Index_obj.null()) {
915 914 return {size, {{0, size}}};
916 915 } else {
917 916 throw damaged("Cross-reference stream does not have a proper /Index key");
... ... @@ -1256,11 +1255,9 @@ QPDF::readStream(QPDFObjectHandle&amp; object, QPDFObjGen og, qpdf_offset_t offset)
1256 1255 auto length_obj = object.getKey("/Length");
1257 1256  
1258 1257 if (!length_obj.isInteger()) {
1259   - if (length_obj.isNull()) {
1260   - QTC::TC("qpdf", "QPDF stream without length");
  1258 + if (length_obj.null()) {
1261 1259 throw damagedPDF(offset, "stream dictionary lacks /Length key");
1262 1260 }
1263   - QTC::TC("qpdf", "QPDF stream length not integer");
1264 1261 throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
1265 1262 }
1266 1263  
... ... @@ -1269,7 +1266,6 @@ QPDF::readStream(QPDFObjectHandle&amp; object, QPDFObjGen og, qpdf_offset_t offset)
1269 1266 m->file->seek(stream_offset, SEEK_SET);
1270 1267 m->file->seek(toO(length), SEEK_CUR);
1271 1268 if (!readToken(*m->file).isWord("endstream")) {
1272   - QTC::TC("qpdf", "QPDF missing endstream");
1273 1269 throw damagedPDF("expected endstream");
1274 1270 }
1275 1271 } catch (QPDFExc& e) {
... ...
libqpdf/SF_FlateLzwDecode.cc
... ... @@ -5,12 +5,13 @@
5 5 #include <qpdf/Pl_PNGFilter.hh>
6 6 #include <qpdf/Pl_TIFFPredictor.hh>
7 7 #include <qpdf/QIntC.hh>
  8 +#include <qpdf/QPDFObjectHandle_private.hh>
8 9 #include <qpdf/QTC.hh>
9 10  
10 11 bool
11 12 SF_FlateLzwDecode::setDecodeParms(QPDFObjectHandle decode_parms)
12 13 {
13   - if (decode_parms.isNull()) {
  14 + if (decode_parms.null()) {
14 15 return true;
15 16 }
16 17  
... ...
qpdf/qpdf.testcov
... ... @@ -64,9 +64,6 @@ QPDFParser bad brace 0
64 64 QPDFParser bad brace in parseRemainder 0
65 65 QPDFParser bad array close 0
66 66 QPDFParser bad array close in parseRemainder 0
67   -QPDF stream without length 0
68   -QPDF stream length not integer 0
69   -QPDF missing endstream 0
70 67 QPDFParser bad dictionary close 0
71 68 QPDFParser bad dictionary close in parseRemainder 0
72 69 QPDF can't find xref 0
... ... @@ -87,9 +84,7 @@ QPDF found xref stream 0
87 84 QPDF ignoring XRefStm in trailer 0
88 85 QPDF xref deleted object 0
89 86 SF_FlateLzwDecode PNG filter 0
90   -QPDF xref /Index is null 0
91 87 QPDF xref /Index is array 1
92   -QPDFWriter copy Extends 0
93 88 QPDFWriter encrypt object stream 0
94 89 QPDFWriter uncompressing page dictionary 0
95 90 QPDFWriter uncompressing root 0
... ... @@ -204,18 +199,11 @@ QPDF_Stream unknown stream length 0
204 199 QPDF replaceReserved 0
205 200 QPDF copyForeign direct 0
206 201 QPDF copyForeign not foreign 0
207   -QPDF copy indirect 0
208   -QPDF loop reserving objects 0
209 202 QPDF replace indirect 0
210 203 QPDF replace array 0
211 204 QPDF replace dictionary 0
212 205 QPDF replace stream 0
213   -QPDF reserve array 0
214   -QPDF reserve dictionary 0
215   -QPDF reserve stream 0
216   -QPDF not crossing page boundary 0
217 206 QPDF replace foreign indirect with null 0
218   -QPDF not copying pages object 0
219 207 QPDF insert foreign page 0
220 208 QPDFWriter foreign object 0
221 209 QPDFWriter copy use_aes 1
... ... @@ -249,7 +237,6 @@ QPDF_optimization indirect outlines 0
249 237 QPDF xref space 2
250 238 QPDFJob pages range omitted in middle 0
251 239 QPDFJob npages 0
252   -QPDF already reserved object 0
253 240 QPDFWriter standard deterministic ID 1
254 241 QPDFWriter linearized deterministic ID 1
255 242 qpdf-c called qpdf_set_deterministic_ID 0
... ... @@ -312,8 +299,6 @@ QPDFObjectHandle erase array bounds 0
312 299 qpdf-c called qpdf_check_pdf 0
313 300 QPDF xref loop 0
314 301 QPDFParser too deep 0
315   -QPDFFormFieldObjectHelper non-trivial inheritance 0
316   -QPDFFormFieldObjectHelper non-trivial qualified name 0
317 302 QPDFFormFieldObjectHelper TU present 0
318 303 QPDFFormFieldObjectHelper TM present 0
319 304 QPDFFormFieldObjectHelper TU absent 0
... ... @@ -340,7 +325,6 @@ QPDFOutlineObjectHelper direct dest 0
340 325 QPDFOutlineObjectHelper action dest 0
341 326 QPDFOutlineObjectHelper named dest 0
342 327 QPDFOutlineDocumentHelper string named dest 0
343   -QPDFOutlineObjectHelper loop 0
344 328 QPDFObjectHandle merge top type mismatch 0
345 329 QPDFObjectHandle merge shallow copy 0
346 330 QPDFObjectHandle merge array 0
... ... @@ -361,12 +345,7 @@ QPDFObjectHandle replace with copy 0
361 345 QPDFPageDocumentHelper indirect as resources 0
362 346 QPDFAnnotationObjectHelper forbidden flags 0
363 347 QPDFAnnotationObjectHelper missing required flags 0
364   -QPDFFormFieldObjectHelper set parent radio button 0
365   -QPDFFormFieldObjectHelper radio button grandkid 0
366   -QPDFFormFieldObjectHelper turn on radio button 0
367   -QPDFFormFieldObjectHelper turn off radio button 0
368 348 QPDFFormFieldObjectHelper checkbox kid widget 0
369   -QPDFObjectHandle broken radio button 0
370 349 QPDFFormFieldObjectHelper set checkbox AS 0
371 350 QPDFObjectHandle broken checkbox 0
372 351 QPDFFormFieldObjectHelper list not found 0
... ... @@ -376,7 +355,6 @@ QPDFFormFieldObjectHelper list last too high 0
376 355 QPDFJob image optimize no pipeline 0
377 356 QPDFJob image optimize no shrink 0
378 357 QPDFJob image optimize too small 0
379   -QPDFFormFieldObjectHelper WinAnsi 0
380 358 QPDF pipe foreign encrypted stream 0
381 359 QPDF copy foreign stream with provider 0
382 360 QPDF copy foreign stream with buffer 0
... ... @@ -393,10 +371,8 @@ QPDFJob invalid utf-8 in auto 0
393 371 QPDFJob input password hex-bytes 0
394 372 QPDFPageDocumentHelper ignore annotation with no appearance 0
395 373 QPDFFormFieldObjectHelper create AS from scratch 0
396   -QPDFFormFieldObjectHelper create AP from scratch 0
397 374 QPDFFormFieldObjectHelper replaced BMC at EOF 0
398 375 QPDFFormFieldObjectHelper fallback Tf 0
399   -QPDFPageObjectHelper non-trivial inheritance 0
400 376 QPDFPageObjectHelper copy shared attribute 1
401 377 QPDFJob from_nr from repeat_nr 0
402 378 QPDF resolve duplicated page object 0
... ... @@ -513,19 +489,13 @@ QPDFPageObjectHelper unresolved names 0
513 489 QPDFPageObjectHelper resolving unresolved 0
514 490 QPDFFileSpecObjectHelper empty compat_name 0
515 491 QPDFFileSpecObjectHelper non-empty compat_name 0
516   -QPDFPageObjectHelper flatten inherit rotate 0
517 492 QPDFAcroFormDocumentHelper copy annotation 3
518 493 QPDFAcroFormDocumentHelper field with parent 3
519 494 QPDFAcroFormDocumentHelper modify ap matrix 0
520 495 QPDFJob pages keeping field from original 0
521 496 QPDFObjectHandle merge reuse 0
522 497 QPDFObjectHandle merge generate 0
523   -QPDFFormFieldObjectHelper get font from /DR 0
524   -QPDFAcroFormDocumentHelper override da 0
525   -QPDFAcroFormDocumentHelper override q 0
526 498 QPDFAcroFormDocumentHelper replaced DA token 0
527   -QPDFAcroFormDocumentHelper ap conflict 0
528   -QPDFAcroFormDocumentHelper ap rename 0
529 499 QPDFAcroFormDocumentHelper /DA parse error 0
530 500 QPDFAcroFormDocumentHelper AP parse error 1
531 501 QPDFJob copy fields not this file 0
... ... @@ -614,7 +584,6 @@ QPDF_json missing json version 0
614 584 QPDF_json bad json version 0
615 585 QPDF_json bad calledgetallpages 0
616 586 QPDF_json bad pushedinheritedpageresources 0
617   -QPDFPageObjectHelper copied fallback 0
618 587 QPDFPageObjectHelper used fallback without copying 0
619 588 QPDF skipping cache for known unchecked object 0
620 589 QPDF fix dangling triggered xref reconstruction 0
... ...