diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-05-23 16:18:28 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-24 01:28:39 +0000 |
commit | 033e565d8244953afe8eab3d0c7ee1ed9863c921 (patch) | |
tree | 410cbe152379180ff2fd3411b289be6fa31e3c82 /core/fpdfdoc/cpdf_nametree.cpp | |
parent | 655c783b8077f18e17418a3aab9b5a07c8055049 (diff) | |
download | pdfium-033e565d8244953afe8eab3d0c7ee1ed9863c921.tar.xz |
Convert to CFX_UnownedPtr, part 5
Change-Id: Ibdb20fca7e4daae9d61286df4801ac02faf3b281
Reviewed-on: https://pdfium-review.googlesource.com/5831
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_nametree.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_nametree.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp index 5ecdb4863b..b3808bddba 100644 --- a/core/fpdfdoc/cpdf_nametree.cpp +++ b/core/fpdfdoc/cpdf_nametree.cpp @@ -136,6 +136,8 @@ size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { } // namespace +CPDF_NameTree::CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} + CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category) : m_pRoot(nullptr) { @@ -150,8 +152,10 @@ CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, m_pRoot = pNames->GetDictFor(category); } +CPDF_NameTree::~CPDF_NameTree() {} + size_t CPDF_NameTree::GetCount() const { - return m_pRoot ? ::CountNames(m_pRoot) : 0; + return m_pRoot ? ::CountNames(m_pRoot.Get()) : 0; } int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const { @@ -159,7 +163,7 @@ int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const { return -1; size_t nIndex = 0; - if (!SearchNameNode(m_pRoot, csName, nIndex, nullptr)) + if (!SearchNameNode(m_pRoot.Get(), csName, nIndex, nullptr)) return -1; return nIndex; } @@ -171,7 +175,7 @@ CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex, return nullptr; size_t nCurIndex = 0; - return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, nullptr); + return SearchNameNode(m_pRoot.Get(), nIndex, nCurIndex, csName, nullptr); } CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const { @@ -179,7 +183,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const { return nullptr; size_t nIndex = 0; - return SearchNameNode(m_pRoot, csName, nIndex, nullptr); + return SearchNameNode(m_pRoot.Get(), csName, nIndex, nullptr); } CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, |