2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

Move QPDF::resolveXRefTable to QPDF::Xref_table

This commit is contained in:
m-holger 2024-08-12 14:58:14 +01:00
parent ad4688866d
commit 3ddc51a9dc
3 changed files with 9 additions and 9 deletions

View File

@ -759,7 +759,6 @@ class QPDF
void parse(char const* password);
void inParse(bool);
bool resolveXRefTable();
void setLastObjectDescription(std::string const& description, QPDFObjGen const& og);
QPDFObjectHandle readTrailer();
QPDFObjectHandle readObject(std::string const& description, QPDFObjGen og);

View File

@ -1385,13 +1385,13 @@ QPDF::Xref_table::show()
// Resolve all objects in the xref table. If this triggers a xref table reconstruction abort and
// return false. Otherwise return true.
bool
QPDF::resolveXRefTable()
QPDF::Xref_table::resolve()
{
bool may_change = !m->xref_table.reconstructed;
for (auto& iter: m->xref_table) {
if (isUnresolved(iter.first)) {
resolve(iter.first);
if (may_change && m->xref_table.reconstructed) {
bool may_change = !reconstructed;
for (auto& iter: *this) {
if (qpdf.isUnresolved(iter.first)) {
qpdf.resolve(iter.first);
if (may_change && reconstructed) {
return false;
}
}
@ -1407,9 +1407,9 @@ QPDF::fixDanglingReferences(bool force)
if (m->fixed_dangling_refs) {
return;
}
if (!resolveXRefTable()) {
if (!m->xref_table.resolve()) {
QTC::TC("qpdf", "QPDF fix dangling triggered xref reconstruction");
resolveXRefTable();
m->xref_table.resolve();
}
m->fixed_dangling_refs = true;
}

View File

@ -17,6 +17,7 @@ class QPDF::Xref_table: public std::map<QPDFObjGen, QPDFXRefEntry>
void initialize();
void reconstruct(QPDFExc& e);
void show();
bool resolve();
QPDFObjectHandle trailer;
bool reconstructed{false};