diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.cpp | 16 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmark.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmarkitem.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_contentmarkitem.h | 8 |
4 files changed, 12 insertions, 22 deletions
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp index 0b17c2bc35..6021dc893d 100644 --- a/core/fpdfapi/page/cpdf_contentmark.cpp +++ b/core/fpdfapi/page/cpdf_contentmark.cpp @@ -72,12 +72,12 @@ size_t CPDF_ContentMark::MarkData::CountItems() const { const CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem( size_t index) const { - return m_Marks[index]; + return *m_Marks[index]; } int CPDF_ContentMark::MarkData::GetMarkedContentID() const { - for (const auto& mark : m_Marks) { - const CPDF_Dictionary* pDict = mark.GetParam(); + for (const auto pMark : m_Marks) { + const CPDF_Dictionary* pDict = pMark->GetParam(); if (pDict && pDict->KeyExist("MCID")) return pDict->GetIntegerFor("MCID"); } @@ -87,15 +87,15 @@ int CPDF_ContentMark::MarkData::GetMarkedContentID() const { void CPDF_ContentMark::MarkData::AddMark(ByteString name, const CPDF_Dictionary* pDict, bool bDirect) { - CPDF_ContentMarkItem item; - item.SetName(std::move(name)); + auto pItem = pdfium::MakeRetain<CPDF_ContentMarkItem>(); + pItem->SetName(std::move(name)); if (pDict) { if (bDirect) - item.SetDirectDict(ToDictionary(pDict->Clone())); + pItem->SetDirectDict(ToDictionary(pDict->Clone())); else - item.SetPropertiesDict(pDict); + pItem->SetPropertiesDict(pDict); } - m_Marks.push_back(std::move(item)); + m_Marks.push_back(pItem); } void CPDF_ContentMark::MarkData::DeleteLastMark() { diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h index 27116afeef..ac21151ede 100644 --- a/core/fpdfapi/page/cpdf_contentmark.h +++ b/core/fpdfapi/page/cpdf_contentmark.h @@ -46,7 +46,7 @@ class CPDF_ContentMark { void DeleteLastMark(); private: - std::vector<CPDF_ContentMarkItem> m_Marks; + std::vector<RetainPtr<CPDF_ContentMarkItem>> m_Marks; }; RetainPtr<MarkData> m_pMarkData; diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.cpp b/core/fpdfapi/page/cpdf_contentmarkitem.cpp index 205f14de35..4f56eea919 100644 --- a/core/fpdfapi/page/cpdf_contentmarkitem.cpp +++ b/core/fpdfapi/page/cpdf_contentmarkitem.cpp @@ -12,14 +12,6 @@ CPDF_ContentMarkItem::CPDF_ContentMarkItem() {} -CPDF_ContentMarkItem::CPDF_ContentMarkItem(const CPDF_ContentMarkItem& that) - : m_MarkName(that.m_MarkName), - m_ParamType(that.m_ParamType), - m_pPropertiesDict(that.m_pPropertiesDict) { - if (that.m_pDirectDict) - m_pDirectDict = ToDictionary(that.m_pDirectDict->Clone()); -} - CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {} const CPDF_Dictionary* CPDF_ContentMarkItem::GetParam() const { diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h index 5dcc7d480a..72548cef9c 100644 --- a/core/fpdfapi/page/cpdf_contentmarkitem.h +++ b/core/fpdfapi/page/cpdf_contentmarkitem.h @@ -12,19 +12,17 @@ #include "core/fxcrt/fx_memory.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" class CPDF_Dictionary; -class CPDF_ContentMarkItem { +class CPDF_ContentMarkItem : public Retainable { public: enum ParamType { None, PropertiesDict, DirectDict }; CPDF_ContentMarkItem(); - CPDF_ContentMarkItem(const CPDF_ContentMarkItem& that); - ~CPDF_ContentMarkItem(); - - CPDF_ContentMarkItem& operator=(CPDF_ContentMarkItem&& other) = default; + ~CPDF_ContentMarkItem() override; ByteString GetName() const { return m_MarkName; } ParamType GetParamType() const { return m_ParamType; } |