diff options
author | Lei Zhang <thestig@chromium.org> | 2017-12-11 14:34:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-11 14:34:58 +0000 |
commit | 4ecf9a855205d33491adf59c86e81548321542ee (patch) | |
tree | e1222f087667ead2242c278067b94bf7a82ece62 | |
parent | 69f2156c87da65a5e53e7d1197cec9c0ca431a40 (diff) | |
download | pdfium-4ecf9a855205d33491adf59c86e81548321542ee.tar.xz |
Get rid of default ctors for CPDF_Action and CPDF_AAction.
Change-Id: I45bac6e1b3fb9ae90feff1dc65c716beb2cab4c4
Reviewed-on: https://pdfium-review.googlesource.com/20771
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fpdfdoc/cpdf_aaction.cpp | 6 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_aaction.h | 1 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_action.cpp | 10 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_action.h | 1 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_bookmark.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_docjsactions.cpp | 8 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_formcontrol.cpp | 9 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_baannot.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 2 |
9 files changed, 14 insertions, 27 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")); diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index c551fee799..a1578804cf 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -346,7 +346,7 @@ CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { if (eAAT == CPDF_AAction::ButtonUp) return GetAction(); - return CPDF_Action(); + return CPDF_Action(nullptr); } void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) { diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 65b75ca844..ff82283516 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -1030,7 +1030,7 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { break; } - return CPDF_Action(); + return CPDF_Action(nullptr); } WideString CPDFSDK_Widget::GetAlternateName() const { |