Commit 9a84ef3b1c2260ca9e9ccbe3595ac43b3317681a

Authored by m-holger
1 parent 56c43934

Refactor stream filter handling for better array support

Replaced manual array handling with cleaner iteration using `as_array`. This improves code readability and ensures more robust processing of stream filter arrays.
Showing 1 changed file with 2 additions and 4 deletions
libqpdf/QPDF_Stream.cc
... ... @@ -363,11 +363,9 @@ Stream::filterable(
363 363 return false;
364 364 }
365 365 filters.emplace_back(ff());
366   - } else if (filter_obj.isArray()) {
  366 + } else if (auto array = filter_obj.as_array(strict)) {
367 367 // Potentially multiple filters
368   - int n = filter_obj.getArrayNItems();
369   - for (int i = 0; i < n; ++i) {
370   - QPDFObjectHandle item = filter_obj.getArrayItem(i);
  368 + for (auto const& item: array) {
371 369 if (!item.isName()) {
372 370 warn("stream filter type is not name or array");
373 371 return false;
... ...