diff options
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 4402208900..ee2a6df071 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -145,10 +145,18 @@ WideString CXFA_Node::AttributeToName(XFA_Attribute attr) { // static XFA_Attribute CXFA_Node::NameToAttribute(const WideStringView& name) { - const XFA_ATTRIBUTEINFO* attr = XFA_GetAttributeByName(name); - if (!attr) + if (name.IsEmpty()) return XFA_Attribute::Unknown; - return attr->eName; + + auto* it = std::lower_bound(g_XFAAttributeData, + g_XFAAttributeData + g_iXFAAttributeCount, + FX_HashCode_GetW(name, false), + [](const XFA_ATTRIBUTEINFO& arg, uint32_t hash) { + return arg.uHash < hash; + }); + if (it != g_XFAAttributeData + g_iXFAAttributeCount && name == it->pName) + return it->eName; + return XFA_Attribute::Unknown; } CXFA_Node::CXFA_Node(CXFA_Document* pDoc, |