From 6e12478cb298c3a8277493ee79ae0b73d6df8554 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 23 Jun 2016 12:14:55 -0700 Subject: 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 --- xfa/fxfa/parser/xfa_basic_imp.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'xfa/fxfa/parser/xfa_basic_imp.cpp') 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 -- cgit v1.2.3