From afe94306e3c542f0d499e7f7706ee5dec4028d8a Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 13 May 2016 17:21:31 -0700 Subject: Make CFX_WideString(const CFX_WideString&) explicit. BUG= Review-Url: https://codereview.chromium.org/1979723003 --- xfa/fxfa/parser/cxfa_validate.cpp | 16 ++++----- xfa/fxfa/parser/cxfa_validate.h | 4 +-- xfa/fxfa/parser/cxfa_widgetdata.cpp | 26 ++++++++------- xfa/fxfa/parser/cxfa_widgetdata.h | 2 +- .../parser/xfa_document_datadescription_imp.cpp | 5 +-- xfa/fxfa/parser/xfa_document_datadescription_imp.h | 2 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 38 +++++++++------------- xfa/fxfa/parser/xfa_document_serialize.cpp | 12 +++---- xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp | 2 +- xfa/fxfa/parser/xfa_locale.cpp | 3 +- xfa/fxfa/parser/xfa_localemgr.cpp | 4 +-- xfa/fxfa/parser/xfa_localemgr.h | 12 ++++--- xfa/fxfa/parser/xfa_object_imp.cpp | 34 ++++++++++--------- xfa/fxfa/parser/xfa_parser_imp.cpp | 16 ++++----- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 2 +- xfa/fxfa/parser/xfa_script_imp.cpp | 2 +- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 2 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 3 +- 18 files changed, 93 insertions(+), 92 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index db0ffb4fa6..17140fbbc3 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -40,7 +40,7 @@ int32_t CXFA_Validate::GetScriptTest() { } void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, - const CFX_WideStringC& wsMessageType) { + const CFX_WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, FALSE); if (!pNode) return; @@ -61,23 +61,23 @@ void CXFA_Validate::GetMessageText(CFX_WideString& wsMessage, } void CXFA_Validate::SetFormatMessageText(CFX_WideString wsMessage) { - SetMessageText(wsMessage, FX_WSTRC(L"formatTest")); + SetMessageText(wsMessage, L"formatTest"); } void CXFA_Validate::GetFormatMessageText(CFX_WideString& wsMessage) { - GetMessageText(wsMessage, FX_WSTRC(L"formatTest")); + GetMessageText(wsMessage, L"formatTest"); } void CXFA_Validate::SetNullMessageText(CFX_WideString wsMessage) { - SetMessageText(wsMessage, FX_WSTRC(L"nullTest")); + SetMessageText(wsMessage, L"nullTest"); } void CXFA_Validate::GetNullMessageText(CFX_WideString& wsMessage) { - GetMessageText(wsMessage, FX_WSTRC(L"nullTest")); + GetMessageText(wsMessage, L"nullTest"); } void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, - const CFX_WideStringC& wsMessageType) { + const CFX_WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->GetProperty(0, XFA_ELEMENT_Message, TRUE); if (!pNode) return; @@ -102,11 +102,11 @@ void CXFA_Validate::SetMessageText(CFX_WideString& wsMessage, } void CXFA_Validate::GetScriptMessageText(CFX_WideString& wsMessage) { - GetMessageText(wsMessage, FX_WSTRC(L"scriptTest")); + GetMessageText(wsMessage, L"scriptTest"); } void CXFA_Validate::SetScriptMessageText(CFX_WideString wsMessage) { - SetMessageText(wsMessage, FX_WSTRC(L"scriptTest")); + SetMessageText(wsMessage, L"scriptTest"); } void CXFA_Validate::GetPicture(CFX_WideString& wsPicture) { diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h index aab5de3466..bdd7be98b2 100644 --- a/xfa/fxfa/parser/cxfa_validate.h +++ b/xfa/fxfa/parser/cxfa_validate.h @@ -33,9 +33,9 @@ class CXFA_Validate : public CXFA_Data { protected: void GetMessageText(CFX_WideString& wsMessage, - const CFX_WideStringC& wsMessageType); + const CFX_WideString& wsMessageType); void SetMessageText(CFX_WideString& wsMessage, - const CFX_WideStringC& wsMessageType); + const CFX_WideString& wsMessageType); FX_BOOL SetTestValue(int32_t iType, CFX_WideString& wsValue, XFA_ATTRIBUTEENUM eName); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 7ca020fe6f..6ef88cdc74 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -888,19 +888,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.AsStringC(), nIndex); + InsertListTextItem(pItems, wsLabel, nIndex); CXFA_Node* pSaveItems = m_pNode->CreateSamePacketNode(XFA_ELEMENT_Items); m_pNode->InsertChild(-1, pSaveItems); pSaveItems->SetBoolean(XFA_ATTRIBUTE_Save, TRUE); - InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex); + InsertListTextItem(pSaveItems, wsNewValue, 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.AsStringC(), nIndex); + InsertListTextItem(pNode, wsNewValue, nIndex); else - InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex); + InsertListTextItem(pNode, wsLabel, nIndex); } } else { CXFA_Node* pNode = listitems[0]; @@ -916,12 +916,12 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, while (pListNode) { CFX_WideString wsOldValue; pListNode->TryContent(wsOldValue); - InsertListTextItem(pSaveItems, wsOldValue.AsStringC(), i); + InsertListTextItem(pSaveItems, wsOldValue, i); i++; pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); } - InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex); - InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex); + InsertListTextItem(pNode, wsLabel, nIndex); + InsertListTextItem(pSaveItems, wsNewValue, nIndex); } if (!bNotify) return; @@ -1074,7 +1074,8 @@ int32_t CXFA_WidgetData::GetNumberOfCells() { CFX_WideString CXFA_WidgetData::GetBarcodeType() { CXFA_Node* pUIChild = GetUIChild(); - return pUIChild ? pUIChild->GetCData(XFA_ATTRIBUTE_Type) : NULL; + return pUIChild ? CFX_WideString(pUIChild->GetCData(XFA_ATTRIBUTE_Type)) + : nullptr; } FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t& val) { @@ -1084,7 +1085,8 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_CharEncoding(int32_t& val) { if (wsCharEncoding.CompareNoCase(L"UTF-16")) { val = CHAR_ENCODING_UNICODE; return TRUE; - } else if (wsCharEncoding.CompareNoCase(L"UTF-8")) { + } + if (wsCharEncoding.CompareNoCase(L"UTF-8")) { val = CHAR_ENCODING_UTF8; return TRUE; } @@ -1475,8 +1477,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.AsStringC()); + pLocale = + m_pNode->GetDocument()->GetLocalMgr()->GetLocaleByName(wsLocaleName); } } return pLocale; @@ -1739,7 +1741,7 @@ void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, } void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, - const CFX_WideStringC& wsText, + const CFX_WideString& wsText, int32_t nIndex) { CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_ELEMENT_Text); pItems->InsertChild(nIndex, pText); diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 3cdc7cc8e4..c0d06e353c 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -168,7 +168,7 @@ class CXFA_WidgetData : public CXFA_Data { protected: void SyncValue(const CFX_WideString& wsValue, FX_BOOL bNotify); void InsertListTextItem(CXFA_Node* pItems, - const CFX_WideStringC& wsText, + const CFX_WideString& wsText, int32_t nIndex = -1); void FormatNumStr(const CFX_WideString& wsValue, IFX_Locale* pLocale, diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp index c988902b63..31cf4119ad 100644 --- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp @@ -69,7 +69,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( CXFA_Document* pDocument, CXFA_Node* pDataParent, XFA_ELEMENT eNodeType, - const CFX_WideStringC& wsName) { + const CFX_WideString& wsName) { if (!pDataParent) { return NULL; } @@ -98,7 +98,8 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( continue; } } - CXFA_Node* pDDNode = pDDGroupNode->GetFirstChildByName(wsName); + CXFA_Node* pDDNode = + pDDGroupNode->GetFirstChildByName(wsName.AsStringC()); if (!pDDNode) { continue; } diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.h b/xfa/fxfa/parser/xfa_document_datadescription_imp.h index f7c626dfb7..47bc358972 100644 --- a/xfa/fxfa/parser/xfa_document_datadescription_imp.h +++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.h @@ -13,6 +13,6 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode( CXFA_Document* pDocument, CXFA_Node* pDataParent, XFA_ELEMENT eNodeType, - const CFX_WideStringC& wsName); + const CFX_WideString& wsName); #endif // XFA_FXFA_PARSER_XFA_DOCUMENT_DATADESCRIPTION_IMP_H_ diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index ccb69df1a1..41a0acd70b 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -135,7 +135,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, pDataNode->SetAttributeValue(wsValue, wsFormatedValue); pDataNode->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); if (!wsHref.IsEmpty()) { - pXMLDataElement->SetString(FX_WSTRC(L"href"), wsHref); + pXMLDataElement->SetString(L"href", wsHref); } } break; case XFA_ELEMENT_ChoiceList: @@ -148,7 +148,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CXFA_Node* pValue = NULL; for (int32_t i = 0; i < iSize; i++) { pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue); - pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); + pValue->SetCData(XFA_ATTRIBUTE_Name, L"value"); pValue->CreateXMLMappingNode(); pDataNode->InsertChild(pValue); pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); @@ -156,8 +156,8 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, } else { CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); - static_cast(pXMLNode) - ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); + static_cast(pXMLNode)->SetString(L"xfa:dataNode", + L"dataGroup"); } } else if (!wsValue.IsEmpty()) { pWidgetData->GetFormatDataValue(wsValue, wsFormatedValue); @@ -297,8 +297,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, } CXFA_ExData exData = defValue.GetExData(); ASSERT(exData); - exData.SetContentType((iCounts == 1) ? FX_WSTRC(L"text/plain") - : FX_WSTRC(L"text/xml")); + exData.SetContentType(iCounts == 1 ? L"text/plain" : L"text/xml"); } XFA_DataMerge_FormValueNode_SetChildContent( defValue.GetNode(), wsNormailizeValue, XFA_ELEMENT_ExData); @@ -1130,7 +1129,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, : XFA_ELEMENT_DataValue; pDataNode = XFA_DataDescription_MaybeCreateDataNode( pDocument, pDataScope, eDataNodeType, - pFormNode->GetCData(XFA_ATTRIBUTE_Name)); + CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); if (pDataNode) { XFA_DataMerge_CreateDataBinding(pFormNode, pDataNode, FALSE); } @@ -1163,7 +1162,7 @@ static void XFA_DataMerge_UpdateBindingRelations(CXFA_Document* pDocument, ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Record)); pDataNode = XFA_DataDescription_MaybeCreateDataNode( pDocument, pRecordNode, eDataNodeType, - pFormNode->GetCData(XFA_ATTRIBUTE_Name)); + CFX_WideString(pFormNode->GetCData(XFA_ATTRIBUTE_Name))); if (pDataNode) { XFA_DataMerge_CreateDataBinding(pFormNode, pDataNode, FALSE); XFA_DataMerge_RegisterGlobalBinding( @@ -1260,14 +1259,11 @@ CXFA_Node* CXFA_Document::GetNotBindNode(CXFA_ObjArray& arrayNodes) { void CXFA_Document::DoDataMerge() { CXFA_Node* pDatasetsRoot = ToNode(GetXFAObject(XFA_HASHCODE_Datasets)); if (!pDatasetsRoot) { - CFDE_XMLElement* pDatasetsXMLNode = - new CFDE_XMLElement(FX_WSTRC(L"xfa:datasets")); - - pDatasetsXMLNode->SetString( - FX_WSTRC(L"xmlns:xfa"), - FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/")); + CFDE_XMLElement* pDatasetsXMLNode = new CFDE_XMLElement(L"xfa:datasets"); + pDatasetsXMLNode->SetString(L"xmlns:xfa", + L"http://www.xfa.org/schema/xfa-data/1.0/"); pDatasetsRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataModel); - pDatasetsRoot->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"datasets")); + pDatasetsRoot->SetCData(XFA_ATTRIBUTE_Name, L"datasets"); m_pRootNode->GetXMLMappingNode()->InsertChildNode(pDatasetsXMLNode); m_pRootNode->InsertChild(pDatasetsRoot); pDatasetsRoot->SetXMLMappingNode(pDatasetsXMLNode); @@ -1304,11 +1300,9 @@ void CXFA_Document::DoDataMerge() { } } if (!pDataRoot) { - CFDE_XMLElement* pDataRootXMLNode = - new CFDE_XMLElement(FX_WSTRC(L"xfa:data")); - + CFDE_XMLElement* pDataRootXMLNode = new CFDE_XMLElement(L"xfa:data"); pDataRoot = CreateNode(XFA_XDPPACKET_Datasets, XFA_ELEMENT_DataGroup); - pDataRoot->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"data")); + pDataRoot->SetCData(XFA_ATTRIBUTE_Name, L"data"); pDataRoot->SetXMLMappingNode(pDataRootXMLNode); pDatasetsRoot->InsertChild(pDataRoot); } @@ -1335,7 +1329,7 @@ void CXFA_Document::DoDataMerge() { bEmptyForm = TRUE; pFormRoot = CreateNode(XFA_XDPPACKET_Form, XFA_ELEMENT_Form); ASSERT(pFormRoot); - pFormRoot->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"form")); + pFormRoot->SetCData(XFA_ATTRIBUTE_Name, L"form"); m_pRootNode->InsertChild(pFormRoot, NULL); } else { CXFA_NodeIteratorTemplate @@ -1350,8 +1344,8 @@ void CXFA_Document::DoDataMerge() { ASSERT(pSubformSetNode); if (!pDataTopLevel) { CFX_WideStringC wsFormName = pSubformSetNode->GetCData(XFA_ATTRIBUTE_Name); - CFX_WideString wsDataTopLevelName = - wsFormName.IsEmpty() ? FX_WSTRC(L"form") : wsFormName; + CFX_WideString wsDataTopLevelName(wsFormName.IsEmpty() ? L"form" + : wsFormName); CFDE_XMLElement* pDataTopLevelXMLNode = new CFDE_XMLElement(wsDataTopLevelName); diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index fce951420d..ef85d0e266 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -93,7 +93,7 @@ CFX_WideString XFA_ExportEncodeAttribute(const CFX_WideString& str) { textBuf.AppendChar(str[i]); } } - return textBuf.AsStringC(); + return textBuf.MakeString(); } CFX_WideString XFA_ExportEncodeContent(const CFX_WideStringC& str) { CFX_WideTextBuf textBuf; @@ -123,7 +123,7 @@ CFX_WideString XFA_ExportEncodeContent(const CFX_WideStringC& str) { textBuf.AppendChar(str.GetAt(i)); } } - return textBuf.AsStringC(); + return textBuf.MakeString(); } static void XFA_SaveAttribute(CXFA_Node* pNode, XFA_ATTRIBUTE eName, @@ -547,8 +547,8 @@ FX_BOOL CXFA_DataExporter::Export(IFX_Stream* pStream, return FALSE; } XFA_DataExporter_DealWithDataGroupNode(pExportNode); - pElement->SetString(FX_WSTRC(L"xmlns:xfa"), - FX_WSTRC(L"http://www.xfa.org/schema/xfa-data/1.0/")); + pElement->SetString(L"xmlns:xfa", + L"http://www.xfa.org/schema/xfa-data/1.0/"); pXMLDoc->SaveXMLNode(pStream, pElement); pElement->RemoveAttribute(L"xmlns:xfa"); } @@ -576,8 +576,8 @@ void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode) { } else { CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); ASSERT(pXMLNode->GetType() == FDE_XMLNODE_Element); - static_cast(pXMLNode) - ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); + static_cast(pXMLNode)->SetString(L"xfa:dataNode", + L"dataGroup"); } } } diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp index 75bcbbecae..08ce54f844 100644 --- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp +++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp @@ -274,7 +274,7 @@ static CXFA_Node* XFA_ResolveBreakTarget(CXFA_Node* pPageSetRoot, if (wsTargetExpr.IsEmpty()) { return NULL; } - CFX_WideString wsTargetAll = wsTargetExpr; + CFX_WideString wsTargetAll(wsTargetExpr); wsTargetAll.TrimLeft(); wsTargetAll.TrimRight(); int32_t iSpliteIndex = 0; diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index ff0371bc88..7883856b67 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -226,7 +226,8 @@ void CXFA_NodeLocale::Release() { delete this; } CFX_WideString CXFA_NodeLocale::GetName() { - return m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) : NULL; + return CFX_WideString(m_pLocale ? m_pLocale->GetCData(XFA_ATTRIBUTE_Name) + : nullptr); } void CXFA_NodeLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, CFX_WideString& wsNumSymbol) const { diff --git a/xfa/fxfa/parser/xfa_localemgr.cpp b/xfa/fxfa/parser/xfa_localemgr.cpp index 519c4819bd..0982537b15 100644 --- a/xfa/fxfa/parser/xfa_localemgr.cpp +++ b/xfa/fxfa/parser/xfa_localemgr.cpp @@ -1131,7 +1131,7 @@ CXFA_LocaleMgr::CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid) pNodeLocale = pNodeLocale->GetNodeItem(XFA_NODEITEM_NextSibling); } } - m_pDefLocale = GetLocaleByName(wsDeflcid.AsStringC()); + m_pDefLocale = GetLocaleByName(wsDeflcid); } CXFA_LocaleMgr::~CXFA_LocaleMgr() { for (int32_t i = 0; i < m_LocaleArray.GetSize(); i++) @@ -1217,7 +1217,7 @@ IFX_Locale* CXFA_LocaleMgr::GetLocale(uint16_t lcid) { return pLocal; } IFX_Locale* CXFA_LocaleMgr::GetLocaleByName( - const CFX_WideStringC& wsLocaleName) { + const CFX_WideString& wsLocaleName) { int32_t iCount = m_LocaleArray.GetSize(); int32_t i = 0; for (i = 0; i < iCount; i++) { diff --git a/xfa/fxfa/parser/xfa_localemgr.h b/xfa/fxfa/parser/xfa_localemgr.h index c82c47c7f3..a3a1d4c2b9 100644 --- a/xfa/fxfa/parser/xfa_localemgr.h +++ b/xfa/fxfa/parser/xfa_localemgr.h @@ -33,11 +33,13 @@ class IFX_Locale; class CXFA_LocaleMgr : public IFX_LocaleMgr { public: CXFA_LocaleMgr(CXFA_Node* pLocaleSet, CFX_WideString wsDeflcid); - virtual void Release(); - virtual uint16_t GetDefLocaleID(); - virtual IFX_Locale* GetDefLocale(); - virtual IFX_Locale* GetLocale(uint16_t lcid); - virtual IFX_Locale* GetLocaleByName(const CFX_WideStringC& wsLocaleName); + + void Release() override; + uint16_t GetDefLocaleID() override; + IFX_Locale* GetDefLocale() override; + IFX_Locale* GetLocale(uint16_t lcid) override; + IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override; + ~CXFA_LocaleMgr(); void SetDefLocale(IFX_Locale* pLocale); CFX_WideStringC GetConfigLocaleName(CXFA_Node* pConfig); diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index e3631c60f2..0fbde1f160 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -140,7 +140,7 @@ CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) { CFDE_XMLElement* pCloneXMLElement = new CFDE_XMLElement(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { - pCloneXMLElement->SetTextData(wsValue); + pCloneXMLElement->SetTextData(CFX_WideString(wsValue)); } pCloneXML = pCloneXMLElement; pCloneXMLElement = NULL; @@ -981,7 +981,8 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { CXFA_Node* pFakeRoot = Clone(FALSE); CFX_WideStringC wsContentType = GetCData(XFA_ATTRIBUTE_ContentType); if (!wsContentType.IsEmpty()) { - pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, wsContentType); + pFakeRoot->SetCData(XFA_ATTRIBUTE_ContentType, + CFX_WideString(wsContentType)); } CFDE_XMLNode* pFakeXMLRoot = pFakeRoot->GetXMLMappingNode(); if (!pFakeXMLRoot) { @@ -991,7 +992,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) { if (!pFakeXMLRoot) { CFX_WideStringC wsClassName; GetClassName(wsClassName); - pFakeXMLRoot = new CFDE_XMLElement(wsClassName); + pFakeXMLRoot = new CFDE_XMLElement(CFX_WideString(wsClassName)); } if (bIgnoreRoot) { CFDE_XMLNode* pXMLChild = pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); @@ -1724,7 +1725,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, FXJSE_Value_ToUTF8String(hValue, newValue); } int32_t iValue = FXSYS_atoi(newValue.c_str()); - CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); + CFX_WideString wsNewValue(iValue == 0 ? L"0" : L"1"); CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); if (pContainerWidgetData) { @@ -3263,9 +3264,9 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { } if (iDesired < iCount) { CFX_WideStringC wsInstManagerName = GetCData(XFA_ATTRIBUTE_Name); - CFX_WideString wsInstanceName = wsInstManagerName.IsEmpty() - ? wsInstManagerName - : wsInstManagerName.Mid(1); + CFX_WideString wsInstanceName = + CFX_WideString(wsInstManagerName.IsEmpty() ? wsInstManagerName + : wsInstManagerName.Mid(1)); uint32_t dInstanceNameHash = FX_HashCode_GetW(wsInstanceName.AsStringC(), false); CXFA_Node* pPrevSibling = @@ -3737,7 +3738,7 @@ FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, bNotify); } break; case XFA_ATTRIBUTETYPE_Cdata: - return SetCData(pAttr->eName, wsValue, bNotify); + return SetCData(pAttr->eName, CFX_WideString(wsValue), bNotify); case XFA_ATTRIBUTETYPE_Boolean: return SetBoolean(pAttr->eName, wsValue != FX_WSTRC(L"0"), bNotify); case XFA_ATTRIBUTETYPE_Integer: @@ -3938,7 +3939,8 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, case FDE_XMLNODE_Element: if (IsAttributeInXML()) { static_cast(m_pXMLNode) - ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); + ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), + wsValue); } else { FX_BOOL bDeleteChildren = TRUE; if (GetPacketID() == XFA_XDPPACKET_Datasets) { @@ -3995,7 +3997,8 @@ FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, case FDE_XMLNODE_Element: if (IsAttributeInXML()) { static_cast(m_pXMLNode) - ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); + ->SetString(CFX_WideString(GetCData(XFA_ATTRIBUTE_QualifiedName)), + wsXMLValue); } else { FX_BOOL bDeleteChildren = TRUE; if (GetPacketID() == XFA_XDPPACKET_Datasets) { @@ -4114,8 +4117,7 @@ FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, break; case XFA_ATTRIBUTETYPE_Boolean: static_cast(m_pXMLNode) - ->SetString(pInfo->pName, - pValue ? FX_WSTRC(L"1") : FX_WSTRC(L"0")); + ->SetString(pInfo->pName, pValue ? L"1" : L"0"); break; case XFA_ATTRIBUTETYPE_Integer: static_cast(m_pXMLNode) @@ -4172,7 +4174,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); ASSERT(pChildValue); - pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, FX_WSTRC(L"text/xml")); + pChildValue->SetCData(XFA_ATTRIBUTE_ContentType, L"text/xml"); pChildValue->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, FALSE); CXFA_Node* pBind = GetBindData(); @@ -4212,7 +4214,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, while (iAddNodes-- > 0) { pValueNodes = pBind->CreateSamePacketNode(XFA_ELEMENT_DataValue); - pValueNodes->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); + pValueNodes->SetCData(XFA_ATTRIBUTE_Name, L"value"); pValueNodes->CreateXMLMappingNode(); pBind->InsertChild(pValueNodes); } @@ -4699,7 +4701,7 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) { CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); if (!wsValue.IsEmpty()) { - pNewXMLElement->SetTextData(wsValue); + pNewXMLElement->SetTextData(CFX_WideString(wsValue)); } pNode->m_pXMLNode = pNewXMLElement; pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); @@ -4936,7 +4938,7 @@ void CXFA_Node::UpdateNameHash() { } CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { if (!m_pXMLNode) { - CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); + CFX_WideString wsTag(GetCData(XFA_ATTRIBUTE_Name)); m_pXMLNode = new CFDE_XMLElement(wsTag); SetFlag(XFA_NODEFLAG_OwnXMLNode, false); } diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 23a8dbc925..01ea1d6fae 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -377,7 +377,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_XDP( return nullptr; } m_pRootNode = pXFARootNode; - pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"xfa")); + pXFARootNode->SetCData(XFA_ATTRIBUTE_Name, L"xfa"); { CFDE_XMLElement* pElement = static_cast(pXMLDocumentNode); int32_t iAttributeCount = pElement->CountAttributes(); @@ -662,7 +662,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data( ->RemoveAttribute(L"xmlns:xfa"); pDataXMLNode = pXMLDocumentNode; } else { - CFDE_XMLElement* pDataElement = new CFDE_XMLElement(FX_WSTRC(L"xfa:data")); + CFDE_XMLElement* pDataElement = new CFDE_XMLElement(L"xfa:data"); CFDE_XMLNode* pParentXMLNode = pXMLDocumentNode->GetNodeItem(CFDE_XMLNode::Parent); if (pParentXMLNode) { @@ -1147,7 +1147,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, pXFAMetaData->SetFlag(XFA_NODEFLAG_Initialized, false); } if (!bNeedValue) { - CFX_WideString wsNilName = FX_WSTRC(L"xsi:nil"); + CFX_WideString wsNilName(L"xsi:nil"); pXMLElement->RemoveAttribute(wsNilName.c_str()); } } @@ -1247,14 +1247,14 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } else { bMarkAsCompound = TRUE; if (pXMLCurValueNode) { - CFX_WideStringC wsCurValue = wsCurValueTextBuf.AsStringC(); + CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); if (!wsCurValue.IsEmpty()) { CXFA_Node* pXFAChild = m_pFactory->CreateNode(ePacketID, XFA_ELEMENT_DataValue); if (!pXFAChild) return; - pXFAChild->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"")); + pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); pXFANode->InsertChild(pXFAChild); pXFAChild->SetXMLMappingNode(pXMLCurValueNode); @@ -1281,7 +1281,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } } if (pXMLCurValueNode) { - CFX_WideStringC wsCurValue = wsCurValueTextBuf.AsStringC(); + CFX_WideString wsCurValue = wsCurValueTextBuf.MakeString(); if (!wsCurValue.IsEmpty()) { if (bMarkAsCompound) { CXFA_Node* pXFAChild = @@ -1289,7 +1289,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, if (!pXFAChild) return; - pXFAChild->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"")); + pXFAChild->SetCData(XFA_ATTRIBUTE_Name, L""); pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue); pXFANode->InsertChild(pXFAChild); pXFAChild->SetXMLMappingNode(pXMLCurValueNode); @@ -1300,7 +1300,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode, } pXMLCurValueNode = nullptr; } - CFX_WideStringC wsNodeValue = wsValueTextBuf.AsStringC(); + CFX_WideString wsNodeValue = wsValueTextBuf.MakeString(); pXFANode->SetCData(XFA_ATTRIBUTE_Value, wsNodeValue); } diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index c771000ebd..e6de66d803 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -163,7 +163,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pNotify->GetDocProvider()->SetTitle( - hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC()); + hDoc, CFX_WideString::FromUTF8(bsValue.AsStringC())); return; } CFX_WideString wsTitle; diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 1cd5689045..893c5b79ea 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -291,7 +291,7 @@ void CXFA_ScriptContext::NormalPropertySetter(FXJSE_HOBJECT hObject, pPropOrChild = pNode->GetFirstChildByName(wsPropName.AsStringC()); } if (pPropOrChild) { - CFX_WideString wsDefaultName = FX_WSTRC(L"{default}"); + CFX_WideString wsDefaultName(L"{default}"); const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo = XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(), wsDefaultName.AsStringC()); diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index e46b7060a1..e48d3d5ffa 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -65,7 +65,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( return; } CXFA_Node* pNode = NULL; - CFX_WideString wsUnit = FX_WSTRC(L"pt"); + CFX_WideString wsUnit(L"pt"); int32_t iIndex = 0; if (iLength >= 1) { pNode = static_cast(pArguments->GetObject(0)); diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 96ecc5a125..93bf40e324 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -308,9 +308,8 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { FX_BOOL CXFA_NodeHelper::XFA_CreateNode_ForCondition( CFX_WideString& wsCondition) { int32_t iLen = wsCondition.GetLength(); - CFX_WideString wsIndex = FX_WSTRC(L"0"); + CFX_WideString wsIndex(L"0"); FX_BOOL bAll = FALSE; - if (iLen == 0) { m_iCreateFlag = XFA_RESOLVENODE_RSTYPE_CreateNodeOne; return FALSE; -- cgit v1.2.3