summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_action.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_action.cpp')
-rw-r--r--core/fpdfdoc/cpdf_action.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index 4a89a7d9ff..49d143a1bd 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -36,14 +36,14 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
if (type != "GoTo" && type != "GoToR")
return CPDF_Dest();
- CPDF_Object* pDest = m_pDict->GetDirectObjectFor("D");
+ const CPDF_Object* pDest = m_pDict->GetDirectObjectFor("D");
if (!pDest)
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
CPDF_NameTree name_tree(pDoc, "Dests");
return CPDF_Dest(name_tree.LookupNamedDest(pDoc, pDest->GetUnicodeText()));
}
- if (CPDF_Array* pArray = pDest->AsArray())
+ if (const CPDF_Array* pArray = pDest->AsArray())
return CPDF_Dest(pArray);
return CPDF_Dest();
@@ -71,7 +71,7 @@ WideString CPDF_Action::GetFilePath() const {
return WideString();
}
- CPDF_Object* pFile = m_pDict->GetDirectObjectFor(pdfium::stream::kF);
+ const CPDF_Object* pFile = m_pDict->GetDirectObjectFor(pdfium::stream::kF);
if (pFile)
return CPDF_FileSpec(pFile).GetFileName();
@@ -108,7 +108,7 @@ WideString CPDF_Action::GetJavaScript() const {
if (!m_pDict)
return csJS;
- CPDF_Object* pJS = m_pDict->GetDirectObjectFor("JS");
+ const CPDF_Object* pJS = m_pDict->GetDirectObjectFor("JS");
return pJS ? pJS->GetUnicodeText() : csJS;
}
@@ -116,24 +116,23 @@ size_t CPDF_Action::GetSubActionsCount() const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return 0;
- CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
+ const CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
if (!pNext)
return 0;
if (pNext->IsDictionary())
return 1;
- if (CPDF_Array* pArray = pNext->AsArray())
- return pArray->GetCount();
- return 0;
+ const CPDF_Array* pArray = pNext->AsArray();
+ return pArray ? pArray->GetCount() : 0;
}
CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return CPDF_Action(nullptr);
- CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
- if (CPDF_Array* pArray = ToArray(pNext))
+ const CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
+ if (const CPDF_Array* pArray = ToArray(pNext))
return CPDF_Action(pArray->GetDictAt(iIndex));
- if (CPDF_Dictionary* pDict = ToDictionary(pNext)) {
+ if (const CPDF_Dictionary* pDict = ToDictionary(pNext)) {
if (iIndex == 0)
return CPDF_Action(pDict);
}