From fc58ad18b7ab32e7b0bb3959b07dbe7538a7cebd Mon Sep 17 00:00:00 2001 From: tsepez Date: Tue, 5 Apr 2016 12:22:15 -0700 Subject: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. Companion to https://codereview.chromium.org/1853233002 BUG= Review URL: https://codereview.chromium.org/1857073002 --- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 22 +++--- xfa/fxfa/parser/xfa_document_serialize.cpp | 2 +- xfa/fxfa/parser/xfa_layout_itemlayout.cpp | 2 +- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 4 +- xfa/fxfa/parser/xfa_locale.cpp | 6 +- xfa/fxfa/parser/xfa_localemgr.cpp | 4 +- xfa/fxfa/parser/xfa_localevalue.cpp | 8 ++- xfa/fxfa/parser/xfa_object_imp.cpp | 80 +++++++++++++--------- xfa/fxfa/parser/xfa_objectacc_imp.cpp | 34 ++++----- xfa/fxfa/parser/xfa_parser_imp.cpp | 36 +++++----- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 31 +++++---- xfa/fxfa/parser/xfa_script_imp.cpp | 40 ++++++----- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 5 +- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 15 ++-- .../parser/xfa_script_signaturepseudomodel.cpp | 5 +- 16 files changed, 168 insertions(+), 128 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index a5f021aacd..a28b4994ab 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -131,7 +131,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFDE_XMLElement* pXMLDataElement = static_cast(pDataNode->GetXMLMappingNode()); FXSYS_assert(pXMLDataElement); - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); if (!wsHref.IsEmpty()) { @@ -160,7 +161,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); } } else if (!wsValue.IsEmpty()) { - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); } break; @@ -169,7 +171,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) { break; } - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); break; case XFA_ELEMENT_ExclGroup: { @@ -239,7 +242,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFX_WideString wsOutput; pWidgetData->NormalizeNumStr(wsValue, wsOutput); wsValue = wsOutput; - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); CXFA_Node* pValue = pFormNode->GetProperty(0, XFA_ELEMENT_Value); XFA_DataMerge_FormValueNode_SetChildContent(pValue, wsValue, @@ -250,7 +254,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, if (wsValue.IsEmpty()) { break; } - pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatedValue); pDataNode->SetAttributeValue(wsValue, wsFormatedValue); break; } @@ -258,7 +263,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFX_WideString wsXMLValue; pDataNode->TryContent(wsXMLValue); CFX_WideString wsNormailizeValue; - pWidgetData->GetNormalizeDataValue(wsXMLValue, wsNormailizeValue); + pWidgetData->GetNormalizeDataValue(wsXMLValue.AsWideStringC(), + wsNormailizeValue); pDataNode->SetAttributeValue(wsNormailizeValue, wsXMLValue); switch (eUIType) { case XFA_ELEMENT_ImageEdit: { @@ -312,8 +318,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_Text); break; case XFA_ELEMENT_ExclGroup: { - pWidgetData->SetSelectedMemberByValue(wsNormailizeValue, bNotify, FALSE, - FALSE); + pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsWideStringC(), + bNotify, FALSE, FALSE); } break; case XFA_ELEMENT_DateTimeEdit: XFA_DataMerge_FormValueNode_SetChildContent( diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index 2ae82e3c35..39590f6e8f 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -297,7 +297,7 @@ static void XFA_DataExporter_RegenerateFormFile_Changed( buf << FX_WSTRC(L" xmlns=\"\"\n>"); for (int32_t i = 0; i < wsSelTextArray.GetSize(); i++) { buf << FX_WSTRC(L""); - buf << XFA_ExportEncodeContent(wsSelTextArray[i]); + buf << XFA_ExportEncodeContent(wsSelTextArray[i].AsWideStringC()); buf << FX_WSTRC(L""); } buf << FX_WSTRC(L"GetNodeByID( ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)), - wsTargetExpr.Mid(1)); + wsTargetExpr.Mid(1).AsWideStringC()); if (pNode) { return pNode; } @@ -309,7 +309,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot, } XFA_RESOLVENODE_RS rs; int32_t iCount = pDocument->GetScriptContext()->ResolveObjects( - pPageSetRoot, wsProcessedTarget, rs, + pPageSetRoot, wsProcessedTarget.AsWideStringC(), rs, XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes | XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent); diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index 141e295be9..c77dc2637d 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -79,7 +79,7 @@ void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, } GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, bsSymbols.GetLength() - 1), - wsName, wsNumSymbol); + wsName.AsWideStringC(), wsNumSymbol); } void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { if (!m_pLocaleData) { @@ -162,7 +162,7 @@ void CXFA_XMLLocale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType, wsName = L"long"; break; } - GetPattern(pElement, "datePattern", wsName, wsPattern); + GetPattern(pElement, "datePattern", wsName.AsWideStringC(), wsPattern); } void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, CFX_WideString& wsPattern) const { @@ -186,7 +186,7 @@ void CXFA_XMLLocale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType, wsName = L"long"; break; } - GetPattern(pElement, "timePattern", wsName, wsPattern); + GetPattern(pElement, "timePattern", wsName.AsWideStringC(), wsPattern); } void CXFA_XMLLocale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType, CFX_WideString& wsPattern) const { diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 7ccf228177..0c09830094 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1132,7 +1132,7 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); } } - m_pDefLocale = GetLocaleByName(wsDeflcid); + m_pDefLocale = GetLocaleByName(wsDeflcid.AsWideStringC()); } CXFA_LocaleMgr::~CXFA_LocaleMgr() { int32_t iCount = m_LocaleArray.GetSize(); @@ -1266,7 +1266,7 @@ CFX_WideStringC CXFA_LocaleMgr::GetConfigLocaleName(CXFA_Node* pConfig) { } m_dwLocaleFlags |= 0x01; } - return m_wsConfigLocale; + return m_wsConfigLocale.AsWideStringC(); } static CXFA_TimeZoneProvider* g_pProvider = NULL; diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 3c85622b0d..99738c60ae 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -369,7 +369,8 @@ CFX_Unitime CXFA_LocaleValue::GetTime() const { if (m_bValid && m_dwType == XFA_VT_TIME) { CFX_Unitime dt(0); FXSYS_assert(m_pLocaleMgr); - FX_TimeFromCanonical(m_wsValue, dt, m_pLocaleMgr->GetDefLocale()); + FX_TimeFromCanonical(m_wsValue.AsWideStringC(), dt, + m_pLocaleMgr->GetDefLocale()); return dt; } return CFX_Unitime(); @@ -380,8 +381,9 @@ CFX_Unitime CXFA_LocaleValue::GetDateTime() const { CFX_Unitime dt; FX_DateFromCanonical(m_wsValue.Left(index), dt); FXSYS_assert(m_pLocaleMgr); - FX_TimeFromCanonical(m_wsValue.Right(m_wsValue.GetLength() - index - 1), dt, - m_pLocaleMgr->GetDefLocale()); + FX_TimeFromCanonical( + m_wsValue.Right(m_wsValue.GetLength() - index - 1).AsWideStringC(), dt, + m_pLocaleMgr->GetDefLocale()); return dt; } return CFX_Unitime(); diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 4c3ecd2976..1dd526571d 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -648,8 +648,8 @@ void CXFA_Node::Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments) { XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1) { return FXJSE_Value_SetNull(pArguments->GetReturnValue()); } @@ -708,7 +708,8 @@ void CXFA_Node::Script_Som_ResolveNodeList(FXJSE_HVALUE hValue, if (refNode == NULL) { refNode = this; } - pScriptContext->ResolveObjects(refNode, wsExpression, resoveNodeRS, dwFlag); + pScriptContext->ResolveObjects(refNode, wsExpression.AsWideStringC(), + resoveNodeRS, dwFlag); CXFA_ArrayNodeList* pNodeList = new CXFA_ArrayNodeList(m_pDocument); if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { for (int32_t i = 0; i < resoveNodeRS.nodes.GetSize(); i++) { @@ -878,7 +879,7 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) { wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); CFX_WideString wsValue; - GetAttribute(wsExpression, wsValue); + GetAttribute(wsExpression.AsWideStringC(), wsValue); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC()); @@ -900,7 +901,8 @@ void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) { if (iLength >= 2) { iValue = pArguments->GetInt32(1); } - const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = + XFA_GetElementByName(wsExpression.AsWideStringC()); CXFA_Node* pNode = GetProperty(iValue, pElementInfo->eName); FXJSE_Value_Set(pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); @@ -929,13 +931,14 @@ void CXFA_Node::Script_NodeClass_IsPropertySpecified( } FX_BOOL bHas = FALSE; const XFA_ATTRIBUTEINFO* pAttributeInfo = - XFA_GetAttributeByName(wsExpression); + XFA_GetAttributeByName(wsExpression.AsWideStringC()); CFX_WideString wsValue; if (pAttributeInfo) { bHas = HasAttribute(pAttributeInfo->eName); } if (!bHas) { - const XFA_ELEMENTINFO* pElementInfo = XFA_GetElementByName(wsExpression); + const XFA_ELEMENTINFO* pElementInfo = + XFA_GetElementByName(wsExpression.AsWideStringC()); bHas = (GetProperty(iIndex, pElementInfo->eName) != NULL); } FXJSE_HVALUE hValue = pArguments->GetReturnValue(); @@ -1158,7 +1161,8 @@ void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) { wsAttributeValue = CFX_WideString::FromUTF8(bsAttributeValue, bsAttributeValue.GetLength()); wsAttribute = CFX_WideString::FromUTF8(bsAttribute, bsAttribute.GetLength()); - SetAttribute(wsAttribute, wsAttributeValue, TRUE); + SetAttribute(wsAttribute.AsWideStringC(), wsAttributeValue.AsWideStringC(), + TRUE); } void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); @@ -1483,7 +1487,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, FXJSE_Value_ToUTF8String(hValue, szValue); CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue, szValue.GetLength()); - SetAttribute(eAttribute, wsValue, TRUE); + SetAttribute(eAttribute, wsValue.AsWideStringC(), TRUE); if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { CFX_WideString wsUseVal = wsValue, wsID, wsSOM; CXFA_Node* pTemplateNode = @@ -1508,12 +1512,12 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = m_pDocument->GetScriptContext()->ResolveObjects( - pProtoRoot, wsSOM, resoveNodeRS, dwFlag); + pProtoRoot, wsSOM.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet > 0 && resoveNodeRS.nodes[0]->IsNode()) { pProtoNode = resoveNodeRS.nodes[0]->AsNode(); } } else if (!wsID.IsEmpty()) { - pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID); + pProtoNode = m_pDocument->GetNodeByID(pProtoRoot, wsID.AsWideStringC()); } if (pProtoNode) { CXFA_Node* pHeadChild = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -1701,7 +1705,8 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue, pContainerWidgetData = GetContainerWidgetData(); } if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), + wsFormatValue); } SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); } else { @@ -1712,7 +1717,7 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue, } else if (classID == XFA_ELEMENT_Integer) { FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( @@ -1748,7 +1753,8 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsNewValue.AsWideStringC(), + wsFormatValue); } SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); } else { @@ -1891,7 +1897,7 @@ void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue, wsThickness = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); for (int32_t i = 0; i < iSize; ++i) { CXFA_Edge edge = border.GetEdge(i); - CXFA_Measurement thickness(wsThickness); + CXFA_Measurement thickness(wsThickness.AsWideStringC()); edge.SetMSThickness(thickness); } } else { @@ -2008,7 +2014,8 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); CFX_WideString wsFormatText(wsNewText); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText); + pContainerWidgetData->GetFormatDataValue(wsNewText.AsWideStringC(), + wsFormatText); } SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); } else { @@ -2027,7 +2034,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC()); } else { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { @@ -2035,7 +2042,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { - CFX_Decimal decimal(content); + CFX_Decimal decimal(content.AsWideStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( @@ -2183,7 +2190,8 @@ void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); int32_t iRet = execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_Field); if (eventString == "validate") { FXJSE_Value_SetBoolean(pArguments->GetReturnValue(), @@ -2263,7 +2271,7 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) { CFX_WideString wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()); CFX_WideString wsBoundValue; - pWidgetData->GetItemValue(wsValue, wsBoundValue); + pWidgetData->GetItemValue(wsValue.AsWideStringC(), wsBoundValue); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, @@ -2407,7 +2415,8 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(FXJSE_HVALUE hValue, CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pWidgetData->SetSelectedMemberByValue( - CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()), TRUE, TRUE); + CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC(), + TRUE, TRUE); } else { CFX_WideString wsValue = GetScriptContent(TRUE); XFA_VERSION curVersion = GetDocument()->GetCurVersionMode(); @@ -2426,7 +2435,8 @@ void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_ExclGroup); } else { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); @@ -2446,7 +2456,8 @@ void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) { CFX_ByteString szName; szName = pArguments->GetUTF8String(0); pReturnNode = pWidgetData->SetSelectedMember( - CFX_WideString::FromUTF8(szName, szName.GetLength())); + CFX_WideString::FromUTF8(szName, szName.GetLength()) + .AsWideStringC()); } if (pReturnNode) { FXJSE_Value_Set( @@ -2622,7 +2633,8 @@ void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { if (argc == 1) { CFX_ByteString eventString = pArguments->GetUTF8String(0); execSingleEventByName( - CFX_WideString::FromUTF8(eventString, eventString.GetLength()), + CFX_WideString::FromUTF8(eventString, eventString.GetLength()) + .AsWideStringC(), XFA_ELEMENT_Subform); } else { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent"); @@ -2738,7 +2750,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { CFX_WideString::FromUTF8(bsNameSpace, bsNameSpace.GetLength()); } } - const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(strTagName); + const XFA_ELEMENTINFO* pElement = + XFA_GetElementByName(strTagName.AsWideStringC()); CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); if (!pNewNode) { FXJSE_Value_SetNull(pArguments->GetReturnValue()); @@ -2746,7 +2759,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { if (!strName.IsEmpty()) { if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, XFA_XDPPACKET_UNKNOWN)) { - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName, TRUE); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsWideStringC(), + TRUE); if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { pNewNode->CreateXMLMappingNode(); } @@ -3504,7 +3518,8 @@ void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, CFX_ByteString bsChecksum; FXJSE_Value_ToUTF8String(hValue, bsChecksum); SetAttribute(XFA_ATTRIBUTE_Checksum, - CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength())); + CFX_WideString::FromUTF8(bsChecksum, bsChecksum.GetLength()) + .AsWideStringC()); } else { CFX_WideString wsChecksum; GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); @@ -3964,7 +3979,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, CFX_WideString* pClone = new CFX_WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); } else { - SetMapModuleString(pKey, wsValue); + SetMapModuleString(pKey, wsValue.AsWideStringC()); if (eAttr == XFA_ATTRIBUTE_Name) UpdateNameHash(); } @@ -4321,7 +4336,8 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); if (wsContentType == FX_WSTRC(L"text/html")) { wsContentType = FX_WSTRC(L""); - SetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType); + SetAttribute(XFA_ATTRIBUTE_ContentType, + wsContentType.AsWideStringC()); } } CXFA_Node* pContentRawDataNode = GetNodeItem(XFA_NODEITEM_FirstChild); @@ -5233,7 +5249,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) { CFX_WideString wsFormatValue(wsValue); CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); if (pWidgetData) { - pWidgetData->GetFormatDataValue(wsValue, wsFormatValue); + pWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), wsFormatValue); } pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); } @@ -5332,8 +5348,8 @@ void CXFA_NodeList::Script_TreelistClass_NamedItem( int32_t argc = pArguments->GetLength(); if (argc == 1) { CFX_ByteString szName = pArguments->GetUTF8String(0); - CXFA_Node* pNode = - NamedItem(CFX_WideString::FromUTF8(szName, szName.GetLength())); + CXFA_Node* pNode = NamedItem( + CFX_WideString::FromUTF8(szName, szName.GetLength()).AsWideStringC()); if (!pNode) { return; } diff --git a/xfa/fxfa/parser/xfa_objectacc_imp.cpp b/xfa/fxfa/parser/xfa_objectacc_imp.cpp index 94657c6e50..22f8fc2b34 100644 --- a/xfa/fxfa/parser/xfa_objectacc_imp.cpp +++ b/xfa/fxfa/parser/xfa_objectacc_imp.cpp @@ -477,7 +477,7 @@ FX_BOOL CXFA_Image::SetHref(const CFX_WideString& wsHref) { if (m_bDefValue) { return m_pNode->SetCData(XFA_ATTRIBUTE_Href, wsHref); } - return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref); + return m_pNode->SetAttribute(XFA_ATTRIBUTE_Href, wsHref.AsWideStringC()); } FX_BOOL CXFA_Image::SetTransferEncoding(int32_t iTransferEncoding) { if (m_bDefValue) { @@ -510,7 +510,8 @@ int32_t CXFA_Validate::GetFormatTest() { FX_BOOL CXFA_Validate::SetTestValue(int32_t iType, CFX_WideString& wsValue, XFA_ATTRIBUTEENUM eName) { - const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByName(wsValue); + const XFA_ATTRIBUTEENUMINFO* pInfo = + XFA_GetAttributeEnumByName(wsValue.AsWideStringC()); if (pInfo) { eName = pInfo->eName; } @@ -1590,7 +1591,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex, if (iSel < 0) { CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; CFX_WideString wsFormatText(wsSaveText); - GetFormatDataValue(wsSaveText, wsFormatText); + GetFormatDataValue(wsSaveText.AsWideStringC(), wsFormatText); m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, bSyncData); } @@ -1619,7 +1620,7 @@ void CXFA_WidgetData::SetSelectdItems(CFX_Int32Array& iSelArray, } CFX_WideString wsFormat(wsValue); if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) { - GetFormatDataValue(wsValue, wsFormat); + GetFormatDataValue(wsValue.AsWideStringC(), wsFormat); } m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData); } @@ -1656,19 +1657,19 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, if (iCount < 1) { CXFA_Node* pItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); m_pNode->InsertChild(-1, pItems); - InsertListTextItem(pItems, wsLabel, nIndex); + InsertListTextItem(pItems, wsLabel.AsWideStringC(), nIndex); CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); m_pNode->InsertChild(-1, pSaveItems); pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); - InsertListTextItem(pSaveItems, wsNewValue, nIndex); + InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex); } else if (iCount > 1) { for (int32_t i = 0; i < 2; i++) { CXFA_Node* pNode = listitems[i]; FX_BOOL bHasSave = pNode->GetBoolean(XFA_ATTRIBUTE_Save); if (bHasSave) { - InsertListTextItem(pNode, wsNewValue, nIndex); + InsertListTextItem(pNode, wsNewValue.AsWideStringC(), nIndex); } else { - InsertListTextItem(pNode, wsLabel, nIndex); + InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex); } } } else { @@ -1685,12 +1686,12 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, while (pListNode) { CFX_WideString wsOldValue; pListNode->TryContent(wsOldValue); - InsertListTextItem(pSaveItems, wsOldValue, i); + InsertListTextItem(pSaveItems, wsOldValue.AsWideStringC(), i); i++; pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - InsertListTextItem(pNode, wsLabel, nIndex); - InsertListTextItem(pSaveItems, wsNewValue, nIndex); + InsertListTextItem(pNode, wsLabel.AsWideStringC(), nIndex); + InsertListTextItem(pSaveItems, wsNewValue.AsWideStringC(), nIndex); } if (!bNotify) { return; @@ -2101,7 +2102,7 @@ CFX_WideString XFA_NumericLimit(const CFX_WideString& wsValue, iTread_++; if (iTread_ > iTread) { if (iTread != -1) { - CFX_Decimal wsDeci = CFX_Decimal(wsValue); + CFX_Decimal wsDeci = CFX_Decimal(wsValue.AsWideStringC()); wsDeci.SetScale(iTread); wsRet = wsDeci; } @@ -2276,8 +2277,8 @@ IFX_Locale* CXFA_WidgetData::GetLocal() { if (wsLocaleName == FX_WSTRC(L"ambient")) { pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetDefLocale(); } else { - pLocale = - m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); + pLocale = m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName( + wsLocaleName.AsWideStringC()); } } return pLocale; @@ -2332,7 +2333,7 @@ FX_BOOL CXFA_WidgetData::GetValue(CFX_WideString& wsValue, wsValue = m_pNode->GetContent(); if (eValueType == XFA_VALUEPICTURE_Display) - GetItemLabel(wsValue, wsValue); + GetItemLabel(wsValue.AsWideStringC(), wsValue); CFX_WideString wsPicture; GetPictureContent(wsPicture, eValueType); @@ -2575,7 +2576,8 @@ void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, CFX_WideString wsFormatValue(wsValue); CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); if (pContainerWidgetData) { - pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue); + pContainerWidgetData->GetFormatDataValue(wsValue.AsWideStringC(), + wsFormatValue); } m_pNode->SetContent(wsValue, wsFormatValue, bNotify); } diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index f4a479d7c3..4c831d5b8f 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -225,8 +225,8 @@ static inline void XFA_FDEExtension_GetElementTagNamespaceURI( CFX_WideString& wsNamespaceURI) { CFX_WideString wsNodeStr; pElement->GetNamespacePrefix(wsNodeStr); - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNodeStr, - wsNamespaceURI)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNodeStr.AsWideStringC(), wsNamespaceURI)) { wsNamespaceURI.Empty(); } } @@ -283,8 +283,8 @@ static FX_BOOL XFA_FDEExtension_ResolveAttribute( wsNSPrefix == FX_WSTRC(L"xmlns") || wsNSPrefix == FX_WSTRC(L"xml")) { return FALSE; } - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix, - wsNamespaceURI)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNSPrefix.AsWideStringC(), wsNamespaceURI)) { wsNamespaceURI.Empty(); return FALSE; } @@ -318,8 +318,8 @@ static FX_BOOL XFA_FDEExtension_FindAttributeWithNS( } wsNSPrefix = wsAttrName.Left(iFind); } - if (!XFA_FDEExtension_ResolveNamespaceQualifier(pElement, wsNSPrefix, - wsAttrNS)) { + if (!XFA_FDEExtension_ResolveNamespaceQualifier( + pElement, wsNSPrefix.AsWideStringC(), wsAttrNS)) { continue; } if (bMatchNSAsPrefix) { @@ -433,7 +433,8 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( reinterpret_cast(pChildItem); CFX_WideString wsPacketName; pElement->GetLocalTagName(wsPacketName); - const XFA_PACKETINFO* pPacketInfo = XFA_GetPacketByName(wsPacketName); + const XFA_PACKETINFO* pPacketInfo = + XFA_GetPacketByName(wsPacketName.AsWideStringC()); if (pPacketInfo && pPacketInfo->pURI) { if (!XFA_FDEExtension_MatchNodeName(pElement, pPacketInfo->pName, pPacketInfo->pURI, @@ -585,7 +586,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_TemplateForm( } pNode->SetCData(XFA_ATTRIBUTE_Name, XFA_GetPacketByIndex(XFA_PACKET_Form)->pName); - pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum); + pNode->SetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum.AsWideStringC()); CXFA_Node* pTemplateRoot = m_pRootNode->GetFirstChildByClass(XFA_ELEMENT_Template); CXFA_Node* pTemplateChosen = @@ -821,7 +822,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, CFDE_XMLElement* pXMLElement = static_cast(pXMLChild); CFX_WideString wsTagName; pXMLElement->GetLocalTagName(wsTagName); - const XFA_ELEMENTINFO* pElemInfo = XFA_GetElementByName(wsTagName); + const XFA_ELEMENTINFO* pElemInfo = + XFA_GetElementByName(wsTagName.AsWideStringC()); if (!pElemInfo) { continue; } @@ -841,7 +843,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, return NULL; } if (ePacketID == XFA_XDPPACKET_Config) { - pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, wsTagName); + pXFAChild->SetAttribute(XFA_ATTRIBUTE_Name, + wsTagName.AsWideStringC()); } FX_BOOL IsNeedValue = TRUE; for (int32_t i = 0, count = pXMLElement->CountAttributes(); i < count; @@ -850,14 +853,14 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, CFX_WideString wsAttrName; CFX_WideString wsAttrValue; pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue); - XFA_FDEExtension_GetAttributeLocalName(wsAttrQualifiedName, - wsAttrName); + XFA_FDEExtension_GetAttributeLocalName( + wsAttrQualifiedName.AsWideStringC(), wsAttrName); if (wsAttrName == FX_WSTRC(L"nil") && wsAttrValue == FX_WSTRC(L"true")) { IsNeedValue = FALSE; } const XFA_ATTRIBUTEINFO* lpAttrInfo = - XFA_GetAttributeByName(wsAttrName); + XFA_GetAttributeByName(wsAttrName.AsWideStringC()); if (!lpAttrInfo) { continue; } @@ -865,7 +868,8 @@ CXFA_Node* CXFA_SimpleParser::NormalLoader(CXFA_Node* pXFANode, lpAttrInfo->eName != XFA_ATTRIBUTE_Save) { continue; } - pXFAChild->SetAttribute(lpAttrInfo->eName, wsAttrValue); + pXFAChild->SetAttribute(lpAttrInfo->eName, + wsAttrValue.AsWideStringC()); } pXFANode->InsertChild(pXFAChild); if (pElemInfo->eName == XFA_ELEMENT_Validate || @@ -1108,8 +1112,8 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, CFX_WideString wsAttrNamespaceURI; pXMLElement->GetAttribute(i, wsAttrQualifiedName, wsAttrValue); if (!XFA_FDEExtension_ResolveAttribute( - pXMLElement, wsAttrQualifiedName, wsAttrName, - wsAttrNamespaceURI)) { + pXMLElement, wsAttrQualifiedName.AsWideStringC(), + wsAttrName, wsAttrNamespaceURI)) { continue; } if (wsAttrName == FX_WSTRC(L"nil") && diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index b7e3bb380c..08e9cede92 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -164,7 +164,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pNotify->GetDocProvider()->SetTitle( - hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); + hDoc, + CFX_WideString::FromUTF8(bsValue, bsValue.GetLength()).AsWideStringC()); return; } CFX_WideString wsTitle; @@ -292,7 +293,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()); } - pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); + pNotify->GetDocProvider()->GotoURL(hDoc, wsURL.AsWideStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( CFXJSE_Arguments* pArguments) { @@ -331,8 +332,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { FXJSE_Value_Release(hValue); return; @@ -385,8 +386,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } CFX_WideString wsAnswer; - pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle, - wsDefaultAnswer, bMark); + pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion.AsWideStringC(), + wsTitle.AsWideStringC(), + wsDefaultAnswer.AsWideStringC(), bMark); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsByteStringC()); @@ -454,7 +456,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( CXFA_Node* pNode = NULL; int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { - iStart = XFA_FilterName(wsExpression, iStart, wsName); + iStart = XFA_FilterName(wsExpression.AsWideStringC(), iStart, wsName); CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; @@ -466,8 +468,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = - pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsName.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { continue; } @@ -535,8 +537,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, - resoveNodeRS, dwFlag); + int32_t iRet = pScriptContext->ResolveObjects( + pObject, wsExpression.AsWideStringC(), resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { FXJSE_Value_Release(hValue); return; @@ -601,7 +603,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( } } int32_t iValue = pNotify->GetAppProvider()->MsgBox( - wsMessage, bsTitle, dwMessageType, dwButtonType); + wsMessage.AsWideStringC(), bsTitle.AsWideStringC(), dwMessageType, + dwButtonType); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); @@ -733,7 +736,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } CXFA_FFDoc* hDoc = pNotify->GetHDOC(); - pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); + pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath.AsWideStringC()); } void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( CFXJSE_Arguments* pArguments) { @@ -756,7 +759,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } - pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); + pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath.AsWideStringC(), bXDP); } void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index b85e9b783f..fe6caa84bc 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -124,8 +124,8 @@ void CXFA_ScriptContext::GlobalPropertySetter(FXJSE_HOBJECT hObject, if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { pRefNode = ToNode(lpCurNode); } - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - TRUE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, TRUE)) { return; } if (lpOrginalNode->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { @@ -198,13 +198,13 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, if (pOrginalObject->GetObjectType() == XFA_OBJECTTYPE_VariablesThis) { pRefNode = ToNode(lpCurNode); } - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - FALSE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, FALSE)) { return; } dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName, hValue, dwFlag, - FALSE)) { + if (lpScriptContext->QueryNodeByFlag(pRefNode, wsPropName.AsWideStringC(), + hValue, dwFlag, FALSE)) { return; } CXFA_Object* pScriptObject = @@ -243,8 +243,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, } uint32_t dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | XFA_RESOLVENODE_Attributes; - FX_BOOL bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, - hValue, dwFlag, FALSE); + FX_BOOL bRet = lpScriptContext->QueryNodeByFlag( + ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE); if (bRet) { return; } @@ -252,8 +252,8 @@ void CXFA_ScriptContext::NormalPropertyGetter(FXJSE_HOBJECT hObject, (lpScriptContext->GetType() == XFA_SCRIPTLANGTYPE_Javascript && !lpScriptContext->IsStrictScopeInJavaScript())) { dwFlag = XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; - bRet = lpScriptContext->QueryNodeByFlag(ToNode(pObject), wsPropName, hValue, - dwFlag, FALSE); + bRet = lpScriptContext->QueryNodeByFlag( + ToNode(pObject), wsPropName.AsWideStringC(), hValue, dwFlag, FALSE); } if (bRet) { return; @@ -281,8 +281,8 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, CXFA_Object* pObject = lpScriptContext->GetVariablesThis(pOrginalObject); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = - XFA_GetScriptAttributeByName(pObject->GetClassID(), wsPropName); + const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName( + pObject->GetClassID(), wsPropName.AsWideStringC()); if (lpAttributeInfo) { (pObject->*(lpAttributeInfo->lpfnCallback))( hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -293,17 +293,18 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, } CXFA_Node* pNode = ToNode(pObject); CXFA_Node* pPropOrChild = NULL; - const XFA_ELEMENTINFO* lpElementInfo = XFA_GetElementByName(wsPropName); + const XFA_ELEMENTINFO* lpElementInfo = + XFA_GetElementByName(wsPropName.AsWideStringC()); if (lpElementInfo) { pPropOrChild = pNode->GetProperty(0, lpElementInfo->eName); } else { - pPropOrChild = pNode->GetFirstChildByName(wsPropName); + pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsWideStringC()); } if (pPropOrChild) { CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), - wsDefaultName); + wsDefaultName.AsWideStringC()); if (lpAttributeInfo) { (pPropOrChild->*(lpAttributeInfo->lpfnCallback))( hValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute); @@ -333,10 +334,11 @@ int32_t CXFA_ScriptContext::NormalPropTypeGetter( XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - if (XFA_GetMethodByName(objElement, wsPropName)) { + if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } - if (bQueryIn && !XFA_GetScriptAttributeByName(objElement, wsPropName)) { + if (bQueryIn && + !XFA_GetScriptAttributeByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_None; } return FXJSE_ClassPropType_Property; @@ -355,7 +357,7 @@ int32_t CXFA_ScriptContext::GlobalPropTypeGetter( XFA_ELEMENT objElement = pObject->GetClassID(); CFX_WideString wsPropName = CFX_WideString::FromUTF8( (const FX_CHAR*)szPropName.raw_str(), szPropName.GetLength()); - if (XFA_GetMethodByName(objElement, wsPropName)) { + if (XFA_GetMethodByName(objElement, wsPropName.AsWideStringC())) { return FXJSE_ClassPropType_Method; } return FXJSE_ClassPropType_Property; @@ -373,7 +375,7 @@ void CXFA_ScriptContext::NormalMethodCall(FXJSE_HOBJECT hThis, CFX_WideString wsFunName = CFX_WideString::FromUTF8( (const FX_CHAR*)szFuncName.raw_str(), szFuncName.GetLength()); const XFA_METHODINFO* lpMethodInfo = - XFA_GetMethodByName(pObject->GetClassID(), wsFunName); + XFA_GetMethodByName(pObject->GetClassID(), wsFunName.AsWideStringC()); if (NULL == lpMethodInfo) { return; } diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index 922b0d6bb6..1b70dffb19 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -117,7 +117,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( measure.Set(rtRect.top, XFA_UNIT_Pt); break; } - XFA_UNIT unit = measure.GetUnit(wsUnit); + XFA_UNIT unit = measure.GetUnit(wsUnit.AsWideStringC()); FX_FLOAT fValue = measure.ToUnit(unit); fValue = FXSYS_round(fValue * 1000) / 1000.0f; if (hValue) { diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index d7a1e29d9d..9e8ff5191c 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -368,7 +368,8 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( XFA_CreateNode_ForCondition(wsCondition); } if (bIsClassName) { - const XFA_ELEMENTINFO* lpElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* lpElement = + XFA_GetElementByName(wsName.AsWideStringC()); if (lpElement == NULL) { return FALSE; } @@ -391,7 +392,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( for (int32_t iIndex = 0; iIndex < m_iCreateCount; iIndex++) { CXFA_Node* pNewNode = m_pCreateParent->CreateSamePacketNode(eClassType); if (pNewNode) { - pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName); + pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, wsName.AsWideStringC()); pNewNode->CreateXMLMappingNode(); m_pCreateParent->InsertChild(pNewNode); if (iIndex == m_iCreateCount - 1) { diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index a71270a332..8ad8b13176 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -35,7 +35,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { } if (!rnd.m_CurNode->IsNode()) { if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) { - return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, rnd.m_wsName); + return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, + rnd.m_wsName.AsWideStringC()); } return 0; } @@ -70,7 +71,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { rnd.m_Nodes.Add(rnd.m_CurNode); } else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) && XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, - rnd.m_wsName)) { + rnd.m_wsName.AsWideStringC())) { return 1; } if (rnd.m_Nodes.GetSize() > 0) { @@ -168,7 +169,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* curNode = ToNode(rnd.m_CurNode); - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { + if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) { return 1; } CXFA_ResolveNodesData rndFind; @@ -331,7 +332,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } } if (dwStyles & XFA_RESOLVENODE_Attributes) { - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName)) { + if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsWideStringC())) { return 1; } } @@ -365,7 +366,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( pProp = pInstanceManager->GetProperty(0, XFA_ELEMENT_Occur, TRUE); } } else { - const XFA_ELEMENTINFO* pElement = XFA_GetElementByName(wsName); + const XFA_ELEMENTINFO* pElement = + XFA_GetElementByName(wsName.AsWideStringC()); if (pElement) { pProp = curNode->AsNode()->GetProperty( 0, pElement->eName, pElement->eName != XFA_ELEMENT_PageSet); @@ -711,7 +713,8 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( CXFA_Object* node = findNodes[i]; FX_BOOL bRet = FALSE; FXJSE_HVALUE pRetValue = FXJSE_Value_Create(rnd.m_pSC->GetRuntime()); - bRet = pContext->RunScript(eLangType, wsExpression, pRetValue, node); + bRet = pContext->RunScript(eLangType, wsExpression.AsWideStringC(), + pRetValue, node); if (!bRet || !FXJSE_Value_ToBoolean(pRetValue)) { findNodes.RemoveAt(i); } diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 2919664b52..f460cf764b 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -75,8 +75,9 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength()); } - FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression, - wsXMLIdent); + FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, + wsExpression.AsWideStringC(), + wsXMLIdent.AsWideStringC()); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetBoolean(hValue, bSign); -- cgit v1.2.3