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

Remove QPDFObjectHandle::makeReserved

This commit is contained in:
m-holger 2022-08-02 17:18:00 +01:00
parent 07b66eb0b6
commit 16841bec32
3 changed files with 4 additions and 20 deletions

View File

@ -1458,12 +1458,6 @@ class QPDFObjectHandle
return QPDFObjectHandle::newStream(
qpdf, og, stream_dict, offset, length);
}
// Reserve an object with a specific ID
static QPDFObjectHandle
makeReserved()
{
return QPDFObjectHandle::makeReserved();
}
};
friend class Factory;
@ -1574,7 +1568,6 @@ class QPDFObjectHandle
QPDFObjectHandle stream_dict,
qpdf_offset_t offset,
size_t length);
static QPDFObjectHandle makeReserved();
void typeWarning(char const* expected_type, std::string const& warning);
void objectWarning(std::string const& warning);

View File

@ -24,6 +24,7 @@
#include <qpdf/QPDF_Array.hh>
#include <qpdf/QPDF_Dictionary.hh>
#include <qpdf/QPDF_Null.hh>
#include <qpdf/QPDF_Reserved.hh>
#include <qpdf/QPDF_Stream.hh>
#include <qpdf/QTC.hh>
#include <qpdf/QUtil.hh>
@ -2144,9 +2145,9 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh)
QPDFObjectHandle
QPDF::reserveObjectIfNotExists(QPDFObjGen const& og)
{
if ((!this->m->obj_cache.count(og)) && (!this->m->xref_table.count(og))) {
if ((!m->obj_cache.count(og)) && (!m->xref_table.count(og))) {
resolve(og);
replaceObject(og, QPDFObjectHandle::Factory::makeReserved());
m->obj_cache[og].object = QPDF_Reserved::create();
}
return getObject(og);
}

View File

@ -2152,17 +2152,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf, std::string const& data)
QPDFObjectHandle
QPDFObjectHandle::newReserved(QPDF* qpdf)
{
// Reserve a spot for this object by assigning it an object
// number, but then return an unresolved handle to the object.
QPDFObjectHandle reserved = qpdf->makeIndirectObject(makeReserved());
QPDFObjectHandle result = newIndirect(qpdf, reserved.getObjGen());
return result;
}
QPDFObjectHandle
QPDFObjectHandle::makeReserved()
{
return QPDFObjectHandle(QPDF_Reserved::create());
return qpdf->makeIndirectObject(QPDFObjectHandle(QPDF_Reserved::create()));
}
void