Commit 95424109ac7770a925517a7b81304062fe163959

Authored by m-holger
1 parent 675c9ae7

Remove `pipeForeignStreamData`: inline logic into `Streams::Copier::pipeStreamDa…

…ta`and streamline foreign stream handling.
include/qpdf/QPDF.hh
@@ -773,8 +773,6 @@ class QPDF @@ -773,8 +773,6 @@ class QPDF
773 Pipeline* pipeline, 773 Pipeline* pipeline,
774 bool suppress_warnings, 774 bool suppress_warnings,
775 bool will_retry); 775 bool will_retry);
776 - bool  
777 - pipeForeignStreamData(ForeignStreamData&, Pipeline*, bool suppress_warnings, bool will_retry);  
778 static bool pipeStreamData( 776 static bool pipeStreamData(
779 std::shared_ptr<QPDF::EncryptionParameters> encp, 777 std::shared_ptr<QPDF::EncryptionParameters> encp,
780 std::shared_ptr<InputSource> file, 778 std::shared_ptr<InputSource> file,
libqpdf/QPDF.cc
@@ -136,8 +136,20 @@ Streams::Copier::provideStreamData( @@ -136,8 +136,20 @@ Streams::Copier::provideStreamData(
136 { 136 {
137 auto data = copied_data.find(og); 137 auto data = copied_data.find(og);
138 if (data != copied_data.end()) { 138 if (data != copied_data.end()) {
139 - if (streams.qpdf().pipeForeignStreamData(  
140 - data->second, pipeline, suppress_warnings, will_retry)) { 139 + auto& fd = data->second;
  140 + QTC::TC("qpdf", "QPDF pipe foreign encrypted stream", fd.encp->encrypted ? 0 : 1);
  141 + if (streams.qpdf().pipeStreamData(
  142 + fd.encp,
  143 + fd.file,
  144 + streams.qpdf(),
  145 + fd.foreign_og,
  146 + fd.offset,
  147 + fd.length,
  148 + fd.local_dict,
  149 + fd.is_root_metadata,
  150 + pipeline,
  151 + suppress_warnings,
  152 + will_retry)) {
141 return true; // for CI coverage 153 return true; // for CI coverage
142 } else { 154 } else {
143 return false; 155 return false;
@@ -895,27 +907,6 @@ QPDF::pipeStreamData( @@ -895,27 +907,6 @@ QPDF::pipeStreamData(
895 will_retry); 907 will_retry);
896 } 908 }
897 909
898 -bool  
899 -QPDF::pipeForeignStreamData(  
900 - ForeignStreamData& foreign, Pipeline* pipeline, bool suppress_warnings, bool will_retry)  
901 -{  
902 - if (foreign.encp->encrypted) {  
903 - QTC::TC("qpdf", "QPDF pipe foreign encrypted stream");  
904 - }  
905 - return pipeStreamData(  
906 - foreign.encp,  
907 - foreign.file,  
908 - *this,  
909 - foreign.foreign_og,  
910 - foreign.offset,  
911 - foreign.length,  
912 - foreign.local_dict,  
913 - foreign.is_root_metadata,  
914 - pipeline,  
915 - suppress_warnings,  
916 - will_retry);  
917 -}  
918 -  
919 // Throw a generic exception when we lack context for something more specific. New code should not 910 // Throw a generic exception when we lack context for something more specific. New code should not
920 // use this. 911 // use this.
921 void 912 void
qpdf/qpdf.testcov
@@ -244,7 +244,7 @@ QPDFFormFieldObjectHelper list last too high 0 @@ -244,7 +244,7 @@ QPDFFormFieldObjectHelper list last too high 0
244 QPDFJob image optimize no pipeline 0 244 QPDFJob image optimize no pipeline 0
245 QPDFJob image optimize no shrink 0 245 QPDFJob image optimize no shrink 0
246 QPDFJob image optimize too small 0 246 QPDFJob image optimize too small 0
247 -QPDF pipe foreign encrypted stream 0 247 +QPDF pipe foreign encrypted stream 1
248 QPDFJob copy same page more than once 1 248 QPDFJob copy same page more than once 1
249 QPDFPageObjectHelper bad token finding names 0 249 QPDFPageObjectHelper bad token finding names 0
250 QPDFJob password mode bytes 0 250 QPDFJob password mode bytes 0