Commit fe92a61de954e6eca0f96f1ee25a33262987b953

Authored by m-holger
1 parent d34e1e80

Refactor: replace `isNull` calls with `null` in `QPDF` and remove redundant `QTC::TC` calls.

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) {
... ...
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,7 +84,6 @@ 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 88 QPDFWriter copy Extends 0
93 89 QPDFWriter encrypt object stream 0
... ...