Commit 8803fedefd7b363135ba430ae8c3943921ca3382

Authored by m-holger
1 parent d9c46a5e

Refactor `QPDFAcroFormDocumentHelper`: simplify `/DR` initialization by removing…

… redundant `initialized_dr_map` flag and directly checking `dr`.
libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -789,12 +789,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations( @@ -789,12 +789,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
789 // If we have to merge /DR, we will need a mapping of conflicting keys for rewriting /DA. Set 789 // If we have to merge /DR, we will need a mapping of conflicting keys for rewriting /DA. Set
790 // this up for lazy initialization in case we encounter any form fields. 790 // this up for lazy initialization in case we encounter any form fields.
791 std::map<std::string, std::map<std::string, std::string>> dr_map; 791 std::map<std::string, std::map<std::string, std::string>> dr_map;
792 - bool initialized_dr_map = false;  
793 Dictionary dr; 792 Dictionary dr;
794 793
795 auto init_dr_map = [&]() { 794 auto init_dr_map = [&]() {
796 - if (!initialized_dr_map) {  
797 - initialized_dr_map = true; 795 + if (!dr) {
798 // Ensure that we have a /DR that is an indirect 796 // Ensure that we have a /DR that is an indirect
799 // dictionary object. 797 // dictionary object.
800 if (!acroform) { 798 if (!acroform) {