Commit 16841bec32bb4323a60699cf42f0d74ef495b73f
1 parent
07b66eb0
Remove QPDFObjectHandle::makeReserved
Showing
3 changed files
with
4 additions
and
20 deletions
include/qpdf/QPDFObjectHandle.hh
| @@ -1458,12 +1458,6 @@ class QPDFObjectHandle | @@ -1458,12 +1458,6 @@ class QPDFObjectHandle | ||
| 1458 | return QPDFObjectHandle::newStream( | 1458 | return QPDFObjectHandle::newStream( |
| 1459 | qpdf, og, stream_dict, offset, length); | 1459 | qpdf, og, stream_dict, offset, length); |
| 1460 | } | 1460 | } |
| 1461 | - // Reserve an object with a specific ID | ||
| 1462 | - static QPDFObjectHandle | ||
| 1463 | - makeReserved() | ||
| 1464 | - { | ||
| 1465 | - return QPDFObjectHandle::makeReserved(); | ||
| 1466 | - } | ||
| 1467 | }; | 1461 | }; |
| 1468 | friend class Factory; | 1462 | friend class Factory; |
| 1469 | 1463 | ||
| @@ -1574,7 +1568,6 @@ class QPDFObjectHandle | @@ -1574,7 +1568,6 @@ class QPDFObjectHandle | ||
| 1574 | QPDFObjectHandle stream_dict, | 1568 | QPDFObjectHandle stream_dict, |
| 1575 | qpdf_offset_t offset, | 1569 | qpdf_offset_t offset, |
| 1576 | size_t length); | 1570 | size_t length); |
| 1577 | - static QPDFObjectHandle makeReserved(); | ||
| 1578 | 1571 | ||
| 1579 | void typeWarning(char const* expected_type, std::string const& warning); | 1572 | void typeWarning(char const* expected_type, std::string const& warning); |
| 1580 | void objectWarning(std::string const& warning); | 1573 | void objectWarning(std::string const& warning); |
libqpdf/QPDF.cc
| @@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
| 24 | #include <qpdf/QPDF_Array.hh> | 24 | #include <qpdf/QPDF_Array.hh> |
| 25 | #include <qpdf/QPDF_Dictionary.hh> | 25 | #include <qpdf/QPDF_Dictionary.hh> |
| 26 | #include <qpdf/QPDF_Null.hh> | 26 | #include <qpdf/QPDF_Null.hh> |
| 27 | +#include <qpdf/QPDF_Reserved.hh> | ||
| 27 | #include <qpdf/QPDF_Stream.hh> | 28 | #include <qpdf/QPDF_Stream.hh> |
| 28 | #include <qpdf/QTC.hh> | 29 | #include <qpdf/QTC.hh> |
| 29 | #include <qpdf/QUtil.hh> | 30 | #include <qpdf/QUtil.hh> |
| @@ -2144,9 +2145,9 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh) | @@ -2144,9 +2145,9 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh) | ||
| 2144 | QPDFObjectHandle | 2145 | QPDFObjectHandle |
| 2145 | QPDF::reserveObjectIfNotExists(QPDFObjGen const& og) | 2146 | QPDF::reserveObjectIfNotExists(QPDFObjGen const& og) |
| 2146 | { | 2147 | { |
| 2147 | - if ((!this->m->obj_cache.count(og)) && (!this->m->xref_table.count(og))) { | 2148 | + if ((!m->obj_cache.count(og)) && (!m->xref_table.count(og))) { |
| 2148 | resolve(og); | 2149 | resolve(og); |
| 2149 | - replaceObject(og, QPDFObjectHandle::Factory::makeReserved()); | 2150 | + m->obj_cache[og].object = QPDF_Reserved::create(); |
| 2150 | } | 2151 | } |
| 2151 | return getObject(og); | 2152 | return getObject(og); |
| 2152 | } | 2153 | } |
libqpdf/QPDFObjectHandle.cc
| @@ -2152,17 +2152,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf, std::string const& data) | @@ -2152,17 +2152,7 @@ QPDFObjectHandle::newStream(QPDF* qpdf, std::string const& data) | ||
| 2152 | QPDFObjectHandle | 2152 | QPDFObjectHandle |
| 2153 | QPDFObjectHandle::newReserved(QPDF* qpdf) | 2153 | QPDFObjectHandle::newReserved(QPDF* qpdf) |
| 2154 | { | 2154 | { |
| 2155 | - // Reserve a spot for this object by assigning it an object | ||
| 2156 | - // number, but then return an unresolved handle to the object. | ||
| 2157 | - QPDFObjectHandle reserved = qpdf->makeIndirectObject(makeReserved()); | ||
| 2158 | - QPDFObjectHandle result = newIndirect(qpdf, reserved.getObjGen()); | ||
| 2159 | - return result; | ||
| 2160 | -} | ||
| 2161 | - | ||
| 2162 | -QPDFObjectHandle | ||
| 2163 | -QPDFObjectHandle::makeReserved() | ||
| 2164 | -{ | ||
| 2165 | - return QPDFObjectHandle(QPDF_Reserved::create()); | 2155 | + return qpdf->makeIndirectObject(QPDFObjectHandle(QPDF_Reserved::create())); |
| 2166 | } | 2156 | } |
| 2167 | 2157 | ||
| 2168 | void | 2158 | void |