diff options
author | Lei Zhang <thestig@chromium.org> | 2018-05-28 17:51:28 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-05-28 17:51:28 +0000 |
commit | fffdeebfd0ed9806d32eb5609e0fdd015c25c5ac (patch) | |
tree | 7461043e508179a7d33b850486f312c58048e4a8 /core/fpdfdoc/cpdf_action.cpp | |
parent | 45a55241d315d25067582d29fcdc1ff8b818965f (diff) | |
download | pdfium-fffdeebfd0ed9806d32eb5609e0fdd015c25c5ac.tar.xz |
Add const/non-const versions of remaining CPDF_Dictionary methods.
GetObjectFor() and GetDirectObjectFor().
Change-Id: I588cd994dfccf0ffd4c8f91362a4806dc109251e
Reviewed-on: https://pdfium-review.googlesource.com/32991
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_action.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_action.cpp | 21 |
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); } |