Commit 675c9ae7c55ea1567aecc4e414b546025ba41fdf
1 parent
3c6654b3
Refactor `pipeForeignStreamData` logic: streamline conditional checks, improve f…
…oreign stream handling, and simplify return logic.
Showing
2 changed files
with
13 additions
and
12 deletions
libqpdf/QPDF.cc
| ... | ... | @@ -135,18 +135,21 @@ Streams::Copier::provideStreamData( |
| 135 | 135 | QPDFObjGen const& og, Pipeline* pipeline, bool suppress_warnings, bool will_retry) |
| 136 | 136 | { |
| 137 | 137 | auto data = copied_data.find(og); |
| 138 | - bool result = false; | |
| 139 | 138 | if (data != copied_data.end()) { |
| 140 | - result = streams.qpdf().pipeForeignStreamData( | |
| 141 | - data->second, pipeline, suppress_warnings, will_retry); | |
| 142 | - QTC::TC("qpdf", "QPDF copy foreign with data", result ? 0 : 1); | |
| 143 | - } else { | |
| 144 | - auto stream = copied_streams[og]; | |
| 145 | - result = stream.pipeStreamData( | |
| 146 | - pipeline, nullptr, 0, qpdf_dl_none, suppress_warnings, will_retry); | |
| 147 | - QTC::TC("qpdf", "QPDF copy foreign with foreign_stream", result ? 0 : 1); | |
| 139 | + if (streams.qpdf().pipeForeignStreamData( | |
| 140 | + data->second, pipeline, suppress_warnings, will_retry)) { | |
| 141 | + return true; // for CI coverage | |
| 142 | + } else { | |
| 143 | + return false; | |
| 144 | + } | |
| 148 | 145 | } |
| 149 | - return result; | |
| 146 | + auto stream = copied_streams.find(og); | |
| 147 | + if (stream != copied_streams.end() && | |
| 148 | + stream->second.pipeStreamData( | |
| 149 | + pipeline, nullptr, 0, qpdf_dl_none, suppress_warnings, will_retry)) { | |
| 150 | + return true; // for CI coverage | |
| 151 | + } | |
| 152 | + return false; | |
| 150 | 153 | } |
| 151 | 154 | |
| 152 | 155 | QPDF::StringDecrypter::StringDecrypter(QPDF* qpdf, QPDFObjGen og) : | ... | ... |
qpdf/qpdf.testcov
| ... | ... | @@ -277,8 +277,6 @@ QPDFPageObjectHelper filter form xobject 0 |
| 277 | 277 | QPDFJob found resources in non-leaf 0 |
| 278 | 278 | QPDFJob found shared resources in leaf 0 |
| 279 | 279 | QPDFJob found shared xobject in leaf 0 |
| 280 | -QPDF copy foreign with data 1 | |
| 281 | -QPDF copy foreign with foreign_stream 1 | |
| 282 | 280 | QPDFObjectHandle need_newline 1 |
| 283 | 281 | QPDFJob pages range omitted with . 0 |
| 284 | 282 | qpdf-c invalid object handle 0 | ... | ... |