Commit 3ddc51a9dcdf924f2c74963dbd74698689a64f46

Authored by m-holger
1 parent ad468886

Move QPDF::resolveXRefTable to QPDF::Xref_table

include/qpdf/QPDF.hh
@@ -759,7 +759,6 @@ class QPDF @@ -759,7 +759,6 @@ class QPDF
759 759
760 void parse(char const* password); 760 void parse(char const* password);
761 void inParse(bool); 761 void inParse(bool);
762 - bool resolveXRefTable();  
763 void setLastObjectDescription(std::string const& description, QPDFObjGen const& og); 762 void setLastObjectDescription(std::string const& description, QPDFObjGen const& og);
764 QPDFObjectHandle readTrailer(); 763 QPDFObjectHandle readTrailer();
765 QPDFObjectHandle readObject(std::string const& description, QPDFObjGen og); 764 QPDFObjectHandle readObject(std::string const& description, QPDFObjGen og);
libqpdf/QPDF.cc
@@ -1385,13 +1385,13 @@ QPDF::Xref_table::show() @@ -1385,13 +1385,13 @@ QPDF::Xref_table::show()
1385 // Resolve all objects in the xref table. If this triggers a xref table reconstruction abort and 1385 // Resolve all objects in the xref table. If this triggers a xref table reconstruction abort and
1386 // return false. Otherwise return true. 1386 // return false. Otherwise return true.
1387 bool 1387 bool
1388 -QPDF::resolveXRefTable() 1388 +QPDF::Xref_table::resolve()
1389 { 1389 {
1390 - bool may_change = !m->xref_table.reconstructed;  
1391 - for (auto& iter: m->xref_table) {  
1392 - if (isUnresolved(iter.first)) {  
1393 - resolve(iter.first);  
1394 - if (may_change && m->xref_table.reconstructed) { 1390 + bool may_change = !reconstructed;
  1391 + for (auto& iter: *this) {
  1392 + if (qpdf.isUnresolved(iter.first)) {
  1393 + qpdf.resolve(iter.first);
  1394 + if (may_change && reconstructed) {
1395 return false; 1395 return false;
1396 } 1396 }
1397 } 1397 }
@@ -1407,9 +1407,9 @@ QPDF::fixDanglingReferences(bool force) @@ -1407,9 +1407,9 @@ QPDF::fixDanglingReferences(bool force)
1407 if (m->fixed_dangling_refs) { 1407 if (m->fixed_dangling_refs) {
1408 return; 1408 return;
1409 } 1409 }
1410 - if (!resolveXRefTable()) { 1410 + if (!m->xref_table.resolve()) {
1411 QTC::TC("qpdf", "QPDF fix dangling triggered xref reconstruction"); 1411 QTC::TC("qpdf", "QPDF fix dangling triggered xref reconstruction");
1412 - resolveXRefTable(); 1412 + m->xref_table.resolve();
1413 } 1413 }
1414 m->fixed_dangling_refs = true; 1414 m->fixed_dangling_refs = true;
1415 } 1415 }
libqpdf/qpdf/QPDF_private.hh
@@ -17,6 +17,7 @@ class QPDF::Xref_table: public std::map<QPDFObjGen, QPDFXRefEntry> @@ -17,6 +17,7 @@ class QPDF::Xref_table: public std::map<QPDFObjGen, QPDFXRefEntry>
17 void initialize(); 17 void initialize();
18 void reconstruct(QPDFExc& e); 18 void reconstruct(QPDFExc& e);
19 void show(); 19 void show();
  20 + bool resolve();
20 21
21 QPDFObjectHandle trailer; 22 QPDFObjectHandle trailer;
22 bool reconstructed{false}; 23 bool reconstructed{false};