Commit 0dad57c5611d0aa31d583b9470efe6de0ac9f18b
1 parent
f49c5588
Refactor: replace `getKey` with operator[] in `QPDF_linearization::`, update typ…
…e handling to improve clarity and consistency.
Showing
2 changed files
with
5 additions
and
15 deletions
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