aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_linearization.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-07-23 17:48:28 +0200
committerm-holger <m-holger@kubitscheck.org>2022-07-24 17:02:35 +0200
commitf7978db1f604083c16733952d2b01d3b0f4b0a6a (patch)
tree44bb02e178aa305ca06a0140dbefe9748a72bc0f /libqpdf/QPDF_linearization.cc
parent3404ca8ac8e19ccba5ff2d7426081a593880f1c0 (diff)
downloadqpdf-f7978db1f604083c16733952d2b01d3b0f4b0a6a.tar.zst
QPDFObjGen : tidy QPDF private methods
Change method signatures to use QPDFObjGen. Use QPDFObjGen methods where possible. Remove redundant QPDF::objGenToIndirect.
Diffstat (limited to 'libqpdf/QPDF_linearization.cc')
-rw-r--r--libqpdf/QPDF_linearization.cc30
1 files changed, 12 insertions, 18 deletions
diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc
index cb4d721f..5fa432e0 100644
--- a/libqpdf/QPDF_linearization.cc
+++ b/libqpdf/QPDF_linearization.cc
@@ -706,7 +706,7 @@ QPDF::getUncompressedObject(
return obj;
} else {
int repl = (*(object_stream_data.find(obj.getObjectID()))).second;
- return objGenToIndirect(QPDFObjGen(repl, 0));
+ return getObjectByObjGen(QPDFObjGen(repl));
}
}
@@ -1143,12 +1143,6 @@ QPDF::dumpHGeneric(HGeneric& t)
<< "group_length: " << t.group_length << "\n";
}
-QPDFObjectHandle
-QPDF::objGenToIndirect(QPDFObjGen const& og)
-{
- return getObjectByID(og.getObj(), og.getGen());
-}
-
void
QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
{
@@ -1387,9 +1381,9 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
stopOnError("found other than one root while"
" calculating linearization data");
}
- this->m->part4.push_back(objGenToIndirect(*(lc_root.begin())));
+ this->m->part4.push_back(getObjectByObjGen(*(lc_root.begin())));
for (auto const& og: lc_open_document) {
- this->m->part4.push_back(objGenToIndirect(og));
+ this->m->part4.push_back(getObjectByObjGen(og));
}
// Part 6: first page objects. Note: implementation note 124
@@ -1418,11 +1412,11 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// hint tables.
for (auto const& og: lc_first_page_private) {
- this->m->part6.push_back(objGenToIndirect(og));
+ this->m->part6.push_back(getObjectByObjGen(og));
}
for (auto const& og: lc_first_page_shared) {
- this->m->part6.push_back(objGenToIndirect(og));
+ this->m->part6.push_back(getObjectByObjGen(og));
}
// Place the outline dictionary if it goes in the first page section.
@@ -1468,7 +1462,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
for (auto const& og: this->m->obj_user_to_objects[ou]) {
if (lc_other_page_private.count(og)) {
lc_other_page_private.erase(og);
- this->m->part7.push_back(objGenToIndirect(og));
+ this->m->part7.push_back(getObjectByObjGen(og));
++this->m->c_page_offset_data.entries.at(i).nobjects;
}
}
@@ -1485,7 +1479,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// Order is unimportant.
for (auto const& og: lc_other_page_shared) {
- this->m->part8.push_back(objGenToIndirect(og));
+ this->m->part8.push_back(getObjectByObjGen(og));
}
// Part 9: other objects
@@ -1507,7 +1501,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
for (auto const& og: pages_ogs) {
if (lc_other.count(og)) {
lc_other.erase(og);
- this->m->part9.push_back(objGenToIndirect(og));
+ this->m->part9.push_back(getObjectByObjGen(og));
}
}
@@ -1537,7 +1531,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
for (auto const& og: ogs) {
if (lc_thumbnail_private.count(og)) {
lc_thumbnail_private.erase(og);
- this->m->part9.push_back(objGenToIndirect(og));
+ this->m->part9.push_back(getObjectByObjGen(og));
}
}
}
@@ -1550,7 +1544,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// Place shared thumbnail objects
for (auto const& og: lc_thumbnail_shared) {
- this->m->part9.push_back(objGenToIndirect(og));
+ this->m->part9.push_back(getObjectByObjGen(og));
}
// Place outlines unless in first page
@@ -1560,7 +1554,7 @@ QPDF::calculateLinearizationData(std::map<int, int> const& object_stream_data)
// Place all remaining objects
for (auto const& og: lc_other) {
- this->m->part9.push_back(objGenToIndirect(og));
+ this->m->part9.push_back(getObjectByObjGen(og));
}
// Make sure we got everything exactly once.
@@ -1662,7 +1656,7 @@ QPDF::pushOutlinesToPart(
lc_outlines.erase(outlines_og);
part.push_back(outlines);
for (auto const& og: lc_outlines) {
- part.push_back(objGenToIndirect(og));
+ part.push_back(getObjectByObjGen(og));
++this->m->c_outline_data.nobjects;
}
}