Commit 0dad57c5611d0aa31d583b9470efe6de0ac9f18b

Authored by m-holger
1 parent f49c5588

Refactor: replace `getKey` with operator[] in `QPDF_linearization::`, update typ…

…e handling to improve clarity and consistency.
libqpdf/QPDF_linearization.cc
... ... @@ -122,27 +122,18 @@ QPDF::isLinearized()
122 122 continue;
123 123 }
124 124  
125   - auto candidate = getObject(toI(QUtil::string_to_ll(t1.getValue().data())), 0);
126   - if (!candidate.isDictionary()) {
127   - return false;
128   - }
129   -
130   - auto linkey = candidate.getKey("/Linearized");
  125 + Dictionary candidate = getObject(toI(QUtil::string_to_ll(t1.getValue().data())), 0);
  126 + auto linkey = candidate["/Linearized"];
131 127 if (!(linkey.isNumber() && toI(floor(linkey.getNumericValue())) == 1)) {
132 128 return false;
133 129 }
134 130  
135   - auto L = candidate.getKey("/L");
136   - if (!L.isInteger()) {
137   - return false;
138   - }
139   - qpdf_offset_t Li = L.getIntValue();
140 131 m->file->seek(0, SEEK_END);
141   - if (Li != m->file->tell()) {
142   - QTC::TC("qpdf", "QPDF /L mismatch");
  132 + Integer L = candidate["/L"];
  133 + if (L != m->file->tell()) {
143 134 return false;
144 135 }
145   - m->linp.file_size = Li;
  136 + m->linp.file_size = L;
146 137 m->lindict = candidate;
147 138 return true;
148 139 }
... ...
qpdf/qpdf.testcov
... ... @@ -12,7 +12,6 @@ QPDF hint table length direct 0
12 12 QPDF P absent in lindict 0
13 13 QPDF P present in lindict 0
14 14 QPDF expected n n obj 0
15   -QPDF /L mismatch 0
16 15 QPDF err /T mismatch 0
17 16 QPDF err /O mismatch 0
18 17 QPDF opt direct pages resource 1
... ...