diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF.cc | 18 | ||||
-rw-r--r-- | libqpdf/QPDFAcroFormDocumentHelper.cc | 2 | ||||
-rw-r--r-- | libqpdf/QPDFObjectHandle.cc | 30 | ||||
-rw-r--r-- | libqpdf/QPDFWriter.cc | 2 | ||||
-rw-r--r-- | libqpdf/QPDF_json.cc | 11 | ||||
-rw-r--r-- | libqpdf/QPDF_linearization.cc | 24 |
6 files changed, 36 insertions, 51 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 7e0dd11e..b96b0674 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -2148,7 +2148,7 @@ QPDF::reserveObjectIfNotExists(QPDFObjGen const& og) resolve(og); replaceObject(og, QPDFObjectHandle::Factory::makeReserved()); } - return getObjectByObjGen(og); + return getObject(og); } QPDFObjectHandle @@ -2159,15 +2159,27 @@ QPDF::reserveStream(QPDFObjGen const& og) } QPDFObjectHandle -QPDF::getObjectByObjGen(QPDFObjGen const& og) +QPDF::getObject(QPDFObjGen const& og) { return QPDFObjectHandle::Factory::newIndirect(this, og); } QPDFObjectHandle +QPDF::getObject(int objid, int generation) +{ + return getObject(QPDFObjGen(objid, generation)); +} + +QPDFObjectHandle +QPDF::getObjectByObjGen(QPDFObjGen const& og) +{ + return getObject(og); +} + +QPDFObjectHandle QPDF::getObjectByID(int objid, int generation) { - return getObjectByObjGen(QPDFObjGen(objid, generation)); + return getObject(QPDFObjGen(objid, generation)); } void diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index 23d021ff..6fec0587 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -183,7 +183,7 @@ QPDFAcroFormDocumentHelper::getFormFields() analyze(); std::vector<QPDFFormFieldObjectHelper> result; for (auto const& iter: this->m->field_to_annotations) { - result.push_back(this->qpdf.getObjectByObjGen(iter.first)); + result.push_back(this->qpdf.getObject(iter.first)); } return result; } diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 152f1ae2..cf5460d7 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -286,12 +286,6 @@ QPDFObjectHandle::setObjectDescriptionFromInput( QUtil::int_to_string(offset))); } -bool -QPDFObjectHandle::isInitialized() const -{ - return this->initialized; -} - QPDFObject::object_type_e QPDFObjectHandle::getTypeCode() { @@ -435,12 +429,6 @@ QPDFObjectHandle::isReserved() } bool -QPDFObjectHandle::isIndirect() -{ - return this->initialized && (getObjectID() != 0); -} - -bool QPDFObjectHandle::isScalar() { return ( @@ -1499,24 +1487,6 @@ QPDFObjectHandle::replaceStreamData( sdp, filter, decode_parms); } -QPDFObjGen -QPDFObjectHandle::getObjGen() const -{ - return og; -} - -int -QPDFObjectHandle::getObjectID() const -{ - return og.getObj(); -} - -int -QPDFObjectHandle::getGeneration() const -{ - return og.getGen(); -} - std::map<std::string, QPDFObjectHandle> QPDFObjectHandle::getPageImages() { diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index e33d0965..028f73dc 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1897,7 +1897,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object) // pass 1. indicateProgress(true, false); } - QPDFObjectHandle obj_to_write = this->m->pdf.getObjectByObjGen(obj); + QPDFObjectHandle obj_to_write = this->m->pdf.getObject(obj); if (obj_to_write.isStream()) { // This condition occurred in a fuzz input. Ideally we // should block it at at parse time, but it's not diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc index a3d50cfb..131e7dee 100644 --- a/libqpdf/QPDF_json.cc +++ b/libqpdf/QPDF_json.cc @@ -14,8 +14,11 @@ // | st_initial // { | -> st_top -// "qpdf-v2": { | -> st_qpdf -// "objects": { | -> st_objects +// "qpdf": [ | -> st_qpdf +// { | -> st_qpdf_meta +// ... | ... +// }, | ... +// { | -> st_objects // "obj:1 0 R": { | -> st_object_top // "value": { | -> st_object // "/Pages": "2 0 R", | ... @@ -41,7 +44,7 @@ // } | <- st_trailer // } | <- st_objects // } | <- st_qpdf -// } | <- st_top +// ] | <- st_top // } | <- st_initial static char const* JSON_PDF = ( @@ -394,7 +397,7 @@ QPDF::JSONReactor::replaceObject( auto og = to_replace.getObjGen(); this->reserved.erase(og); this->pdf.replaceObject(og, replacement); - auto oh = pdf.getObjectByObjGen(og); + auto oh = pdf.getObject(og); setObjectDescription(oh, value); } diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index f89ed188..e988092e 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 getObjectByObjGen(QPDFObjGen(repl, 0)); + return getObject(repl, 0); } } @@ -1381,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(getObjectByObjGen(*(lc_root.begin()))); + this->m->part4.push_back(getObject(*(lc_root.begin()))); for (auto const& og: lc_open_document) { - this->m->part4.push_back(getObjectByObjGen(og)); + this->m->part4.push_back(getObject(og)); } // Part 6: first page objects. Note: implementation note 124 @@ -1412,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(getObjectByObjGen(og)); + this->m->part6.push_back(getObject(og)); } for (auto const& og: lc_first_page_shared) { - this->m->part6.push_back(getObjectByObjGen(og)); + this->m->part6.push_back(getObject(og)); } // Place the outline dictionary if it goes in the first page section. @@ -1462,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(getObjectByObjGen(og)); + this->m->part7.push_back(getObject(og)); ++this->m->c_page_offset_data.entries.at(i).nobjects; } } @@ -1479,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(getObjectByObjGen(og)); + this->m->part8.push_back(getObject(og)); } // Part 9: other objects @@ -1501,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(getObjectByObjGen(og)); + this->m->part9.push_back(getObject(og)); } } @@ -1531,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(getObjectByObjGen(og)); + this->m->part9.push_back(getObject(og)); } } } @@ -1544,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(getObjectByObjGen(og)); + this->m->part9.push_back(getObject(og)); } // Place outlines unless in first page @@ -1554,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(getObjectByObjGen(og)); + this->m->part9.push_back(getObject(og)); } // Make sure we got everything exactly once. @@ -1656,7 +1656,7 @@ QPDF::pushOutlinesToPart( lc_outlines.erase(outlines_og); part.push_back(outlines); for (auto const& og: lc_outlines) { - part.push_back(getObjectByObjGen(og)); + part.push_back(getObject(og)); ++this->m->c_outline_data.nobjects; } } |