summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfdoc/cpdf_aaction.cpp6
-rw-r--r--core/fpdfdoc/cpdf_aaction.h1
-rw-r--r--core/fpdfdoc/cpdf_action.cpp10
-rw-r--r--core/fpdfdoc/cpdf_action.h1
-rw-r--r--core/fpdfdoc/cpdf_bookmark.cpp2
-rw-r--r--core/fpdfdoc/cpdf_docjsactions.cpp8
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp9
7 files changed, 12 insertions, 25 deletions
diff --git a/core/fpdfdoc/cpdf_aaction.cpp b/core/fpdfdoc/cpdf_aaction.cpp
index 08ff5541f3..e8e211c342 100644
--- a/core/fpdfdoc/cpdf_aaction.cpp
+++ b/core/fpdfdoc/cpdf_aaction.cpp
@@ -18,8 +18,6 @@ static_assert(FX_ArraySize(g_sAATypes) == CPDF_AAction::NumberOfActions,
} // namespace
-CPDF_AAction::CPDF_AAction() : CPDF_AAction(nullptr) {}
-
CPDF_AAction::CPDF_AAction(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
CPDF_AAction::CPDF_AAction(const CPDF_AAction& that) = default;
@@ -31,6 +29,6 @@ bool CPDF_AAction::ActionExist(AActionType eType) const {
}
CPDF_Action CPDF_AAction::GetAction(AActionType eType) const {
- return m_pDict ? CPDF_Action(m_pDict->GetDictFor(g_sAATypes[eType]))
- : CPDF_Action();
+ return CPDF_Action(m_pDict ? m_pDict->GetDictFor(g_sAATypes[eType])
+ : nullptr);
}
diff --git a/core/fpdfdoc/cpdf_aaction.h b/core/fpdfdoc/cpdf_aaction.h
index bfc67e5124..a5b0d25525 100644
--- a/core/fpdfdoc/cpdf_aaction.h
+++ b/core/fpdfdoc/cpdf_aaction.h
@@ -38,7 +38,6 @@ class CPDF_AAction {
NumberOfActions // Must be last.
};
- CPDF_AAction();
explicit CPDF_AAction(CPDF_Dictionary* pDict);
CPDF_AAction(const CPDF_AAction& that);
~CPDF_AAction();
diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp
index a3e2e23baf..383f328b9f 100644
--- a/core/fpdfdoc/cpdf_action.cpp
+++ b/core/fpdfdoc/cpdf_action.cpp
@@ -21,8 +21,6 @@ const char* const g_sATypes[] = {
} // namespace
-CPDF_Action::CPDF_Action() : CPDF_Action(nullptr) {}
-
CPDF_Action::CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
CPDF_Action::CPDF_Action(const CPDF_Action& that) = default;
@@ -128,14 +126,14 @@ size_t CPDF_Action::GetSubActionsCount() const {
CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
- return CPDF_Action();
+ return CPDF_Action(nullptr);
CPDF_Object* pNext = m_pDict->GetDirectObjectFor("Next");
+ if (CPDF_Array* pArray = ToArray(pNext))
+ return CPDF_Action(pArray->GetDictAt(iIndex));
if (CPDF_Dictionary* pDict = ToDictionary(pNext)) {
if (iIndex == 0)
return CPDF_Action(pDict);
- } else if (CPDF_Array* pArray = ToArray(pNext)) {
- return CPDF_Action(pArray->GetDictAt(iIndex));
}
- return CPDF_Action();
+ return CPDF_Action(nullptr);
}
diff --git a/core/fpdfdoc/cpdf_action.h b/core/fpdfdoc/cpdf_action.h
index 9b7f90d56b..1d9b722f40 100644
--- a/core/fpdfdoc/cpdf_action.h
+++ b/core/fpdfdoc/cpdf_action.h
@@ -37,7 +37,6 @@ class CPDF_Action {
GoTo3DView
};
- CPDF_Action();
explicit CPDF_Action(CPDF_Dictionary* pDict);
CPDF_Action(const CPDF_Action& that);
~CPDF_Action();
diff --git a/core/fpdfdoc/cpdf_bookmark.cpp b/core/fpdfdoc/cpdf_bookmark.cpp
index 884c3cb0b8..cc7e127d23 100644
--- a/core/fpdfdoc/cpdf_bookmark.cpp
+++ b/core/fpdfdoc/cpdf_bookmark.cpp
@@ -79,5 +79,5 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
}
CPDF_Action CPDF_Bookmark::GetAction() const {
- return m_pDict ? CPDF_Action(m_pDict->GetDictFor("A")) : CPDF_Action();
+ return CPDF_Action(m_pDict ? m_pDict->GetDictFor("A") : nullptr);
}
diff --git a/core/fpdfdoc/cpdf_docjsactions.cpp b/core/fpdfdoc/cpdf_docjsactions.cpp
index 974ca33b8b..91db2b0484 100644
--- a/core/fpdfdoc/cpdf_docjsactions.cpp
+++ b/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -22,17 +22,13 @@ CPDF_Action CPDF_DocJSActions::GetJSActionAndName(int index,
WideString* csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
- CPDF_Object* pAction = name_tree.LookupValueAndName(index, csName);
- return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
- : CPDF_Action();
+ return CPDF_Action(ToDictionary(name_tree.LookupValueAndName(index, csName)));
}
CPDF_Action CPDF_DocJSActions::GetJSAction(const WideString& csName) const {
ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument.Get(), "JavaScript");
- CPDF_Object* pAction = name_tree.LookupValue(csName);
- return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
- : CPDF_Action();
+ return CPDF_Action(ToDictionary(name_tree.LookupValue(csName)));
}
int CPDF_DocJSActions::FindJSAction(const WideString& csName) const {
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 5e24c5fb9e..384c35ea12 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -243,21 +243,18 @@ int CPDF_FormControl::GetTextPosition() {
CPDF_Action CPDF_FormControl::GetAction() {
if (!m_pWidgetDict)
- return CPDF_Action();
+ return CPDF_Action(nullptr);
if (m_pWidgetDict->KeyExist("A"))
return CPDF_Action(m_pWidgetDict->GetDictFor("A"));
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->GetDict(), "A");
- if (!pObj)
- return CPDF_Action();
-
- return CPDF_Action(pObj->GetDict());
+ return CPDF_Action(pObj ? pObj->GetDict() : nullptr);
}
CPDF_AAction CPDF_FormControl::GetAdditionalAction() {
if (!m_pWidgetDict)
- return CPDF_AAction();
+ return CPDF_AAction(nullptr);
if (m_pWidgetDict->KeyExist("AA"))
return CPDF_AAction(m_pWidgetDict->GetDictFor("AA"));