From c8544d634a1993e2592e41458be215fcd0956031 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 19 Sep 2016 14:05:05 -0700 Subject: Make CPDF_IndirectObjectHolder use unique_ptr to objects The objects it is given are owned by it and are simply deleted without regard to Release() used by others. Review-Url: https://codereview.chromium.org/2350263002 --- core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h | 9 ++++----- core/fpdfapi/fpdf_parser/include/cpdf_object.h | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'core/fpdfapi/fpdf_parser/include') diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h index 57dafb0528..2abbda2a36 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h @@ -8,6 +8,7 @@ #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ #include +#include #include "core/fxcrt/include/fx_system.h" @@ -15,8 +16,8 @@ class CPDF_Object; class CPDF_IndirectObjectHolder { public: - using iterator = std::map::iterator; - using const_iterator = std::map::const_iterator; + using const_iterator = + std::map>::const_iterator; CPDF_IndirectObjectHolder(); virtual ~CPDF_IndirectObjectHolder(); @@ -33,9 +34,7 @@ class CPDF_IndirectObjectHolder { uint32_t GetLastObjNum() const { return m_LastObjNum; } void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; } - iterator begin() { return m_IndirectObjs.begin(); } const_iterator begin() const { return m_IndirectObjs.begin(); } - iterator end() { return m_IndirectObjs.end(); } const_iterator end() const { return m_IndirectObjs.end(); } protected: @@ -43,7 +42,7 @@ class CPDF_IndirectObjectHolder { private: uint32_t m_LastObjNum; - std::map m_IndirectObjs; + std::map> m_IndirectObjs; }; #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h index 115ce02200..de14503bbb 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h @@ -7,6 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ +#include #include #include "core/fxcrt/include/fx_string.h" @@ -92,6 +93,7 @@ class CPDF_Object { friend class CPDF_Parser; friend class CPDF_Reference; friend class CPDF_Stream; + friend struct std::default_delete; CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} virtual ~CPDF_Object(); -- cgit v1.2.3