summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_nametree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_nametree.cpp')
-rw-r--r--core/fpdfdoc/cpdf_nametree.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp
index b8d1eb0ab1..5ecdb4863b 100644
--- a/core/fpdfdoc/cpdf_nametree.cpp
+++ b/core/fpdfdoc/cpdf_nametree.cpp
@@ -78,7 +78,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
size_t nIndex,
size_t& nCurIndex,
- CFX_ByteString& csName,
+ CFX_ByteString* csName,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion)
@@ -93,7 +93,7 @@ CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
if (ppFind)
*ppFind = pNames;
- csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
+ *csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1);
}
CPDF_Array* pKids = pNode->GetArrayFor("Kids");
@@ -164,10 +164,12 @@ int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
return nIndex;
}
-CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
- CFX_ByteString& csName) const {
+CPDF_Object* CPDF_NameTree::LookupValueAndName(int nIndex,
+ CFX_ByteString* csName) const {
+ *csName = CFX_ByteString();
if (!m_pRoot)
return nullptr;
+
size_t nCurIndex = 0;
return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, nullptr);
}
@@ -175,6 +177,7 @@ CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
if (!m_pRoot)
return nullptr;
+
size_t nIndex = 0;
return SearchNameNode(m_pRoot, csName, nIndex, nullptr);
}