diff options
Diffstat (limited to 'core/fpdfapi/fpdf_page/cpdf_contentmark.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_contentmark.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp b/core/fpdfapi/fpdf_page/cpdf_contentmark.cpp index 99a16004cd..1c47f00182 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() { |