Commit 3a86b893f710453ba935903d68200a7bee4cbad2

Authored by m-holger
Committed by Jay Berkenbilt
1 parent 69e67b45

Remove redundant parameters from QPDF_Stream::warn

libqpdf/QPDF_Stream.cc
@@ -415,10 +415,7 @@ QPDF_Stream::filterable( @@ -415,10 +415,7 @@ QPDF_Stream::filterable(
415 415
416 if (!filters_okay) { 416 if (!filters_okay) {
417 QTC::TC("qpdf", "QPDF_Stream invalid filter"); 417 QTC::TC("qpdf", "QPDF_Stream invalid filter");
418 - warn(  
419 - qpdf_e_damaged_pdf,  
420 - this->offset,  
421 - "stream filter type is not name or array"); 418 + warn("stream filter type is not name or array");
422 return false; 419 return false;
423 } 420 }
424 421
@@ -466,11 +463,7 @@ QPDF_Stream::filterable( @@ -466,11 +463,7 @@ QPDF_Stream::filterable(
466 // one case of a file whose /DecodeParms was [ << >> ] when 463 // one case of a file whose /DecodeParms was [ << >> ] when
467 // /Filters was empty has been seen in the wild. 464 // /Filters was empty has been seen in the wild.
468 if ((filters.size() != 0) && (decode_parms.size() != filters.size())) { 465 if ((filters.size() != 0) && (decode_parms.size() != filters.size())) {
469 - warn(  
470 - qpdf_e_damaged_pdf,  
471 - this->offset,  
472 - "stream /DecodeParms length is"  
473 - " inconsistent with filters"); 466 + warn("stream /DecodeParms length is inconsistent with filters");
474 filterable = false; 467 filterable = false;
475 } 468 }
476 469
@@ -582,9 +575,8 @@ QPDF_Stream::pipeStreamData( @@ -582,9 +575,8 @@ QPDF_Stream::pipeStreamData(
582 } 575 }
583 Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline); 576 Pl_Flate* flate = dynamic_cast<Pl_Flate*>(pipeline);
584 if (flate != nullptr) { 577 if (flate != nullptr) {
585 - flate->setWarnCallback([this](char const* msg, int code) {  
586 - warn(qpdf_e_damaged_pdf, this->offset, msg);  
587 - }); 578 + flate->setWarnCallback(
  579 + [this](char const* msg, int code) { warn(msg); });
588 } 580 }
589 } 581 }
590 } 582 }
@@ -647,28 +639,17 @@ QPDF_Stream::pipeStreamData( @@ -647,28 +639,17 @@ QPDF_Stream::pipeStreamData(
647 639
648 if (filter && (!suppress_warnings) && normalizer.get() && 640 if (filter && (!suppress_warnings) && normalizer.get() &&
649 normalizer->anyBadTokens()) { 641 normalizer->anyBadTokens()) {
650 - warn(  
651 - qpdf_e_damaged_pdf,  
652 - this->offset,  
653 - "content normalization encountered bad tokens"); 642 + warn("content normalization encountered bad tokens");
654 if (normalizer->lastTokenWasBad()) { 643 if (normalizer->lastTokenWasBad()) {
655 QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize"); 644 QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
656 - warn(  
657 - qpdf_e_damaged_pdf,  
658 - this->offset,  
659 - "normalized content ended with a bad token;"  
660 - " you may be able to resolve this by"  
661 - " coalescing content streams in combination"  
662 - " with normalizing content. From the command"  
663 - " line, specify --coalesce-contents"); 645 + warn("normalized content ended with a bad token; you may be able "
  646 + "to resolve this by coalescing content streams in combination "
  647 + "with normalizing content. From the command line, specify "
  648 + "--coalesce-contents");
664 } 649 }
665 - warn(  
666 - qpdf_e_damaged_pdf,  
667 - this->offset,  
668 - "Resulting stream data may be corrupted but is"  
669 - " may still useful for manual inspection."  
670 - " For more information on this warning, search"  
671 - " for content normalization in the manual."); 650 + warn("Resulting stream data may be corrupted but is may still useful "
  651 + "for manual inspection. For more information on this warning, "
  652 + "search for content normalization in the manual.");
672 } 653 }
673 654
674 return success; 655 return success;
@@ -733,10 +714,7 @@ QPDF_Stream::replaceDict(QPDFObjectHandle const&amp; new_dict) @@ -733,10 +714,7 @@ QPDF_Stream::replaceDict(QPDFObjectHandle const&amp; new_dict)
733 } 714 }
734 715
735 void 716 void
736 -QPDF_Stream::warn(  
737 - qpdf_error_code_e error_code,  
738 - qpdf_offset_t offset,  
739 - std::string const& message) 717 +QPDF_Stream::warn(std::string const& message)
740 { 718 {
741 - this->qpdf->warn(error_code, "", offset, message); 719 + this->qpdf->warn(qpdf_e_damaged_pdf, "", this->offset, message);
742 } 720 }
libqpdf/qpdf/QPDF_Stream.hh
@@ -98,10 +98,7 @@ class QPDF_Stream: public QPDFValue @@ -98,10 +98,7 @@ class QPDF_Stream: public QPDFValue
98 std::vector<std::shared_ptr<QPDFStreamFilter>>& filters, 98 std::vector<std::shared_ptr<QPDFStreamFilter>>& filters,
99 bool& specialized_compression, 99 bool& specialized_compression,
100 bool& lossy_compression); 100 bool& lossy_compression);
101 - void warn(  
102 - qpdf_error_code_e error_code,  
103 - qpdf_offset_t offset,  
104 - std::string const& message); 101 + void warn(std::string const& message);
105 void setDictDescription(); 102 void setDictDescription();
106 103
107 bool filter_on_write; 104 bool filter_on_write;