summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/xfa_basic_imp.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-06-23 12:14:55 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-23 12:14:55 -0700
commit6e12478cb298c3a8277493ee79ae0b73d6df8554 (patch)
tree46e28dbab97bbe41cca67ace9a3a05429c9cd519 /xfa/fxfa/parser/xfa_basic_imp.cpp
parentf7f659c2c98a4d02e3695266d33f449b7be01af9 (diff)
downloadpdfium-6e12478cb298c3a8277493ee79ae0b73d6df8554.tar.xz
Change XFA_GetElementByName to XFA_GetElementTypeForName
This method was only ever used to get the XFA_Element type for the given element name. Changed to make the signature match the usage. Review-Url: https://codereview.chromium.org/2095733002
Diffstat (limited to 'xfa/fxfa/parser/xfa_basic_imp.cpp')
-rw-r--r--xfa/fxfa/parser/xfa_basic_imp.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp
index 6896299a0e..67a110b4e5 100644
--- a/xfa/fxfa/parser/xfa_basic_imp.cpp
+++ b/xfa/fxfa/parser/xfa_basic_imp.cpp
@@ -174,9 +174,9 @@ CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement,
return CXFA_Measurement();
}
-const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) {
+XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName) {
if (wsName.IsEmpty())
- return nullptr;
+ return XFA_Element::Unknown;
uint32_t uHash = FX_HashCode_GetW(wsName, false);
int32_t iStart = 0;
@@ -184,15 +184,14 @@ const XFA_ELEMENTINFO* XFA_GetElementByName(const CFX_WideStringC& wsName) {
do {
int32_t iMid = (iStart + iEnd) / 2;
const XFA_ELEMENTINFO* pInfo = g_XFAElementData + iMid;
- if (uHash == pInfo->uHash) {
- return pInfo;
- } else if (uHash < pInfo->uHash) {
+ if (uHash == pInfo->uHash)
+ return pInfo->eName;
+ if (uHash < pInfo->uHash)
iEnd = iMid - 1;
- } else {
+ else
iStart = iMid + 1;
- }
} while (iStart <= iEnd);
- return nullptr;
+ return XFA_Element::Unknown;
}
const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName) {
return eName == XFA_Element::Unknown