diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index dd4bfe43..5729d3bf 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -748,7 +748,6 @@ class QPDF static std::string const qpdf_version; - class ObjCache; class ObjCopier; class EncryptionParameters; class ForeignStreamData; diff --git a/libqpdf/QPDF_objects.cc b/libqpdf/QPDF_objects.cc index b7d0aaf1..5cf9a55e 100644 --- a/libqpdf/QPDF_objects.cc +++ b/libqpdf/QPDF_objects.cc @@ -747,8 +747,8 @@ Xref_table::read_stream(qpdf_offset_t xref_offset) QPDFObjGen x_og; QPDFObjectHandle xref_obj; try { - xref_obj = qpdf.objects().read( - false, xref_offset, "xref stream", QPDFObjGen(0, 0), x_og, true); + xref_obj = + objects.read(false, xref_offset, "xref stream", QPDFObjGen(0, 0), x_og, true); } catch (QPDFExc&) { // ignore -- report error below } @@ -1693,7 +1693,7 @@ Objects::update_table(QPDFObjGen og, const std::shared_ptr& object) auto& cache = obj_cache[og]; cache.object->assign(object); } else { - obj_cache[og] = ObjCache(object); + obj_cache[og] = Entry(object); } } @@ -1723,7 +1723,7 @@ QPDFObjectHandle Objects::make_indirect(std::shared_ptr const& obj) { QPDFObjGen next{next_id()}; - obj_cache[next] = ObjCache(obj); + obj_cache[next] = Entry(obj); return qpdf.newIndirect(next, obj_cache[next].object); } diff --git a/libqpdf/qpdf/QPDF_objects.hh b/libqpdf/qpdf/QPDF_objects.hh index 9cf74fc6..a0388204 100644 --- a/libqpdf/qpdf/QPDF_objects.hh +++ b/libqpdf/qpdf/QPDF_objects.hh @@ -375,6 +375,18 @@ class QPDF::Objects qpdf_offset_t first_item_offset_{0}; // actual value from file }; // Xref_table; + struct Entry + { + Entry() = default; + + Entry(std::shared_ptr object) : + object(std::move(object)) + { + } + + std::shared_ptr object; + }; + Objects(QPDF& qpdf, QPDF::Members* m, InputSource* const& file) : qpdf(qpdf), file(file), @@ -407,7 +419,7 @@ class QPDF::Objects return xref.trailer(); } - std::map obj_cache; + std::map obj_cache; QPDFObjectHandle readObjectInStream(std::shared_ptr& input, int obj); QPDFObjectHandle read( diff --git a/libqpdf/qpdf/QPDF_private.hh b/libqpdf/qpdf/QPDF_private.hh index 405d0583..e628e053 100644 --- a/libqpdf/qpdf/QPDF_private.hh +++ b/libqpdf/qpdf/QPDF_private.hh @@ -72,19 +72,6 @@ class QPDF::Pipe } }; -class QPDF::ObjCache -{ - public: - ObjCache() = default; - - ObjCache(std::shared_ptr object) : - object(object) - { - } - - std::shared_ptr object; -}; - class QPDF::ObjCopier { public: