diff options
Diffstat (limited to 'fxjs')
-rw-r--r-- | fxjs/cjx_node.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index fe1612d022..338a160e77 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -244,7 +244,7 @@ pdfium::Optional<WideString> CJX_Node::TryAttribute(XFA_Attribute eAttr, if (!value) return {}; - return {GetAttributeEnumByID(*value)->pName}; + return {CXFA_Node::AttributeEnumToName(*value)}; } case XFA_AttributeType::CData: return TryCData(eAttr, bUseDefault); @@ -1756,13 +1756,8 @@ void CJX_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, return; } - const XFA_ATTRIBUTEENUMINFO* pInfo = - GetAttributeEnumByID(validateData.GetNullTest()); - if (!pInfo) { - pValue->SetString(""); - return; - } - pValue->SetString(WideString(pInfo->pName).UTF8Encode().AsStringView()); + WideString str = CXFA_Node::AttributeEnumToName(validateData.GetNullTest()); + pValue->SetString(str.UTF8Encode().AsStringView()); } void CJX_Node::Script_Som_MandatoryMessage(CFXJSE_Value* pValue, @@ -3202,7 +3197,8 @@ bool CJX_Node::SetValue(XFA_Attribute eAttr, case XFA_AttributeType::Enum: elem->SetString( CXFA_Node::AttributeToName(eAttr), - GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)->pName); + CXFA_Node::AttributeEnumToName(static_cast<XFA_ATTRIBUTEENUM>( + reinterpret_cast<uintptr_t>(pValue)))); break; case XFA_AttributeType::Boolean: elem->SetString(CXFA_Node::AttributeToName(eAttr), pValue ? L"1" : L"0"); |