Commit 92de83977fd2456a759e7beddb522c51d112a940

Authored by m-holger
1 parent 3052c451

Refactor `QPDFObjectHandle::arrayOrStreamToStreamArray`: replace `as_array` and …

…bounds checks with subscript operator, simplify loop logic, and remove redundant trace.
libqpdf/QPDFObjectHandle.cc
... ... @@ -1234,11 +1234,10 @@ QPDFObjectHandle::arrayOrStreamToStreamArray(
1234 1234 if (auto array = as_array(strict)) {
1235 1235 int n_items = static_cast<int>(array.size());
1236 1236 for (int i = 0; i < n_items; ++i) {
1237   - QPDFObjectHandle item = array.at(i).second;
  1237 + QPDFObjectHandle item = array[i];
1238 1238 if (item.isStream()) {
1239 1239 result.emplace_back(item);
1240 1240 } else {
1241   - QTC::TC("qpdf", "QPDFObjectHandle non-stream in stream array");
1242 1241 item.warn(
1243 1242 {qpdf_e_damaged_pdf,
1244 1243 "",
... ...
qpdf/qpdf.testcov
... ... @@ -282,7 +282,6 @@ qpdf-c called qpdf_set_newline_before_endstream 0
282 282 SF_FlateLzwDecode TIFF predictor 0
283 283 QPDFTokenizer inline image at EOF 0
284 284 Pl_QPDFTokenizer found ID 0
285   -QPDFObjectHandle non-stream in stream array 0
286 285 QPDFObjectHandle coalesce called on stream 0
287 286 QPDFObjectHandle coalesce provide stream data 0
288 287 QPDF_Stream bad token at end during normalize 0
... ...