diff options
Diffstat (limited to 'core/fpdfdoc/cpdf_numbertree.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_numbertree.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_numbertree.cpp b/core/fpdfdoc/cpdf_numbertree.cpp index 952fb4ef1d..74aeb67e85 100644 --- a/core/fpdfdoc/cpdf_numbertree.cpp +++ b/core/fpdfdoc/cpdf_numbertree.cpp @@ -11,13 +11,13 @@ namespace { -CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { - CPDF_Array* pLimits = pNode->GetArrayFor("Limits"); +const CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { + const CPDF_Array* pLimits = pNode->GetArrayFor("Limits"); if (pLimits && (num < pLimits->GetIntegerAt(0) || num > pLimits->GetIntegerAt(1))) { return nullptr; } - CPDF_Array* pNumbers = pNode->GetArrayFor("Nums"); + const CPDF_Array* pNumbers = pNode->GetArrayFor("Nums"); if (pNumbers) { for (size_t i = 0; i < pNumbers->GetCount() / 2; i++) { int index = pNumbers->GetIntegerAt(i * 2); @@ -29,16 +29,16 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { return nullptr; } - CPDF_Array* pKids = pNode->GetArrayFor("Kids"); + const CPDF_Array* pKids = pNode->GetArrayFor("Kids"); if (!pKids) return nullptr; for (size_t i = 0; i < pKids->GetCount(); i++) { - CPDF_Dictionary* pKid = pKids->GetDictAt(i); + const CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; - CPDF_Object* pFound = SearchNumberNode(pKid, num); + const CPDF_Object* pFound = SearchNumberNode(pKid, num); if (pFound) return pFound; } @@ -47,10 +47,11 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { } // namespace -CPDF_NumberTree::CPDF_NumberTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} +CPDF_NumberTree::CPDF_NumberTree(const CPDF_Dictionary* pRoot) + : m_pRoot(pRoot) {} CPDF_NumberTree::~CPDF_NumberTree() {} -CPDF_Object* CPDF_NumberTree::LookupValue(int num) const { +const CPDF_Object* CPDF_NumberTree::LookupValue(int num) const { return SearchNumberNode(m_pRoot.Get(), num); } |