diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index 59d12dc..fe9ff1c 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -25,7 +25,7 @@ QPDFFormFieldObjectHelper::QPDFFormFieldObjectHelper() : bool QPDFFormFieldObjectHelper::isNull() { - return oh().isNull(); + return oh().null(); } QPDFFormFieldObjectHelper @@ -39,7 +39,7 @@ QPDFFormFieldObjectHelper::getTopLevelField(bool* is_different) { auto top_field = oh(); QPDFObjGen::set seen; - while (seen.add(top_field) && !top_field.getKeyIfDict("/Parent").isNull()) { + while (seen.add(top_field) && !top_field.getKeyIfDict("/Parent").null()) { top_field = top_field.getKey("/Parent"); if (is_different) { *is_different = true; @@ -72,13 +72,12 @@ QPDFFormFieldObjectHelper::getInheritableFieldValue(std::string const& name) return QPDFObjectHandle::newNull(); } QPDFObjectHandle result(node.getKey(name)); - if (result.isNull()) { + if (result.null()) { QPDFObjGen::set seen; while (seen.add(node) && node.hasKey("/Parent")) { node = node.getKey("/Parent"); result = node.getKey(name); - if (!result.isNull()) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper non-trivial inheritance"); + if (!result.null()) { return result; } } @@ -118,10 +117,9 @@ QPDFFormFieldObjectHelper::getFullyQualifiedName() std::string result; QPDFObjectHandle node = oh(); QPDFObjGen::set seen; - while (!node.isNull() && seen.add(node)) { + while (!node.null() && seen.add(node)) { if (node.getKey("/T").isString()) { if (!result.empty()) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper non-trivial qualified name"); result = "." + result; } result = node.getKey("/T").getUTF8Value() + result; @@ -360,18 +358,17 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name) // is a member, set /AS to /Off. // Note that we never turn on /NeedAppearances when setting a radio button field. QPDFObjectHandle parent = oh().getKey("/Parent"); - if (parent.isDictionary() && parent.getKey("/Parent").isNull()) { + if (parent.isDictionary() && parent.getKey("/Parent").null()) { QPDFFormFieldObjectHelper ph(parent); if (ph.isRadioButton()) { // This is most likely one of the individual buttons. Try calling on the parent. - QTC::TC("qpdf", "QPDFFormFieldObjectHelper set parent radio button"); ph.setRadioButtonValue(name); return; } } QPDFObjectHandle kids = oh().getKey("/Kids"); - if (!(isRadioButton() && parent.isNull() && kids.isArray())) { + if (!(isRadioButton() && parent.null() && kids.isArray())) { warn("don't know how to set the value of this field as a radio button"); return; } @@ -384,7 +381,6 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name) for (auto const& grandkid: kid.getKey("/Kids").as_array()) { AP = grandkid.getKey("/AP"); if (!AP.null()) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper radio button grandkid"); annot = grandkid; break; } @@ -393,16 +389,13 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name) annot = kid; } if (!annot) { - QTC::TC("qpdf", "QPDFObjectHandle broken radio button"); warn("unable to set the value of this radio button"); continue; } if (AP.isDictionary() && AP.getKey("/N").isDictionary() && AP.getKey("/N").hasKey(name.getName())) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper turn on radio button"); annot.replaceKey("/AS", name); } else { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper turn off radio button"); annot.replaceKey("/AS", QPDFObjectHandle::newName("/Off")); } } @@ -749,7 +742,7 @@ void QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& aoh) { QPDFObjectHandle AS = aoh.getAppearanceStream("/N"); - if (AS.isNull()) { + if (AS.null()) { QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AS from scratch"); QPDFObjectHandle::Rectangle rect = aoh.getRect(); QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly); @@ -759,8 +752,7 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao AS = QPDFObjectHandle::newStream(oh().getOwningQPDF(), "/Tx BMC\nEMC\n"); AS.replaceDict(dict); QPDFObjectHandle AP = aoh.getAppearanceDictionary(); - if (AP.isNull()) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AP from scratch"); + if (AP.null()) { aoh.getObjectHandle().replaceKey("/AP", QPDFObjectHandle::newDictionary()); AP = aoh.getAppearanceDictionary(); } @@ -808,7 +800,6 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao found_font_in_dr = font.isDictionary(); } if (found_font_in_dr && resources.isDictionary()) { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper get font from /DR"); if (resources.isIndirect()) { resources = resources.getQPDF().makeIndirectObject(resources.shallowCopy()); AS.getDict().replaceKey("/Resources", resources); @@ -821,7 +812,6 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao if (font.isDictionary() && font.getKey("/Encoding").isName()) { std::string encoding = font.getKey("/Encoding").getName(); if (encoding == "/WinAnsiEncoding") { - QTC::TC("qpdf", "QPDFFormFieldObjectHelper WinAnsi"); encoder = &QUtil::utf8_to_win_ansi; } else if (encoding == "/MacRomanEncoding") { encoder = &QUtil::utf8_to_mac_roman; diff --git a/qpdf/qpdf.testcov b/qpdf/qpdf.testcov index 4ffd85c..3f93a3c 100644 --- a/qpdf/qpdf.testcov +++ b/qpdf/qpdf.testcov @@ -300,8 +300,6 @@ QPDFObjectHandle erase array bounds 0 qpdf-c called qpdf_check_pdf 0 QPDF xref loop 0 QPDFParser too deep 0 -QPDFFormFieldObjectHelper non-trivial inheritance 0 -QPDFFormFieldObjectHelper non-trivial qualified name 0 QPDFFormFieldObjectHelper TU present 0 QPDFFormFieldObjectHelper TM present 0 QPDFFormFieldObjectHelper TU absent 0 @@ -349,12 +347,7 @@ QPDFObjectHandle replace with copy 0 QPDFPageDocumentHelper indirect as resources 0 QPDFAnnotationObjectHelper forbidden flags 0 QPDFAnnotationObjectHelper missing required flags 0 -QPDFFormFieldObjectHelper set parent radio button 0 -QPDFFormFieldObjectHelper radio button grandkid 0 -QPDFFormFieldObjectHelper turn on radio button 0 -QPDFFormFieldObjectHelper turn off radio button 0 QPDFFormFieldObjectHelper checkbox kid widget 0 -QPDFObjectHandle broken radio button 0 QPDFFormFieldObjectHelper set checkbox AS 0 QPDFObjectHandle broken checkbox 0 QPDFFormFieldObjectHelper list not found 0 @@ -364,7 +357,6 @@ QPDFFormFieldObjectHelper list last too high 0 QPDFJob image optimize no pipeline 0 QPDFJob image optimize no shrink 0 QPDFJob image optimize too small 0 -QPDFFormFieldObjectHelper WinAnsi 0 QPDF pipe foreign encrypted stream 0 QPDF copy foreign stream with provider 0 QPDF copy foreign stream with buffer 0 @@ -381,7 +373,6 @@ QPDFJob invalid utf-8 in auto 0 QPDFJob input password hex-bytes 0 QPDFPageDocumentHelper ignore annotation with no appearance 0 QPDFFormFieldObjectHelper create AS from scratch 0 -QPDFFormFieldObjectHelper create AP from scratch 0 QPDFFormFieldObjectHelper replaced BMC at EOF 0 QPDFFormFieldObjectHelper fallback Tf 0 QPDFPageObjectHelper non-trivial inheritance 0 @@ -508,7 +499,6 @@ QPDFAcroFormDocumentHelper modify ap matrix 0 QPDFJob pages keeping field from original 0 QPDFObjectHandle merge reuse 0 QPDFObjectHandle merge generate 0 -QPDFFormFieldObjectHelper get font from /DR 0 QPDFAcroFormDocumentHelper replaced DA token 0 QPDFAcroFormDocumentHelper /DA parse error 0 QPDFAcroFormDocumentHelper AP parse error 1