Index: core/fpdfapi/fpdf_page/cpdf_contentmark.cpp |
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp |
index 99a16004cd7dd9408ba6d38e59659b37ce2eccd9..1c47f0018265a18f9a189bb534330666d7718ee2 100644 |
--- a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp |
+++ b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp |
@@ -66,11 +66,7 @@ bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, |
for (int i = 0; i < pData->CountItems(); i++) { |
const CPDF_ContentMarkItem& item = pData->GetItem(i); |
if (item.GetName() == mark) { |
- pDict = nullptr; |
- if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || |
- item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { |
- pDict = item.GetParam(); |
- } |
+ pDict = item.GetParam(); |
return true; |
} |
} |
@@ -99,13 +95,9 @@ const CPDF_ContentMarkItem& CPDF_ContentMark::MarkData::GetItem( |
int CPDF_ContentMark::MarkData::GetMCID() const { |
for (const auto& mark : m_Marks) { |
- CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); |
- if (type == CPDF_ContentMarkItem::PropertiesDict || |
- type == CPDF_ContentMarkItem::DirectDict) { |
- CPDF_Dictionary* pDict = mark.GetParam(); |
- if (pDict->KeyExist("MCID")) |
- return pDict->GetIntegerFor("MCID"); |
- } |
+ CPDF_Dictionary* pDict = mark.GetParam(); |
+ if (pDict && pDict->KeyExist("MCID")) |
+ return pDict->GetIntegerFor("MCID"); |
} |
return -1; |
} |
@@ -117,13 +109,14 @@ void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name, |
item.SetName(name); |
if (pDict) { |
if (bDirect) { |
- item.SetParam(CPDF_ContentMarkItem::DirectDict, |
- ToDictionary(pDict->Clone())); |
+ item.SetDirectDict( |
+ std::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>>( |
+ ToDictionary(pDict->Clone()))); |
} else { |
- item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict); |
+ item.SetPropertiesDict(pDict); |
} |
} |
- m_Marks.push_back(item); |
+ m_Marks.push_back(std::move(item)); |
} |
void CPDF_ContentMark::MarkData::DeleteLastMark() { |