From bd9748d504555f100d34025d76a9e0119986bc3f Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 13 Apr 2016 21:40:19 -0700 Subject: Remove implicit cast from CFX_WideString to (const wchar_t*) BUG= Review URL: https://codereview.chromium.org/1882043004 --- core/fpdfdoc/doc_formfield.cpp | 3 +- core/fxcrt/extension.h | 2 +- core/fxcrt/fx_arabic.cpp | 4 +- core/fxcrt/include/fx_string.h | 4 - fpdfsdk/fsdk_baseform.cpp | 4 +- fpdfsdk/javascript/PublicMethods.cpp | 2 +- fpdfsdk/javascript/public_methods_embeddertest.cpp | 32 ++-- fpdfsdk/javascript/util.cpp | 3 +- xfa/fde/css/fde_cssstyleselector.cpp | 3 +- xfa/fde/css/fde_cssstylesheet.cpp | 5 +- xfa/fde/tto/fde_textout.cpp | 6 +- xfa/fde/xml/fde_xml_imp.cpp | 64 +++---- xfa/fee/fde_txtedtengine.cpp | 6 +- xfa/fgas/crt/fgas_stream.cpp | 2 +- xfa/fgas/font/fgas_fontutils.cpp | 2 +- xfa/fgas/font/fgas_gefont.cpp | 6 +- xfa/fgas/font/fgas_stdfontmgr.cpp | 2 +- xfa/fgas/localization/fgas_locale.cpp | 205 +++++++++------------ xfa/fgas/localization/fgas_localemgr.cpp | 4 +- xfa/fwl/theme/cfwl_widgettp.cpp | 6 +- xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp | 2 +- xfa/fxfa/app/xfa_ffdoc.cpp | 5 +- xfa/fxfa/app/xfa_ffdocview.cpp | 6 +- xfa/fxfa/app/xfa_ffimageedit.cpp | 2 +- xfa/fxfa/app/xfa_fftextedit.cpp | 3 +- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 18 +- xfa/fxfa/app/xfa_fontmgr.cpp | 9 +- xfa/fxfa/app/xfa_fwltheme.cpp | 16 +- xfa/fxfa/app/xfa_textlayout.cpp | 10 +- xfa/fxfa/app/xfa_textlayout.h | 3 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 58 +++--- xfa/fxfa/fm2js/xfa_fmparse.cpp | 2 +- xfa/fxfa/parser/cxfa_font.cpp | 4 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 14 +- xfa/fxfa/parser/xfa_basic_imp.cpp | 2 +- xfa/fxfa/parser/xfa_document_datamerger_imp.cpp | 4 +- xfa/fxfa/parser/xfa_document_imp.cpp | 23 ++- xfa/fxfa/parser/xfa_document_serialize.cpp | 7 +- xfa/fxfa/parser/xfa_localevalue.cpp | 8 +- xfa/fxfa/parser/xfa_object_imp.cpp | 81 ++++---- xfa/fxfa/parser/xfa_parser_imp.cpp | 6 +- xfa/fxfa/parser/xfa_script_imp.cpp | 2 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 4 +- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 16 +- xfa/fxfa/parser/xfa_utils_imp.cpp | 5 +- 45 files changed, 330 insertions(+), 345 deletions(-) diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 957352ecef..7f0ff8716b 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -724,7 +724,8 @@ int CPDF_FormField::InsertOption(CFX_WideString csOptLabel, return -1; } - CFX_ByteString csStr = PDF_EncodeText(csOptLabel, csOptLabel.GetLength()); + CFX_ByteString csStr = + PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength()); CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "Opt"); CPDF_Array* pOpt = ToArray(pValue); if (!pOpt) { diff --git a/core/fxcrt/extension.h b/core/fxcrt/extension.h index a9f3c23d29..a8a099c664 100644 --- a/core/fxcrt/extension.h +++ b/core/fxcrt/extension.h @@ -52,7 +52,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess { void GetPath(CFX_WideString& wsPath) override { wsPath = m_path; } IFX_FileStream* CreateFileStream(uint32_t dwModes) override { - return FX_CreateFileStream(m_path, dwModes); + return FX_CreateFileStream(m_path.c_str(), dwModes); } FX_BOOL Init(const CFX_WideStringC& wsPath) { diff --git a/core/fxcrt/fx_arabic.cpp b/core/fxcrt/fx_arabic.cpp index 803683782d..8c5230731f 100644 --- a/core/fxcrt/fx_arabic.cpp +++ b/core/fxcrt/fx_arabic.cpp @@ -221,7 +221,7 @@ void FX_BidiReverseString(CFX_WideString& wsText, FXSYS_assert(iStart > -1 && iStart < wsText.GetLength()); FXSYS_assert(iCount >= 0 && iStart + iCount <= wsText.GetLength()); FX_WCHAR wch; - FX_WCHAR* pStart = (FX_WCHAR*)(const FX_WCHAR*)wsText; + FX_WCHAR* pStart = const_cast(wsText.c_str()); pStart += iStart; FX_WCHAR* pEnd = pStart + iCount - 1; while (pStart < pEnd) { @@ -252,7 +252,7 @@ void FX_BidiClassify(const CFX_WideString& wsText, FX_BOOL bWS) { FXSYS_assert(wsText.GetLength() == classes.GetSize()); int32_t iCount = wsText.GetLength(); - const FX_WCHAR* pwsStart = (const FX_WCHAR*)wsText; + const FX_WCHAR* pwsStart = wsText.c_str(); FX_WCHAR wch; int32_t iCls; if (bWS) { diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index 4b73551573..9d7d66741b 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -497,10 +497,6 @@ class CFX_WideString { // Note: Any subsequent modification of |this| will invalidate the result. const FX_WCHAR* c_str() const { return m_pData ? m_pData->m_String : L""; } - // Implicit conversion to C-style wide string -- deprecated. - // Note: Any subsequent modification of |this| will invalidate the result. - operator const FX_WCHAR*() const { return m_pData ? m_pData->m_String : L""; } - // Explicit conversion to CFX_WideStringC. // Note: Any subsequent modification of |this| will invalidate the result. CFX_WideStringC AsStringC() const { diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index bfeba0e6dd..288a2fe5a3 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -718,7 +718,7 @@ void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { case FIELDTYPE_COMBOBOX: { FX_BOOL bFormated = FALSE; CFX_WideString sValue = OnFormat(bFormated); - ResetAppearance(bFormated ? sValue : nullptr, TRUE); + ResetAppearance(bFormated ? sValue.c_str() : nullptr, TRUE); } break; default: ResetAppearance(nullptr, FALSE); @@ -1546,7 +1546,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { CFX_WideString sValueTmp; if (!sValue && GetMixXFAWidget()) { sValueTmp = GetValue(TRUE); - sValue = sValueTmp; + sValue = sValueTmp.c_str(); } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index d03f671599..9f7b60f70d 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -1654,7 +1654,7 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, } CFX_WideString ws = params[0].ToCFXWideString(); ws.Replace(L",", L"."); - vRet = ws; + vRet = ws.c_str(); vRet.MaybeCoerceToNumber(); if (vRet.GetType() != CJS_Value::VT_number) vRet = 0; diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp index 153b3cd64f..1fc967b890 100644 --- a/fpdfsdk/javascript/public_methods_embeddertest.cpp +++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp @@ -113,56 +113,56 @@ TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) { // 1968-06-25 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy"); - EXPECT_STREQ(L"250668", formatted_date); + EXPECT_STREQ(L"250668", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"yy/mm/dd"); - EXPECT_STREQ(L"68/06/25", formatted_date); + EXPECT_STREQ(L"68/06/25", formatted_date.c_str()); // 1969-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"ddmmyy"); - EXPECT_STREQ(L"311269", formatted_date); + EXPECT_STREQ(L"311269", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"yy!mmdd"); - EXPECT_STREQ(L"69!1231", formatted_date); + EXPECT_STREQ(L"69!1231", formatted_date.c_str()); // 1970-01-01 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"ddmmyy"); - EXPECT_STREQ(L"010170", formatted_date); + EXPECT_STREQ(L"010170", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"mm-yyyy-dd"); - EXPECT_STREQ(L"01-1970-01", formatted_date); + EXPECT_STREQ(L"01-1970-01", formatted_date.c_str()); // 1985-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"ddmmyy"); - EXPECT_STREQ(L"311285", formatted_date); + EXPECT_STREQ(L"311285", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"yymmdd"); - EXPECT_STREQ(L"851231", formatted_date); + EXPECT_STREQ(L"851231", formatted_date.c_str()); // 1995-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"ddmmyy"); - EXPECT_STREQ(L"010295", formatted_date); + EXPECT_STREQ(L"010295", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"yyyymmdd"); - EXPECT_STREQ(L"19950201", formatted_date); + EXPECT_STREQ(L"19950201", formatted_date.c_str()); // 2005-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"ddmmyy"); - EXPECT_STREQ(L"010205", formatted_date); + EXPECT_STREQ(L"010205", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"yyyyddmm"); - EXPECT_STREQ(L"20050102", formatted_date); + EXPECT_STREQ(L"20050102", formatted_date.c_str()); // 2085-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"ddmmyy"); - EXPECT_STREQ(L"311285", formatted_date); + EXPECT_STREQ(L"311285", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"yyyydd"); - EXPECT_STREQ(L"208531", formatted_date); + EXPECT_STREQ(L"208531", formatted_date.c_str()); // 2095-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"ddmmyy"); - EXPECT_STREQ(L"010295", formatted_date); + EXPECT_STREQ(L"010295", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"mmddyyyy"); - EXPECT_STREQ(L"02012095", formatted_date); + EXPECT_STREQ(L"02012095", formatted_date.c_str()); } diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index adaa9c794b..4f2d834208 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -312,7 +312,8 @@ FX_BOOL util::printx(IJS_Context* cc, sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); return FALSE; } - vRet = printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()); + vRet = + printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()).c_str(); return TRUE; } diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index d93a756b3b..60283a6628 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -570,7 +570,8 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, } else if (iLen > 0) { psz = pSyntax->GetCurrentString(iLen); if (iLen > 0) { - pDecl->AddProperty(&args, wsName, wsName.GetLength(), psz, iLen); + pDecl->AddProperty(&args, wsName.c_str(), wsName.GetLength(), psz, + iLen); } } } else { diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index 3da7cf41d5..4afb0cee63 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -264,8 +264,9 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSStyleSheet::LoadStyleRule( } else if (iValueLen > 0) { pszValue = pSyntax->GetCurrentString(iValueLen); if (iValueLen > 0) { - pStyleRule->GetDeclImp().AddProperty( - &propertyArgs, wsName, wsName.GetLength(), pszValue, iValueLen); + pStyleRule->GetDeclImp().AddProperty(&propertyArgs, wsName.c_str(), + wsName.GetLength(), pszValue, + iValueLen); } } break; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index d846abc886..8e9c30e2ba 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -624,7 +624,7 @@ void CFDE_TextOut::LoadEllipsis() { return; } ExpandBuffer(iLength, 1); - const FX_WCHAR* pStr = (const FX_WCHAR*)m_wsEllipsis; + const FX_WCHAR* pStr = m_wsEllipsis.c_str(); int32_t* pCharWidths = m_pEllCharWidths; uint32_t dwBreakStatus; FX_WCHAR wch; @@ -873,7 +873,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) { } } void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { - const FX_WCHAR* pwsStr = (const FX_WCHAR*)m_wsText; + const FX_WCHAR* pwsStr = m_wsText.c_str(); FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); int32_t iPieceWidths = 0; FDE_LPTTOPIECE pPiece = pLine->GetPtrAt(0); @@ -990,7 +990,7 @@ int32_t CFDE_TextOut::GetCharRects(FDE_LPTTOPIECE pPiece) { void CFDE_TextOut::ToTextRun(const FDE_LPTTOPIECE pPiece, FX_TXTRUN& tr) { tr.pAccess = NULL; tr.pIdentity = NULL; - tr.pStr = (const FX_WCHAR*)m_wsText + pPiece->iStartChar; + tr.pStr = (m_wsText + pPiece->iStartChar).c_str(); tr.pWidths = m_pCharWidths + pPiece->iStartChar; tr.iLength = pPiece->iChars; tr.pFont = m_pFont; diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index 25c4c5abe5..f678cf5cf8 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -397,10 +397,10 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { ws += L"UTF-8"; } ws += L"\"?>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } else { - ws.Format(L"m_wsTarget); - pXMLStream->WriteString(ws, ws.GetLength()); + ws.Format(L"m_wsTarget.c_str()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFX_WideStringArray& attributes = pInstruction->m_Attributes; int32_t i, iCount = attributes.GetSize(); CFX_WideString wsValue; @@ -416,7 +416,7 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { wsValue.Replace(L"\"", L"""); ws += wsValue; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } CFX_WideStringArray& targetdata = pInstruction->m_TargetData; iCount = targetdata.GetSize(); @@ -424,17 +424,17 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { ws = L" \""; ws += targetdata[i]; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } ws = L"?>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } } break; case FDE_XMLNODE_Element: { CFX_WideString ws; ws = L"<"; ws += ((CFDE_XMLElement*)pNode)->m_wsTag; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes; int32_t iCount = attributes.GetSize(); CFX_WideString wsValue; @@ -450,14 +450,14 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { wsValue.Replace(L"\"", L"""); ws += wsValue; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } if (pNode->m_pChild == NULL) { ws = L"\n/>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } else { ws = L"\n>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFDE_XMLNode* pChild = pNode->m_pChild; while (pChild != NULL) { pChild->SaveXMLNode(pXMLStream); @@ -466,7 +466,7 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { ws = L"m_wsTag; ws += L"\n>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } } break; case FDE_XMLNODE_Text: { @@ -476,13 +476,13 @@ void CFDE_XMLNode::SaveXMLNode(IFX_Stream* pXMLStream) { ws.Replace(L">", L">"); ws.Replace(L"\'", L"'"); ws.Replace(L"\"", L"""); - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } break; case FDE_XMLNODE_CharData: { CFX_WideString ws = L"m_wsCharData; ws += L"]]>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } break; case FDE_XMLNODE_Unknown: break; @@ -580,7 +580,7 @@ int32_t CFDE_XMLInstruction::GetInteger(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FXSYS_wtoi((const FX_WCHAR*)m_Attributes[i + 1]); + return FXSYS_wtoi(m_Attributes[i + 1].c_str()); } } return iDefValue; @@ -596,7 +596,7 @@ FX_FLOAT CFDE_XMLInstruction::GetFloat(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FX_wcstof((const FX_WCHAR*)m_Attributes[i + 1]); + return FX_wcstof(m_Attributes[i + 1].c_str()); } } return fDefValue; @@ -700,11 +700,11 @@ void CFDE_XMLElement::GetNamespaceURI(CFX_WideString& wsNamespace) const { break; } CFDE_XMLElement* pElement = (CFDE_XMLElement*)pNode; - if (!pElement->HasAttribute(wsAttri)) { + if (!pElement->HasAttribute(wsAttri.c_str())) { pNode = pNode->GetNodeItem(CFDE_XMLNode::Parent); continue; } - pElement->GetString(wsAttri, wsNamespace); + pElement->GetString(wsAttri.c_str(), wsNamespace); break; } } @@ -766,7 +766,7 @@ int32_t CFDE_XMLElement::GetInteger(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FXSYS_wtoi((const FX_WCHAR*)m_Attributes[i + 1]); + return FXSYS_wtoi(m_Attributes[i + 1].c_str()); } } return iDefValue; @@ -782,7 +782,7 @@ FX_FLOAT CFDE_XMLElement::GetFloat(const FX_WCHAR* pwsAttriName, int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return FX_wcstof((const FX_WCHAR*)m_Attributes[i + 1]); + return FX_wcstof(m_Attributes[i + 1].c_str()); } } return fDefValue; @@ -955,10 +955,10 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { ws += L"UTF-8"; } ws += L"\"?>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } else { - ws.Format(L"m_wsTarget); - pXMLStream->WriteString(ws, ws.GetLength()); + ws.Format(L"m_wsTarget.c_str()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFX_WideStringArray& attributes = pInstruction->m_Attributes; int32_t i, iCount = attributes.GetSize(); CFX_WideString wsValue; @@ -974,7 +974,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { wsValue.Replace(L"\"", L"""); ws += wsValue; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } CFX_WideStringArray& targetdata = pInstruction->m_TargetData; iCount = targetdata.GetSize(); @@ -982,17 +982,17 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { ws = L" \""; ws += targetdata[i]; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } ws = L"?>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } } break; case FDE_XMLNODE_Element: { CFX_WideString ws; ws = L"<"; ws += ((CFDE_XMLElement*)pNode)->m_wsTag; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFX_WideStringArray& attributes = ((CFDE_XMLElement*)pNode)->m_Attributes; int32_t iCount = attributes.GetSize(); CFX_WideString wsValue; @@ -1008,14 +1008,14 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { wsValue.Replace(L"\"", L"""); ws += wsValue; ws += L"\""; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } if (pNode->m_pChild == NULL) { ws = L"\n/>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } else { ws = L"\n>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); CFDE_XMLNode* pChild = pNode->m_pChild; while (pChild != NULL) { SaveXMLNode(pXMLStream, static_cast(pChild)); @@ -1024,7 +1024,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { ws = L"m_wsTag; ws += L"\n>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } } break; case FDE_XMLNODE_Text: { @@ -1034,13 +1034,13 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { ws.Replace(L">", L">"); ws.Replace(L"\'", L"'"); ws.Replace(L"\"", L"""); - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } break; case FDE_XMLNODE_CharData: { CFX_WideString ws = L"m_wsCharData; ws += L"]]>"; - pXMLStream->WriteString(ws, ws.GetLength()); + pXMLStream->WriteString(ws.c_str(), ws.GetLength()); } break; case FDE_XMLNODE_Unknown: break; diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp index b98f1e141f..ac3c74f620 100644 --- a/xfa/fee/fde_txtedtengine.cpp +++ b/xfa/fee/fde_txtedtengine.cpp @@ -1195,7 +1195,7 @@ void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { CFX_ArrayTemplate PosArr; int32_t nLength = wsText.GetLength(); int32_t i = 0; - FX_WCHAR* lpPos = (FX_WCHAR*)(const FX_WCHAR*)wsText; + FX_WCHAR* lpPos = const_cast(wsText.c_str()); for (i = 0; i < nLength; i++, lpPos++) { if (*lpPos == m_wLineEnd) { *lpPos = wc; @@ -1226,7 +1226,7 @@ void CFDE_TxtEdtEngine::RecoverParagEnd(CFX_WideString& wsText) { wsText = wsTemp; } else { int32_t nLength = wsText.GetLength(); - FX_WCHAR* lpBuf = (FX_WCHAR*)(const FX_WCHAR*)wsText; + FX_WCHAR* lpBuf = const_cast(wsText.c_str()); for (int32_t i = 0; i < nLength; i++, lpBuf++) { if (*lpBuf == m_wLineEnd) { *lpBuf = wc; @@ -1527,7 +1527,7 @@ FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { } pTextOut->SetStyles(dwStyle); wsText += L"\n"; - pTextOut->CalcLogicSize(wsText, wsText.GetLength(), rcText); + pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), rcText); pTextOut->Release(); wsText.Delete(wsText.GetLength() - 1); if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz) && diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 1a3b239184..7ee76fa4b4 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -388,7 +388,7 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, FXSYS_assert(pszSrcFileName != NULL && FXSYS_wcslen(pszSrcFileName) > 0); #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \ _FX_OS_ == _FX_WIN64_ - CFX_WideString wsMode; + const FX_WCHAR* wsMode; if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Append) { wsMode = L"a+b"; diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp index 2e550f7c08..12271fbb64 100644 --- a/xfa/fgas/font/fgas_fontutils.cpp +++ b/xfa/fgas/font/fgas_fontutils.cpp @@ -42,7 +42,7 @@ uint32_t FGAS_GetFontFamilyHash(const FX_WCHAR* pszFontFamily, wsFont += L"Italic"; } wsFont += wCodePage; - return FX_HashCode_String_GetW((const FX_WCHAR*)wsFont, wsFont.GetLength()); + return FX_HashCode_String_GetW(wsFont.c_str(), wsFont.GetLength()); } static const FGAS_FONTUSB g_FXGdiFontUSBTable[] = { {0x0000, 0x007F, 0, 1252}, {0x0080, 0x00FF, 1, 1252}, diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 0ef80a3075..ed41076535 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -514,11 +514,11 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, CFX_WideString wsFamily; GetFamilyName(wsFamily); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode( - wUnicode, GetFontStyles(), (const FX_WCHAR*)wsFamily); + IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(), + wsFamily.c_str()); #else IFX_Font* pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), - (const FX_WCHAR*)wsFamily); + wsFamily.c_str()); if (NULL == pFont) { pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL); } diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 89087aacf8..6e707bf9cf 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -1504,7 +1504,7 @@ void CFX_FontMgrImp::GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB) { } int32_t CFX_FontMgrImp::IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2) { - if (Name1.Find((const FX_WCHAR*)Name2) != -1) { + if (Name1.Find(Name2.c_str()) != -1) { return 1; } return 0; diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp index 1ef92f0d5f..dc4b3d220c 100644 --- a/xfa/fgas/localization/fgas_locale.cpp +++ b/xfa/fgas/localization/fgas_locale.cpp @@ -217,7 +217,7 @@ void CFX_Locale::GetTimeZone(FX_TIMEZONE& tz) const { CXML_Element* pxmlTimeZone = m_pElement->GetElement("", "timeZone"); if (pxmlTimeZone) { CFX_WideString wsTimeZone = pxmlTimeZone->GetContent(0); - FX_ParseTimeZone(wsTimeZone, wsTimeZone.GetLength(), tz); + FX_ParseTimeZone(wsTimeZone.c_str(), wsTimeZone.GetLength(), tz); } } void CFX_Locale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const { @@ -315,7 +315,7 @@ static FX_BOOL FX_WStringToNumeric(const CFX_WideString& wsValue, int32_t cc = 0; bool bNegative = false; bool bExpSign = false; - const FX_WCHAR* str = (const FX_WCHAR*)wsValue; + const FX_WCHAR* str = wsValue.c_str(); int32_t len = wsValue.GetLength(); while (cc < len && FX_IsSpace(str[cc])) cc++; @@ -462,7 +462,7 @@ CFX_FormatString::~CFX_FormatString() {} void CFX_FormatString::SplitFormatString(const CFX_WideString& wsFormatString, CFX_WideStringArray& wsPatterns) { int32_t iStrLen = wsFormatString.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsFormatString; + const FX_WCHAR* pStr = wsFormatString.c_str(); const FX_WCHAR* pToken = pStr; const FX_WCHAR* pEnd = pStr + iStrLen; FX_BOOL iQuote = FALSE; @@ -573,7 +573,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; + const FX_WCHAR* pStr = wsPattern.c_str(); FX_BOOL bBraceOpen = FALSE; while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -596,7 +596,7 @@ FX_LOCALECATEGORY CFX_FormatString::GetCategory( ccf++; } uint32_t dwHash = - FX_HashCode_String_GetW(wsCategory, wsCategory.GetLength()); + FX_HashCode_String_GetW(wsCategory.c_str(), wsCategory.GetLength()); if (dwHash == FX_LOCALECATEGORY_DateHash) { if (eCategory == FX_LOCALECATEGORY_Time) { return FX_LOCALECATEGORY_DateTime; @@ -633,13 +633,13 @@ static uint16_t FX_WStringToLCID(const FX_WCHAR* pstrLCID) { return (uint16_t)wcstol((wchar_t*)pstrLCID, &pEnd, 16); } uint16_t CFX_FormatString::GetLCID(const CFX_WideString& wsPattern) { - return FX_WStringToLCID(GetLocaleName(wsPattern)); + return FX_WStringToLCID(GetLocaleName(wsPattern).c_str()); } CFX_WideString CFX_FormatString::GetLocaleName( const CFX_WideString& wsPattern) { int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; + const FX_WCHAR* pStr = wsPattern.c_str(); while (ccf < iLenf) { if (pStr[ccf] == '\'') { FX_GetLiteralText(pStr, ccf, iLenf); @@ -661,7 +661,7 @@ IFX_Locale* CFX_FormatString::GetTextFormat(const CFX_WideString& wsPattern, IFX_Locale* pLocale = NULL; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; + const FX_WCHAR* pStr = wsPattern.c_str(); FX_BOOL bBrackOpen = FALSE; while (ccf < iLenf) { if (pStr[ccf] == '\'') { @@ -717,7 +717,7 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, IFX_Locale* pLocale = NULL; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; + const FX_WCHAR* pStr = wsPattern.c_str(); FX_BOOL bFindDot = FALSE; FX_BOOL bBrackOpen = FALSE; while (ccf < iLenf) { @@ -755,8 +755,8 @@ IFX_Locale* CFX_FormatString::GetNumericFormat(const CFX_WideString& wsPattern, while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { wsSubCategory += pStr[ccf++]; } - uint32_t dwSubHash = - FX_HashCode_String_GetW(wsSubCategory, wsSubCategory.GetLength()); + uint32_t dwSubHash = FX_HashCode_String_GetW( + wsSubCategory.c_str(), wsSubCategory.GetLength()); FX_LOCALENUMSUBCATEGORY eSubCategory = FX_LOCALENUMPATTERN_Decimal; for (int32_t i = 0; i < g_iFXLocaleNumSubCatCount; i++) { if (g_FXLocaleNumSubCatData[i].uHash == dwSubHash) { @@ -816,14 +816,13 @@ static FX_BOOL FX_GetNumericDotIndex(const CFX_WideString& wsNum, int32_t& iDotIndex) { int32_t ccf = 0; int32_t iLenf = wsNum.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsNum; + const FX_WCHAR* pStr = wsNum.c_str(); int32_t iLenDot = wsDotSymbol.GetLength(); while (ccf < iLenf) { if (pStr[ccf] == '\'') { FX_GetLiteralText(pStr, ccf, iLenf); } else if (ccf + iLenDot <= iLenf && - !FXSYS_wcsncmp(pStr + ccf, (const FX_WCHAR*)wsDotSymbol, - iLenDot)) { + !FXSYS_wcsncmp(pStr + ccf, wsDotSymbol.c_str(), iLenDot)) { iDotIndex = ccf; return TRUE; } @@ -849,9 +848,9 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, return FALSE; } int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; + const FX_WCHAR* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { switch (pStrPattern[iPattern]) { @@ -860,8 +859,7 @@ FX_BOOL CFX_FormatString::ParseText(const CFX_WideString& wsSrcText, FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || - FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { wsValue = wsSrcText; return FALSE; } @@ -933,9 +931,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; + const FX_WCHAR* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); - const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; + const FX_WCHAR* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); double dbRetValue = 0; double coeff = 1; @@ -957,8 +955,8 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + if (cc < 0 || + FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc--; @@ -995,8 +993,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1009,8 +1006,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1036,7 +1032,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, continue; } else if (cc - iMinusLen + 1 > 0 && !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), - (const FX_WCHAR*)wsMinus, iMinusLen)) { + wsMinus.c_str(), iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1053,8 +1049,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { return FALSE; } cc--; @@ -1118,7 +1113,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { + FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { return FALSE; } cc--; @@ -1139,8 +1134,8 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (cc >= 0) { cc -= iGroupLen - 1; if (cc >= 0 && - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, - iGroupLen) == 0) { + FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == + 0) { cc--; } else { cc += iGroupLen - 1; @@ -1185,8 +1180,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc--; @@ -1227,8 +1221,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1241,8 +1234,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1267,8 +1259,8 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; continue; } else if (cc - iMinusLen + 1 > 0 && - !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), - (const FX_WCHAR*)wsMinus, iMinusLen)) { + !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), + iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1284,8 +1276,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { return FALSE; } cc--; @@ -1348,8 +1339,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { return FALSE; } cc--; @@ -1362,8 +1352,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (cc >= 0) { cc -= iGroupLen - 1; if (cc >= 0 && - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, - iGroupLen) == 0) { + FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { cc--; } else { cc += iGroupLen - 1; @@ -1410,8 +1399,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -1454,7 +1442,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc++; } else { if (cc + iMinusLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -1467,7 +1455,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc++; } else { if (cc + iMinusLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -1505,7 +1493,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { + FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { return FALSE; } cc += iSymbolLen; @@ -1560,8 +1548,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); if (cc + iSysmbolLen <= len && - !FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, - iSysmbolLen)) { + !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { cc += iSysmbolLen; } ccf++; @@ -1579,8 +1566,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case ',': { if (cc + iGroupLen <= len && - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, - iGroupLen) == 0) { + FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { cc += iGroupLen; } ccf++; @@ -1629,7 +1615,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult) { int32_t iCount = wsNum.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsNum; + const FX_WCHAR* pStr = wsNum.c_str(); FX_WCHAR* pDst = wsResult.GetBuffer(iCount); int32_t nIndex = 0; FX_BOOL bMinus = FALSE; @@ -1699,9 +1685,9 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus, wsMinus); int32_t iMinusLen = wsMinus.GetLength(); int cc = 0, ccf = 0; - const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; + const FX_WCHAR* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); - const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; + const FX_WCHAR* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); FX_BOOL bHavePercentSymbol = FALSE; FX_BOOL bNeg = FALSE; @@ -1720,8 +1706,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, CFX_WideString wsLiteral = FX_GetLiteralTextReverse(strf, ccf); int32_t iLiteralLen = wsLiteral.GetLength(); cc -= iLiteralLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc--; @@ -1759,8 +1744,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1773,8 +1757,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; } else { cc -= iMinusLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } cc--; @@ -1799,8 +1782,8 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc--; continue; } else if (cc - iMinusLen + 1 > 0 && - !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), - (const FX_WCHAR*)wsMinus, iMinusLen)) { + !FXSYS_wcsncmp(str + (cc - iMinusLen + 1), wsMinus.c_str(), + iMinusLen)) { bExpSign = TRUE; cc -= iMinusLen; } else { @@ -1816,8 +1799,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_CurrencySymbol, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); cc -= iSymbolLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { return FALSE; } cc--; @@ -1880,8 +1862,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); cc -= iSysmbolLen - 1; - if (cc < 0 || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSysmbolLen)) { + if (cc < 0 || FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { return FALSE; } cc--; @@ -1894,8 +1875,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, if (cc >= 0) { cc -= iGroupLen - 1; if (cc >= 0 && - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, - iGroupLen) == 0) { + FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { cc--; } else { cc += iGroupLen - 1; @@ -1950,8 +1930,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -1989,7 +1968,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc++; } else { if (cc + iMinusLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -2002,7 +1981,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, cc++; } else { if (cc + iMinusLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsMinus, iMinusLen)) { + FXSYS_wcsncmp(str + cc, wsMinus.c_str(), iMinusLen)) { return FALSE; } bNeg = TRUE; @@ -2040,7 +2019,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, wsSymbol); int32_t iSymbolLen = wsSymbol.GetLength(); if (cc + iSymbolLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, iSymbolLen)) { + FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSymbolLen)) { return FALSE; } cc += iSymbolLen; @@ -2095,8 +2074,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Percent, wsSymbol); int32_t iSysmbolLen = wsSymbol.GetLength(); if (cc + iSysmbolLen <= len && - !FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsSymbol, - iSysmbolLen)) { + !FXSYS_wcsncmp(str + cc, wsSymbol.c_str(), iSysmbolLen)) { cc += iSysmbolLen; } ccf++; @@ -2113,8 +2091,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum, } break; case ',': { if (cc + iGroupLen <= len && - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsGroupSymbol, - iGroupLen) == 0) { + FXSYS_wcsncmp(str + cc, wsGroupSymbol.c_str(), iGroupLen) == 0) { cc += iGroupLen; } ccf++; @@ -2174,7 +2151,7 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( FX_LOCALECATEGORY eCategory = FX_LOCALECATEGORY_Unknown; int32_t ccf = 0; int32_t iLenf = wsPattern.GetLength(); - const FX_WCHAR* pStr = (const FX_WCHAR*)wsPattern; + const FX_WCHAR* pStr = wsPattern.c_str(); int32_t iFindCategory = 0; FX_BOOL bBraceOpen = FALSE; while (ccf < iLenf) { @@ -2232,8 +2209,8 @@ FX_DATETIMETYPE CFX_FormatString::GetDateTimeFormat( while (ccf < iLenf && pStr[ccf] != '(' && pStr[ccf] != '{') { wsSubCategory += pStr[ccf++]; } - uint32_t dwSubHash = - FX_HashCode_String_GetW(wsSubCategory, wsSubCategory.GetLength()); + uint32_t dwSubHash = FX_HashCode_String_GetW( + wsSubCategory.c_str(), wsSubCategory.GetLength()); FX_LOCALEDATETIMESUBCATEGORY eSubCategory = FX_LOCALEDATETIMESUBCATEGORY_Medium; for (int32_t i = 0; i < g_iFXLocaleDateTimeSubCatCount; i++) { @@ -2310,16 +2287,16 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, int32_t month = 1; int32_t day = 1; int32_t ccf = 0; - const FX_WCHAR* str = (const FX_WCHAR*)wsDate; + const FX_WCHAR* str = wsDate.c_str(); int32_t len = wsDate.GetLength(); - const FX_WCHAR* strf = (const FX_WCHAR*)wsDatePattern; + const FX_WCHAR* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); while (cc < len && ccf < lenf) { if (strf[ccf] == '\'') { CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { + FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -2388,7 +2365,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, if (wsMonthNameAbbr.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((const FX_WCHAR*)wsMonthNameAbbr, str + cc, + if (!FXSYS_wcsncmp(wsMonthNameAbbr.c_str(), str + cc, wsMonthNameAbbr.GetLength())) { break; } @@ -2405,7 +2382,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, if (wsMonthName.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((const FX_WCHAR*)wsMonthName, str + cc, + if (!FXSYS_wcsncmp(wsMonthName.c_str(), str + cc, wsMonthName.GetLength())) { break; } @@ -2424,7 +2401,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, if (wsDayNameAbbr.IsEmpty()) { continue; } - if (!FXSYS_wcsncmp((const FX_WCHAR*)wsDayNameAbbr, str + cc, + if (!FXSYS_wcsncmp(wsDayNameAbbr.c_str(), str + cc, wsDayNameAbbr.GetLength())) { break; } @@ -2440,7 +2417,7 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate, if (wsDayName == L"") { continue; } - if (!FXSYS_wcsncmp((const FX_WCHAR*)wsDayName, str + cc, + if (!FXSYS_wcsncmp(wsDayName.c_str(), str + cc, wsDayName.GetLength())) { break; } @@ -2527,9 +2504,9 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, uint8_t second = 0; uint16_t millisecond = 0; int32_t ccf = 0; - const FX_WCHAR* str = (const FX_WCHAR*)wsTime; + const FX_WCHAR* str = wsTime.c_str(); int len = wsTime.GetLength(); - const FX_WCHAR* strf = (const FX_WCHAR*)wsTimePattern; + const FX_WCHAR* strf = wsTimePattern.c_str(); int lenf = wsTimePattern.GetLength(); FX_BOOL bHasA = FALSE; FX_BOOL bPM = FALSE; @@ -2538,7 +2515,7 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime, CFX_WideString wsLiteral = FX_GetLiteralText(strf, ccf, lenf); int32_t iLiteralLen = wsLiteral.GetLength(); if (cc + iLiteralLen > len || - FXSYS_wcsncmp(str + cc, (const FX_WCHAR*)wsLiteral, iLiteralLen)) { + FXSYS_wcsncmp(str + cc, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } cc += iLiteralLen; @@ -2764,9 +2741,9 @@ FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; + const FX_WCHAR* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { @@ -2774,8 +2751,7 @@ FX_BOOL CFX_FormatString::ParseZero(const CFX_WideString& wsSrcText, FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || - FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } iText += iLiteralLen; @@ -2795,9 +2771,9 @@ FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; + const FX_WCHAR* pStrText = wsSrcText.c_str(); int32_t iLenText = wsSrcText.GetLength(); - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern && iText < iLenText) { if (pStrPattern[iPattern] == '\'') { @@ -2805,8 +2781,7 @@ FX_BOOL CFX_FormatString::ParseNull(const CFX_WideString& wsSrcText, FX_GetLiteralText(pStrPattern, iPattern, iLenPattern); int32_t iLiteralLen = wsLiteral.GetLength(); if (iText + iLiteralLen > iLenText || - FXSYS_wcsncmp(pStrText + iText, (const FX_WCHAR*)wsLiteral, - iLiteralLen)) { + FXSYS_wcsncmp(pStrText + iText, wsLiteral.c_str(), iLiteralLen)) { return FALSE; } iText += iLiteralLen; @@ -2834,8 +2809,8 @@ FX_BOOL CFX_FormatString::FormatText(const CFX_WideString& wsSrcText, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"text"), wsTextFormat); int32_t iText = 0, iPattern = 0; - const FX_WCHAR* pStrText = (const FX_WCHAR*)wsSrcText; - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrText = wsSrcText.c_str(); + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { switch (pStrPattern[iPattern]) { @@ -2913,7 +2888,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, return FALSE; } int32_t cc = 0, ccf = 0; - const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; + const FX_WCHAR* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); CFX_WideString wsSrcNum = wsInputNum; wsSrcNum.TrimLeft('0'); @@ -2983,7 +2958,7 @@ FX_BOOL CFX_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, wsSrcNum.Delete(0, 1); } FX_BOOL bAddNeg = FALSE; - const FX_WCHAR* str = (const FX_WCHAR*)wsSrcNum; + const FX_WCHAR* str = wsSrcNum.c_str(); int len = wsSrcNum.GetLength(); int dot_index = wsSrcNum.Find('.'); if (dot_index == -1) { @@ -3346,7 +3321,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, return FALSE; } int32_t cc = 0, ccf = 0; - const FX_WCHAR* strf = (const FX_WCHAR*)wsNumFormat; + const FX_WCHAR* strf = wsNumFormat.c_str(); int lenf = wsNumFormat.GetLength(); double dbOrgRaw = lcNum.GetDouble(); double dbRetValue = dbOrgRaw; @@ -3409,7 +3384,7 @@ FX_BOOL CFX_FormatString::FormatLCNumeric(CFX_LCNumeric& lcNum, wsNumeric.Delete(0, 1); } FX_BOOL bAddNeg = FALSE; - const FX_WCHAR* str = (const FX_WCHAR*)wsNumeric; + const FX_WCHAR* str = wsNumeric.c_str(); int len = wsNumeric.GetLength(); int dot_index = wsNumeric.Find('.'); if (dot_index == -1) { @@ -3766,7 +3741,7 @@ FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate, int32_t day = 1; uint16_t wYear = 0; int cc_start = 0, cc = 0; - const FX_WCHAR* str = (const FX_WCHAR*)wsDate; + const FX_WCHAR* str = wsDate.c_str(); int len = wsDate.GetLength(); if (len > 10) { return FALSE; @@ -3971,7 +3946,7 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern, uint8_t month = datetime.GetMonth(); uint8_t day = datetime.GetDay(); int32_t ccf = 0; - const FX_WCHAR* strf = (const FX_WCHAR*)wsDatePattern; + const FX_WCHAR* strf = wsDatePattern.c_str(); int32_t lenf = wsDatePattern.GetLength(); while (ccf < lenf) { if (strf[ccf] == '\'') { @@ -4090,7 +4065,7 @@ static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern, uint8_t second = datetime.GetSecond(); uint16_t millisecond = datetime.GetMillisecond(); int32_t ccf = 0; - const FX_WCHAR* strf = (const FX_WCHAR*)wsTimePattern; + const FX_WCHAR* strf = wsTimePattern.c_str(); int32_t lenf = wsTimePattern.GetLength(); uint16_t wHour = hour; FX_BOOL bPM = FALSE; @@ -4299,8 +4274,8 @@ FX_BOOL CFX_FormatString::FormatDateTime(const CFX_WideString& wsSrcDateTime, wsOutput); } } else { - CFX_WideStringC wsSrcDate((const FX_WCHAR*)wsSrcDateTime, iT); - CFX_WideStringC wsSrcTime((const FX_WCHAR*)wsSrcDateTime + iT + 1, + CFX_WideStringC wsSrcDate(wsSrcDateTime.c_str(), iT); + CFX_WideStringC wsSrcTime(wsSrcDateTime.c_str() + iT + 1, wsSrcDateTime.GetLength() - iT - 1); if (wsSrcDate.IsEmpty() || wsSrcTime.IsEmpty()) { return FALSE; @@ -4339,7 +4314,7 @@ FX_BOOL CFX_FormatString::FormatZero(const CFX_WideString& wsPattern, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"zero"), wsTextFormat); int32_t iPattern = 0; - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { @@ -4361,7 +4336,7 @@ FX_BOOL CFX_FormatString::FormatNull(const CFX_WideString& wsPattern, CFX_WideString wsTextFormat; GetTextFormat(wsPattern, FX_WSTRC(L"null"), wsTextFormat); int32_t iPattern = 0; - const FX_WCHAR* pStrPattern = (const FX_WCHAR*)wsTextFormat; + const FX_WCHAR* pStrPattern = wsTextFormat.c_str(); int32_t iLenPattern = wsTextFormat.GetLength(); while (iPattern < iLenPattern) { if (pStrPattern[iPattern] == '\'') { diff --git a/xfa/fgas/localization/fgas_localemgr.cpp b/xfa/fgas/localization/fgas_localemgr.cpp index 69b8638903..93e5ea0874 100644 --- a/xfa/fgas/localization/fgas_localemgr.cpp +++ b/xfa/fgas/localization/fgas_localemgr.cpp @@ -29,7 +29,7 @@ IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath, } CFX_WideString wsFullPath(pszLocalPath); wsFullPath += L"\\" + wsFileName; - IFX_FileRead* pRead = FX_CreateFileRead(wsFullPath); + IFX_FileRead* pRead = FX_CreateFileRead(wsFullPath.c_str()); if (!pRead) { continue; } @@ -39,7 +39,7 @@ IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath, if (bssp == "http://www.foxitsoftware.com/localization") { CFX_WideString wsLCID = pXmlLocale->GetAttrValue("", "lcid"); wchar_t* pEnd = NULL; - uint32_t dwLCID = wcstol(wsLCID, &pEnd, 16); + uint32_t dwLCID = wcstol(wsLCID.c_str(), &pEnd, 16); if (pLocaleMgr->m_lcid2xml.GetValueAt((void*)(uintptr_t)dwLCID)) { delete pXmlLocale; } else { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 9635ae8c4f..d60069b85e 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -77,7 +77,7 @@ FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { CFX_Matrix* pMatrix = &pParams->m_matrix; pMatrix->Concat(*pGraphics->GetMatrix()); m_pTextOut->SetMatrix(*pMatrix); - m_pTextOut->DrawLogicText(pParams->m_wsText, iLen, pParams->m_rtPart); + m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), iLen, pParams->m_rtPart); return TRUE; } void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, @@ -154,8 +154,8 @@ FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return FALSE; m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); + m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), rect); return TRUE; } FWL_ERR CFWL_WidgetTP::Initialize() { diff --git a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp index 644bb571c0..c39d3c6eb0 100644 --- a/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp +++ b/xfa/fxbarcode/BC_BufferedImageLuminanceSource.cpp @@ -99,7 +99,7 @@ CBC_BufferedImageLuminanceSource::CBC_BufferedImageLuminanceSource( } void CBC_BufferedImageLuminanceSource::Init(int32_t& e) { - IFX_FileRead* fileread = FX_CreateFileRead(m_filename); + IFX_FileRead* fileread = FX_CreateFileRead(m_filename.c_str()); m_pBitmap = CreateDIBSource(fileread); if (!m_pBitmap) { e = BCExceptionLoadFile; diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index c83895c25e..27e779510a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -87,10 +87,11 @@ FX_BOOL XFA_GetPDFContentsFromPDFXML(CFDE_XMLNode* pPDFElement, } CFX_WideString wsPDFContent; pChunkElement->GetTextData(wsPDFContent); - iBufferSize = FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), NULL); + iBufferSize = + FX_Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), NULL); pByteBuffer = FX_Alloc(uint8_t, iBufferSize + 1); pByteBuffer[iBufferSize] = '0'; // FIXME: I bet this is wrong. - FX_Base64DecodeW(wsPDFContent, wsPDFContent.GetLength(), pByteBuffer); + FX_Base64DecodeW(wsPDFContent.c_str(), wsPDFContent.GetLength(), pByteBuffer); return TRUE; } void XFA_XPDPacket_MergeRootNode(CXFA_Node* pOriginRoot, CXFA_Node* pNewRoot) { diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 9c627ea3c1..daa5fd6277 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -157,7 +157,7 @@ void CXFA_FFDocView::ShowNullTestMsg() { pAppProvider->LoadString(XFA_IDS_ValidateLimit, wsLimit); if (!wsLimit.IsEmpty()) { CFX_WideString wsTemp; - wsTemp.Format((const FX_WCHAR*)wsLimit, iRemain); + wsTemp.Format(wsLimit.c_str(), iRemain); wsMsg += FX_WSTRC(L"\n") + wsTemp; } } @@ -792,8 +792,8 @@ void CXFA_FFDocView::RunBindItems() { const bool bValueUseContent = wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); CFX_WideString wsValue, wsLabel; - uint32_t uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), - wsValueRef.GetLength()); + uint32_t uValueHash = + FX_HashCode_String_GetW(wsValueRef.c_str(), wsValueRef.GetLength()); for (int32_t i = 0; i < iCount; i++) { CXFA_Object* refObj = rs.nodes[i]; if (!refObj->IsNode()) { diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 18af171677..b56f24d366 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -131,7 +131,7 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, return TRUE; } CFX_WideString wsImage; - IFX_FileRead* pFileRead = FX_CreateFileRead(wsFilePath); + IFX_FileRead* pFileRead = FX_CreateFileRead(wsFilePath.c_str()); if (pFileRead) { int32_t nDataSize = pFileRead->GetSize(); if (nDataSize > 0) { diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 982ee00896..3232dbdac2 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -199,8 +199,7 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { pAppProvider->LoadString(XFA_IDS_ValidateNumberError, wsError); CFX_WideString wsSomField; pAcc->GetNode()->GetSOMExpression(wsSomField); - wsMessage.Format(wsError, (const FX_WCHAR*)wsText, - (const FX_WCHAR*)wsSomField); + wsMessage.Format(wsError.c_str(), wsText.c_str(), wsSomField.c_str()); pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Error, XFA_MB_OK); } diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 4e7da92370..fba296cde7 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -200,7 +200,7 @@ FX_BOOL CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { m_pNode->GetSOMExpression(wsName); if (iNameType == 2 && wsName.GetLength() >= 15) { CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0]."); - if (wsPre == CFX_WideStringC(wsName, wsPre.GetLength())) { + if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) { wsName.Delete(0, wsPre.GetLength()); } } @@ -528,7 +528,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, GetValidateCaptionName(wsCaptionName, bVersionFlag); CFX_WideString wsError; pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); - wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str()); } pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Status, XFA_MB_OK); @@ -542,8 +542,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, GetValidateCaptionName(wsCaptionName, bVersionFlag); CFX_WideString wsWarning; pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); - wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, - (const FX_WCHAR*)wsCaptionName); + wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(), + wsCaptionName.c_str()); } if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { @@ -584,18 +584,18 @@ void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider, CFX_WideString wsError; if (bVersionFlag) { pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError); - wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); return; } if (bError) { pAppProvider->LoadString(XFA_IDS_ValidateError, wsError); - wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsError.c_str(), wsCaptionName.c_str()); return; } CFX_WideString wsWarning; pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning); - wsMessage.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, - (const FX_WCHAR*)wsCaptionName); + wsMessage.Format(wsWarning.c_str(), wsCaptionName.c_str(), + wsCaptionName.c_str()); } int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { if (GetClassID() == XFA_ELEMENT_Draw) { @@ -916,7 +916,7 @@ void CXFA_WidgetAcc::CalculateTextContentSize(CFX_SizeF& size) { pTextOut->SetStyles(dwStyles); } ((CXFA_FieldLayoutData*)m_pLayoutData) - ->m_pTextOut->CalcLogicSize(wsText, wsText.GetLength(), size); + ->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), size); } FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { if (size.x > 0) { diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 542fec57a3..72952a7bd9 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1725,8 +1725,8 @@ const XFA_FONTINFO* XFA_GetFontINFOByFontName( _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ CFX_WideString wsFontNameTemp = wsFontName; wsFontNameTemp.Remove(L' '); - uint32_t dwCurFontNameHash = - FX_HashCode_String_GetW(wsFontNameTemp, wsFontNameTemp.GetLength(), TRUE); + uint32_t dwCurFontNameHash = FX_HashCode_String_GetW( + wsFontNameTemp.c_str(), wsFontNameTemp.GetLength(), TRUE); int32_t iStart = 0; int32_t iEnd = sizeof(g_XFAFontsMap) / sizeof(XFA_FONTINFO) - 1; int32_t iMid = 0; @@ -1763,7 +1763,8 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, uint16_t wCodePage) { CFX_WideString wsFontName = wsFontFamily; IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); + IFX_Font* pFont = + pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName.AsStringC()); @@ -1785,7 +1786,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, } CFX_WideString wsReplace = CFX_WideString(pReplace, pNameText - pReplace); - pFont = pFDEFontMgr->LoadFont(wsReplace, dwStyle, wCodePage); + pFont = pFDEFontMgr->LoadFont(wsReplace.c_str(), dwStyle, wCodePage); if (pFont) { break; } diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 4d987b08b9..42d0835460 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -161,8 +161,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); } m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), - pParams->m_rtPart); + m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), pParams->m_rtPart); return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); @@ -186,8 +186,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { mtPart.Concat(*pMatrix); } m_pTextOut->SetMatrix(mtPart); - m_pTextOut->DrawLogicText(pParams->m_wsText, pParams->m_wsText.GetLength(), - pParams->m_rtPart); + m_pTextOut->DrawLogicText(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), pParams->m_rtPart); return TRUE; } void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, @@ -306,8 +306,8 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); + m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), rect); return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); @@ -324,8 +324,8 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return FALSE; m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetStyles(pParams->m_dwTTOStyles); - m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(), - rect); + m_pTextOut->CalcLogicSize(pParams->m_wsText.c_str(), + pParams->m_wsText.GetLength(), rect); return TRUE; } CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 1ee0dbe6f3..ce1ce7021e 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -303,7 +303,7 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, pXMLElement->GetLocalTagName(wsName); tagProvider.SetTagNameObj(wsName); uint32_t dwHashCode = - FX_HashCode_String_GetW(wsName, wsName.GetLength(), TRUE); + FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength(), TRUE); static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); CFX_DSPATemplate lookup; tagProvider.m_bTagAviliable = @@ -584,7 +584,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( return FALSE; } int32_t iLength = wsValue.GetLength(); - const FX_WCHAR* pTabStops = wsValue; + const FX_WCHAR* pTabStops = wsValue.c_str(); int32_t iCur = 0; int32_t iLast = 0; CFX_WideString wsAlign; @@ -640,8 +640,8 @@ FX_BOOL CXFA_TextParser::GetTabstops( break; case XFA_TABSTOPSSTATUS_Location: if (ch == ' ') { - uint32_t dwHashCode = - FX_HashCode_String_GetW(wsAlign, wsAlign.GetLength(), TRUE); + uint32_t dwHashCode = FX_HashCode_String_GetW( + wsAlign.c_str(), wsAlign.GetLength(), TRUE); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); @@ -656,7 +656,7 @@ FX_BOOL CXFA_TextParser::GetTabstops( } if (!wsAlign.IsEmpty()) { uint32_t dwHashCode = - FX_HashCode_String_GetW(wsAlign, wsAlign.GetLength(), TRUE); + FX_HashCode_String_GetW(wsAlign.c_str(), wsAlign.GetLength(), TRUE); CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); pTabstopContext->Append(dwHashCode, fPos); diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index c80e4f6cca..88b29e2cd4 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -177,8 +177,7 @@ class CXFA_LinkUserData : public IFX_Unknown, public CFX_Target { } virtual uint32_t AddRef() { return ++m_dwRefCount; } - public: - const FX_WCHAR* GetLinkURL() { return m_pszURLContent; } + const FX_WCHAR* GetLinkURL() { return m_pszURLContent.c_str(); } protected: IFX_MEMAllocator* m_pAllocator; diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 68d3a374b8..ee7e6223fe 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -2123,7 +2123,7 @@ FX_BOOL CXFA_FM2JSContext::IsoDate2Local(FXJSE_HOBJECT hThis, CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display); - strLocalDate = FX_UTF8Encode(wsRet, wsRet.GetLength()); + strLocalDate = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); return TRUE; } FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, @@ -2164,7 +2164,7 @@ FX_BOOL CXFA_FM2JSContext::IsoTime2Local(FXJSE_HOBJECT hThis, CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display); - strLocalTime = FX_UTF8Encode(wsRet, wsRet.GetLength()); + strLocalTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); return TRUE; } FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, @@ -2205,7 +2205,7 @@ FX_BOOL CXFA_FM2JSContext::GetGMTTime(FXJSE_HOBJECT hThis, CFX_WideString wsRet; widgetValue.FormatPatterns(wsRet, wsFormat, pLocale, XFA_VALUEPICTURE_Display); - strGMTTime = FX_UTF8Encode(wsRet, wsRet.GetLength()); + strGMTTime = FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()); return TRUE; } int32_t CXFA_FM2JSContext::DateString2Num(const CFX_ByteStringC& szDateString) { @@ -2381,7 +2381,7 @@ void CXFA_FM2JSContext::GetLocalDateFormat(FXJSE_HOBJECT hThis, pLocale->GetDateTimeSymbols(wsSymbols); XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); } - strFormat = FX_UTF8Encode(strRet, strRet.GetLength()); + strFormat = FX_UTF8Encode(strRet.c_str(), strRet.GetLength()); } void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, int32_t iStyle, @@ -2436,7 +2436,7 @@ void CXFA_FM2JSContext::GetLocalTimeFormat(FXJSE_HOBJECT hThis, pLocale->GetDateTimeSymbols(wsSymbols); XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); } - strFormat = FX_UTF8Encode(strRet, strRet.GetLength()); + strFormat = FX_UTF8Encode(strRet.c_str(), strRet.GetLength()); } void CXFA_FM2JSContext::GetStandardDateFormat(FXJSE_HOBJECT hThis, int32_t iStyle, @@ -3250,7 +3250,8 @@ void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); javaScript = wsJavaScriptBuf.GetWideString(); FXJSE_ExecuteScript( - hContext, FX_UTF8Encode(javaScript, javaScript.GetLength()).c_str(), + hContext, + FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(), returnValue); FXJSE_Value_Set(args.GetReturnValue(), returnValue); FXJSE_Value_Release(returnValue); @@ -3367,7 +3368,7 @@ void CXFA_FM2JSContext::UnitType(FXJSE_HOBJECT hThis, unitspanString.MakeLower(); CFX_WideString wsTypeString = CFX_WideString::FromUTF8(unitspanString.AsStringC()); - const FX_WCHAR* pData = wsTypeString; + const FX_WCHAR* pData = wsTypeString.c_str(); int32_t u = 0; int32_t uLen = wsTypeString.GetLength(); while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || @@ -3727,7 +3728,7 @@ void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString, CFX_ByteTextBuf& szResultString) { CFX_WideString wsURLString = CFX_WideString::FromUTF8(szURLString); - const FX_WCHAR* pData = wsURLString; + const FX_WCHAR* pData = wsURLString.c_str(); int32_t iLen = wsURLString.GetLength(); int32_t i = 0; FX_WCHAR ch = 0; @@ -3788,7 +3789,7 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, int32_t i = 0; int32_t iCode = 0; FX_WCHAR ch = 0; - const FX_WCHAR* pData = wsHTMLString; + const FX_WCHAR* pData = wsHTMLString.c_str(); CFX_WideTextBuf wsResultBuf; while (i < iLen) { ch = *(pData + i); @@ -3862,7 +3863,7 @@ void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, int32_t i = 0; int32_t iCode = 0; FX_WCHAR ch = 0; - const FX_WCHAR* pData = wsXMLString; + const FX_WCHAR* pData = wsXMLString.c_str(); CFX_WideTextBuf wsXMLBuf; while (i < iLen) { ch = *(pData + i); @@ -4121,7 +4122,7 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, uint32_t ch = 0; int32_t iLen = wsHTMLString.GetLength(); int32_t i = 0; - const FX_WCHAR* pData = wsHTMLString; + const FX_WCHAR* pData = wsHTMLString.c_str(); int32_t iIndex = 0; CFX_WideString htmlReserve; while (i < iLen) { @@ -4183,7 +4184,7 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, int32_t iLength = wsXMLString.GetLength(); int32_t iIndex = 0; int32_t u = 0; - const FX_WCHAR* pData = wsXMLString; + const FX_WCHAR* pData = wsXMLString.c_str(); for (u = 0; u < iLength; ++u) { ch = *(pData + u); switch (ch) { @@ -4312,7 +4313,7 @@ static FX_BOOL XFA_PATTERN_STRING_Type(const CFX_ByteStringC& szPattern, } patternType = XFA_VT_NULL; wsPattern.MakeLower(); - const FX_WCHAR* pData = wsPattern; + const FX_WCHAR* pData = wsPattern.c_str(); int32_t iLength = wsPattern.GetLength(); int32_t iIndex = 0; FX_BOOL bSingleQuotation = FALSE; @@ -4442,7 +4443,7 @@ void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis, XFA_VALUEPICTURE_Display)) { FXJSE_Value_SetUTF8String( args.GetReturnValue(), - FX_UTF8Encode(wsRet, wsRet.GetLength()).AsStringC()); + FX_UTF8Encode(wsRet.c_str(), wsRet.GetLength()).AsStringC()); } else { FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); } @@ -4522,7 +4523,7 @@ void CXFA_FM2JSContext::Lower(FXJSE_HOBJECT hThis, CFX_WideTextBuf lowStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString; + const FX_WCHAR* pData = wsArgString.c_str(); int32_t iLen = argString.GetLength(); int32_t i = 0; int32_t ch = 0; @@ -5148,7 +5149,7 @@ void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis, CFX_WideTextBuf upperStringBuf; CFX_WideString wsArgString = CFX_WideString::FromUTF8(argString.AsStringC()); - const FX_WCHAR* pData = wsArgString; + const FX_WCHAR* pData = wsArgString.c_str(); int32_t iLen = wsArgString.GetLength(); int32_t i = 0; int32_t ch = 0; @@ -5537,7 +5538,7 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis, if (bFlags) { FXJSE_Value_SetUTF8String( args.GetReturnValue(), - FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()) + FX_UTF8Encode(decodedResponse.c_str(), decodedResponse.GetLength()) .AsStringC()); } else { pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); @@ -6146,8 +6147,8 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis, CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(szSomExp.AsStringC()); pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, - (const FX_WCHAR*)wsPropertyName, - (const FX_WCHAR*)wsSomExpression); + wsPropertyName.c_str(), + wsSomExpression.c_str()); } for (int32_t i = 0; i < iLength - 2; i++) { for (int32_t j = 0; j < iSizes[i]; j++) { @@ -6209,8 +6210,8 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis, CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(szSomExp.AsStringC()); pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, - (const FX_WCHAR*)wsPropertyName, - (const FX_WCHAR*)wsSomExpression); + wsPropertyName.c_str(), + wsSomExpression.c_str()); } } if (argc == 5) { @@ -6294,8 +6295,8 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis, CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(szSomExp.AsStringC()); pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, - (const FX_WCHAR*)wsPropertyName, - (const FX_WCHAR*)wsSomExpression); + wsPropertyName.c_str(), + wsSomExpression.c_str()); } for (int32_t i = 0; i < iLength - 2; i++) { for (int32_t j = 0; j < iSizes[i]; j++) { @@ -6356,8 +6357,8 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis, CFX_WideString wsSomExpression = CFX_WideString::FromUTF8(szSomExp.AsStringC()); pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, - (const FX_WCHAR*)wsPropertyName, - (const FX_WCHAR*)wsSomExpression); + wsPropertyName.c_str(), + wsSomExpression.c_str()); } } if (argc == 5) { @@ -6390,7 +6391,8 @@ void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); FXJSE_Value_SetUTF8String( args.GetReturnValue(), - FX_UTF8Encode(javaScript, javaScript.GetLength()).AsStringC()); + FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()) + .AsStringC()); } else { pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); } @@ -7230,8 +7232,8 @@ void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) { CFX_WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, iStringID); - wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); + wsMessage.FormatV(wsFormat.c_str(), arg_ptr); va_end(arg_ptr); FXJSE_ThrowMessage( - "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); + "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp index e66a42f471..c99f015fca 100644 --- a/xfa/fxfa/fm2js/xfa_fmparse.cpp +++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp @@ -964,7 +964,7 @@ CXFA_FMExpression* CXFA_FMParse::ParseForExpression() { } else { CFX_WideString ws_TempString = m_pToken->m_wstring; Error(m_pToken->m_uLinenum, FMERR_EXPECTED_TOKEN, L"upto or downto", - (const FX_WCHAR*)ws_TempString); + ws_TempString.c_str()); } NextToken(); std::unique_ptr pAccessor(ParseSimpleExpression()); diff --git a/xfa/fxfa/parser/cxfa_font.cpp b/xfa/fxfa/parser/cxfa_font.cpp index 8579fcba80..261ef1f9ea 100644 --- a/xfa/fxfa/parser/cxfa_font.cpp +++ b/xfa/fxfa/parser/cxfa_font.cpp @@ -19,14 +19,14 @@ FX_FLOAT CXFA_Font::GetBaselineShift() { FX_FLOAT CXFA_Font::GetHorizontalScale() { CFX_WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontHorizontalScale, wsValue); - int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue); + int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (FX_FLOAT)iScale : 100.0f; } FX_FLOAT CXFA_Font::GetVerticalScale() { CFX_WideString wsValue; m_pNode->TryCData(XFA_ATTRIBUTE_FontVerticalScale, wsValue); - int32_t iScale = FXSYS_wtoi((const FX_WCHAR*)wsValue); + int32_t iScale = FXSYS_wtoi(wsValue.c_str()); return iScale > 0 ? (FX_FLOAT)iScale : 100.0f; } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 0a6b5062bc..681516d8e8 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -928,8 +928,8 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, return; m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( - this, XFA_WIDGETEVENT_ListItemAdded, (void*)(const FX_WCHAR*)wsLabel, - (void*)(const FX_WCHAR*)wsValue, (void*)(uintptr_t)nIndex); + this, XFA_WIDGETEVENT_ListItemAdded, (void*)wsLabel.c_str(), + (void*)wsValue.c_str(), (void*)(uintptr_t)nIndex); } void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, @@ -1125,7 +1125,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) { CXFA_Node* pUIChild = GetUIChild(); CFX_WideString wsDataLength; if (pUIChild->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { - val = FXSYS_wtoi(wsDataLength); + val = FXSYS_wtoi(wsDataLength.c_str()); return TRUE; } return FALSE; @@ -1159,7 +1159,7 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t& val) { CXFA_Node* pUIChild = GetUIChild(); CFX_WideString wsECLevel; if (pUIChild->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, wsECLevel)) { - val = FXSYS_wtoi(wsECLevel); + val = FXSYS_wtoi(wsECLevel.c_str()); return TRUE; } return FALSE; @@ -1239,11 +1239,11 @@ FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) { FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':'); FX_FLOAT fRatio = 0; if (ptPos >= 0) { - fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio); + fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio.c_str()); } else { int32_t fA, fB; - fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos)); - fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1)); + fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos).c_str()); + fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1).c_str()); if (fB) fRatio = (FX_FLOAT)fA / fB; } diff --git a/xfa/fxfa/parser/xfa_basic_imp.cpp b/xfa/fxfa/parser/xfa_basic_imp.cpp index 07f1b82301..112e247016 100644 --- a/xfa/fxfa/parser/xfa_basic_imp.cpp +++ b/xfa/fxfa/parser/xfa_basic_imp.cpp @@ -599,7 +599,7 @@ int32_t CXFA_WideTextRead::ReadString(FX_WCHAR* pStr, if (iMaxLength > m_wsBuffer.GetLength() - m_iPosition) { iMaxLength = m_wsBuffer.GetLength() - m_iPosition; } - FXSYS_wcsncpy(pStr, (const FX_WCHAR*)m_wsBuffer + m_iPosition, iMaxLength); + FXSYS_wcsncpy(pStr, m_wsBuffer.c_str() + m_iPosition, iMaxLength); m_iPosition += iMaxLength; bEOS = IsEOF(); return iMaxLength; diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp index ea924165d1..a75a8ea72c 100644 --- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp @@ -563,8 +563,8 @@ static CXFA_Node* XFA_NodeMerge_CloneOrMergeInstanceManager( CXFA_NodeArray& subforms) { CFX_WideStringC wsSubformName = pTemplateNode->GetCData(XFA_ATTRIBUTE_Name); CFX_WideString wsInstMgrNodeName = FX_WSTRC(L"_") + wsSubformName; - uint32_t dwInstNameHash = - FX_HashCode_String_GetW(wsInstMgrNodeName, wsInstMgrNodeName.GetLength()); + uint32_t dwInstNameHash = FX_HashCode_String_GetW( + wsInstMgrNodeName.c_str(), wsInstMgrNodeName.GetLength()); CXFA_Node* pExistingNode = XFA_DataMerge_FindFormDOMInstance( pDocument, XFA_ELEMENT_InstanceManager, dwInstNameHash, pFormParent); if (pExistingNode) { diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp index 9bdee05a55..2b848ab1b3 100644 --- a/xfa/fxfa/parser/xfa_document_imp.cpp +++ b/xfa/fxfa/parser/xfa_document_imp.cpp @@ -264,7 +264,7 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( CFX_WideStringC wsTemplateURIPrefix = XFA_GetPacketByIndex(XFA_PACKET_Template)->pURI; FX_STRSIZE nPrefixLength = wsTemplateURIPrefix.GetLength(); - if (CFX_WideStringC(wsTemplateNS, wsTemplateNS.GetLength()) != + if (CFX_WideStringC(wsTemplateNS.c_str(), wsTemplateNS.GetLength()) != wsTemplateURIPrefix) { return XFA_VERSION_UNKNOWN; } @@ -272,10 +272,11 @@ XFA_VERSION CXFA_Document::RecognizeXFAVersionNumber( if (nDotPos == (FX_STRSIZE)-1) { return XFA_VERSION_UNKNOWN; } - int8_t iMajor = - FXSYS_wtoi(wsTemplateNS.Mid(nPrefixLength, nDotPos - nPrefixLength)); + int8_t iMajor = FXSYS_wtoi( + wsTemplateNS.Mid(nPrefixLength, nDotPos - nPrefixLength).c_str()); int8_t iMinor = FXSYS_wtoi( - wsTemplateNS.Mid(nDotPos + 1, wsTemplateNS.GetLength() - nDotPos - 2)); + wsTemplateNS.Mid(nDotPos + 1, wsTemplateNS.GetLength() - nDotPos - 2) + .c_str()); XFA_VERSION eVersion = (XFA_VERSION)((int32_t)iMajor * 100 + iMinor); if (eVersion < XFA_VERSION_MIN || eVersion > XFA_VERSION_MAX) { return XFA_VERSION_UNKNOWN; @@ -390,27 +391,25 @@ void CXFA_Document::DoProtoMerge() { if (uSharpPos < 0) { wsURI = wsUseVal; } else { - wsURI = CFX_WideStringC((const FX_WCHAR*)wsUseVal, uSharpPos); + wsURI = CFX_WideStringC(wsUseVal.c_str(), uSharpPos); FX_STRSIZE uLen = wsUseVal.GetLength(); if (uLen >= uSharpPos + 5 && - CFX_WideStringC((const FX_WCHAR*)wsUseVal + uSharpPos, 5) == + CFX_WideStringC(wsUseVal.c_str() + uSharpPos, 5) == FX_WSTRC(L"#som(") && wsUseVal[uLen - 1] == ')') { - wsSOM = CFX_WideStringC((const FX_WCHAR*)wsUseVal + uSharpPos + 5, + wsSOM = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 5, uLen - 1 - uSharpPos - 5); } else { - wsID = CFX_WideStringC((const FX_WCHAR*)wsUseVal + uSharpPos + 1, + wsID = CFX_WideStringC(wsUseVal.c_str() + uSharpPos + 1, uLen - uSharpPos - 1); } } } else if (pUseHrefNode->TryCData(XFA_ATTRIBUTE_Use, wsUseVal) && !wsUseVal.IsEmpty()) { if (wsUseVal[0] == '#') { - wsID = CFX_WideStringC((const FX_WCHAR*)wsUseVal + 1, - wsUseVal.GetLength() - 1); + wsID = CFX_WideStringC(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); } else { - wsSOM = - CFX_WideStringC((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); + wsSOM = CFX_WideStringC(wsUseVal.c_str(), wsUseVal.GetLength()); } } if (!wsURI.IsEmpty() && wsURI != FX_WSTRC(L".")) { diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp index feaebdd7b7..4c826b6e59 100644 --- a/xfa/fxfa/parser/xfa_document_serialize.cpp +++ b/xfa/fxfa/parser/xfa_document_serialize.cpp @@ -407,7 +407,7 @@ static void XFA_DataExporter_RegenerateFormFile_Container( wsOutput += wsAttr; } if (!wsOutput.IsEmpty()) { - pStream->WriteString((const FX_WCHAR*)wsOutput, wsOutput.GetLength()); + pStream->WriteString(wsOutput.c_str(), wsOutput.GetLength()); } CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); if (pChildNode) { @@ -436,7 +436,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, static const FX_WCHAR s_pwChecksum[] = L" checksum=\""; CFX_WideString wsChecksum = CFX_WideString::FromUTF8(pChecksum); pStream->WriteString(s_pwChecksum, FXSYS_wcslen(s_pwChecksum)); - pStream->WriteString((const FX_WCHAR*)wsChecksum, wsChecksum.GetLength()); + pStream->WriteString(wsChecksum.c_str(), wsChecksum.GetLength()); pStream->WriteString(L"\"", 1); } pStream->WriteString(L" xmlns=\"", FXSYS_wcslen(L" xmlns=\"")); @@ -450,8 +450,7 @@ void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, wsVersionNumber = FX_WSTRC(L"2.8"); } wsVersionNumber += FX_WSTRC(L"/\"\n>"); - pStream->WriteString((const FX_WCHAR*)wsVersionNumber, - wsVersionNumber.GetLength()); + pStream->WriteString(wsVersionNumber.c_str(), wsVersionNumber.GetLength()); CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); while (pChildNode) { XFA_DataExporter_RegenerateFormFile_Container(pChildNode, pStream); diff --git a/xfa/fxfa/parser/xfa_localevalue.cpp b/xfa/fxfa/parser/xfa_localevalue.cpp index 57c8054168..e36595d840 100644 --- a/xfa/fxfa/parser/xfa_localevalue.cpp +++ b/xfa/fxfa/parser/xfa_localevalue.cpp @@ -219,7 +219,7 @@ FX_FLOAT CXFA_LocaleValue::GetNum() const { int32_t nExponent = 0; int cc = 0; FX_BOOL bNegative = FALSE, bExpSign = FALSE; - const FX_WCHAR* str = (const FX_WCHAR*)m_wsValue; + const FX_WCHAR* str = m_wsValue.c_str(); int len = m_wsValue.GetLength(); while (XFA_IsSpace(str[cc]) && cc < len) { cc++; @@ -294,7 +294,7 @@ FX_DOUBLE CXFA_LocaleValue::GetDoubleNum() const { int32_t nExponent = 0; int32_t cc = 0; FX_BOOL bNegative = FALSE, bExpSign = FALSE; - const FX_WCHAR* str = (const FX_WCHAR*)m_wsValue; + const FX_WCHAR* str = m_wsValue.c_str(); int len = m_wsValue.GetLength(); while (XFA_IsSpace(str[cc]) && cc < len) { cc++; @@ -615,7 +615,7 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalDate(const CFX_WideString& wsDate, uint16_t wYear = 0; uint16_t wMonth = 0; uint16_t wDay = 0; - const FX_WCHAR* pDate = (const FX_WCHAR*)wsDate; + const FX_WCHAR* pDate = wsDate.c_str(); int nIndex = 0, nStart = 0; while (pDate[nIndex] != '\0' && nIndex < wCountY) { if (!XFA_IsDigit(pDate[nIndex])) { @@ -701,7 +701,7 @@ FX_BOOL CXFA_LocaleValue::ValidateCanonicalTime(const CFX_WideString& wsTime) { uint16_t wMinute = 0; uint16_t wSecond = 0; uint16_t wFraction = 0; - const FX_WCHAR* pTime = (const FX_WCHAR*)wsTime; + const FX_WCHAR* pTime = wsTime.c_str(); int nIndex = 0; int nStart = 0; while (nIndex - nStart < wCountH && pTime[nIndex]) { diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 157d7dfa57..87941af070 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -71,10 +71,10 @@ void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) { CFX_WideString wsMessage; va_list arg_ptr; va_start(arg_ptr, iStringID); - wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); + wsMessage.FormatV(wsFormat.c_str(), arg_ptr); va_end(arg_ptr); FXJSE_ThrowMessage( - "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); + "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } static void XFA_DeleteWideString(void* pData) { @@ -753,7 +753,8 @@ void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue, CFX_WideString wsMessage; pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage); FXJSE_ThrowMessage( - "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); + "", + FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); } else { CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this); FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList, @@ -1480,11 +1481,9 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, ->GetFirstChildByClass(XFA_ELEMENT_Proto); if (!wsUseVal.IsEmpty()) { if (wsUseVal[0] == '#') { - wsID = CFX_WideString((const FX_WCHAR*)wsUseVal + 1, - wsUseVal.GetLength() - 1); + wsID = CFX_WideString(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); } else { - wsSOM = - CFX_WideString((const FX_WCHAR*)wsUseVal, wsUseVal.GetLength()); + wsSOM = wsUseVal; } } CXFA_Node* pProtoNode = NULL; @@ -1527,7 +1526,8 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, CFX_WideString wsValue; GetAttribute(eAttribute, wsValue); FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } } void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, @@ -1537,7 +1537,8 @@ void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue, CFX_WideString wsValue; GetAttribute(eAttribute, wsValue); FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); } @@ -1697,13 +1698,14 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue, classID != XFA_ELEMENT_SubmitUrl) { FXJSE_Value_SetNull(hValue); } else if (classID == XFA_ELEMENT_Integer) { - FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); + FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { CFX_Decimal decimal(content.AsStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } } @@ -1719,7 +1721,8 @@ void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue, FXJSE_Value_SetNull(hValue); } else { FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, @@ -1959,7 +1962,8 @@ void CXFA_Node::Script_Draw_DefaultValue(FXJSE_HVALUE hValue, FXJSE_Value_SetNull(hValue); } else { FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } } @@ -2012,21 +2016,24 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue, if (eUI == XFA_ELEMENT_NumericEdit && (pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) { FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } else { CFX_Decimal decimal(content.AsStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Integer) { - FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content)); + FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Boolean) { - FXJSE_Value_SetBoolean(hValue, FXSYS_wtoi(content) == 0 ? FALSE : TRUE); + FXJSE_Value_SetBoolean(hValue, + FXSYS_wtoi(content.c_str()) == 0 ? FALSE : TRUE); } else if (pNode && pNode->GetClassID() == XFA_ELEMENT_Float) { CFX_Decimal decimal(content.AsStringC()); FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); } else { FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(content, content.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(content.c_str(), content.GetLength()).AsStringC()); } } } @@ -2230,7 +2237,7 @@ void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) { if (bHasItem) { FXJSE_Value_SetUTF8String( pArguments->GetReturnValue(), - FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); + FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { FXJSE_Value_SetNull(pArguments->GetReturnValue()); } @@ -2308,7 +2315,7 @@ void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) { if (bHasItem) { FXJSE_Value_SetUTF8String( pArguments->GetReturnValue(), - FX_UTF8Encode(wsValue, wsValue.GetLength()).AsStringC()); + FX_UTF8Encode(wsValue.c_str(), wsValue.GetLength()).AsStringC()); } else { FXJSE_Value_SetNull(pArguments->GetReturnValue()); } @@ -2596,8 +2603,8 @@ void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, CFX_WideString wsLocaleName; GetLocaleName(wsLocaleName); FXJSE_Value_SetUTF8String( - hValue, - FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsStringC()); + hValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) + .AsStringC()); } } void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { @@ -2737,8 +2744,8 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) { pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); } else { - ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, - (const FX_WCHAR*)strTagName, L"name"); + ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(), + L"name"); } } else { FXJSE_Value_Set( @@ -3296,7 +3303,7 @@ int32_t CXFA_Node::InstanceManager_SetInstances(int32_t iDesired) { : wsInstManagerName.Mid(1); uint32_t dInstanceNameHash = wsInstanceName.IsEmpty() ? 0 : FX_HashCode_String_GetW( - wsInstanceName, + wsInstanceName.c_str(), wsInstanceName.GetLength()); CXFA_Node* pPrevSibling = (iDesired == 0) ? this @@ -3492,7 +3499,8 @@ void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue, CFX_WideString wsChecksum; GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE); FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(wsChecksum.c_str(), wsChecksum.GetLength()).AsStringC()); } } void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { @@ -3502,13 +3510,13 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) { CFX_WideString wsAttributeValue; CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { - static_cast(pXMLNode) - ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsStringC()), - wsAttributeValue); + static_cast(pXMLNode)->GetString( + CFX_WideString::FromUTF8(bsAttributeName.AsStringC()).c_str(), + wsAttributeValue); } FXJSE_Value_SetUTF8String( pArguments->GetReturnValue(), - FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()) + FX_UTF8Encode(wsAttributeValue.c_str(), wsAttributeValue.GetLength()) .AsStringC()); } else { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, @@ -3540,8 +3548,8 @@ void CXFA_Node::Script_Packet_RemoveAttribute(CFXJSE_Arguments* pArguments) { CFDE_XMLNode* pXMLNode = GetXMLMappingNode(); if (pXMLNode && pXMLNode->GetType() == FDE_XMLNODE_Element) { CFDE_XMLElement* pXMLElement = static_cast(pXMLNode); - if (pXMLElement->HasAttribute(wsName)) { - pXMLElement->RemoveAttribute(wsName); + if (pXMLElement->HasAttribute(wsName.c_str())) { + pXMLElement->RemoveAttribute(wsName.c_str()); } } FXJSE_Value_SetNull(pArguments->GetReturnValue()); @@ -3570,7 +3578,8 @@ void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue, pXMLElement->GetTextData(wsTextData); } FXJSE_Value_SetUTF8String( - hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsStringC()); + hValue, + FX_UTF8Encode(wsTextData.c_str(), wsTextData.GetLength()).AsStringC()); } } void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) { @@ -3937,7 +3946,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, FX_BOOL bNotify, FX_BOOL bScriptModify) { void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); - OnChanging(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify); + OnChanging(eAttr, (void*)wsValue.c_str(), bNotify); if (eAttr == XFA_ATTRIBUTE_Value) { CFX_WideString* pClone = new CFX_WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); @@ -3946,7 +3955,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, if (eAttr == XFA_ATTRIBUTE_Name) UpdateNameHash(); } - OnChanged(eAttr, (void*)(const FX_WCHAR*)wsValue, bNotify, bScriptModify); + OnChanged(eAttr, (void*)wsValue.c_str(), bNotify, bScriptModify); if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && eAttr != XFA_ATTRIBUTE_BindingNode) { if (eAttr == XFA_ATTRIBUTE_Name && @@ -4006,10 +4015,10 @@ FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, FX_BOOL bNotify, FX_BOOL bScriptModify) { void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); - OnChanging(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify); + OnChanging(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify); CFX_WideString* pClone = new CFX_WideString(wsValue); SetUserData(pKey, pClone, &deleteWideStringCallBack); - OnChanged(XFA_ATTRIBUTE_Value, (void*)(const FX_WCHAR*)wsValue, bNotify, + OnChanged(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify, bScriptModify); if (IsNeedSavingXMLNode()) { FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp index 5cd28e79df..4bb47ddc5d 100644 --- a/xfa/fxfa/parser/xfa_parser_imp.cpp +++ b/xfa/fxfa/parser/xfa_parser_imp.cpp @@ -212,8 +212,8 @@ FX_BOOL XFA_FDEExtension_ResolveNamespaceQualifier( if (pNode->GetType() != FDE_XMLNODE_Element) { continue; } - if (pNode->HasAttribute(wsNSAttribute)) { - pNode->GetString(wsNSAttribute, wsNamespaceURI); + if (pNode->HasAttribute(wsNSAttribute.c_str())) { + pNode->GetString(wsNSAttribute.c_str(), wsNamespaceURI); return TRUE; } } @@ -1149,7 +1149,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode, } if (!bNeedValue) { CFX_WideString wsNilName = FX_WSTRC(L"xsi:nil"); - pXMLElement->RemoveAttribute(wsNilName); + pXMLElement->RemoveAttribute(wsNilName.c_str()); } } pXFANode->InsertChild(pXFAChild); diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index d92cdc7271..84d84bd153 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -181,7 +181,7 @@ void CXFA_ScriptContext::GlobalPropertyGetter(FXJSE_HOBJECT hObject, return; } uint32_t uHashCode = - FX_HashCode_String_GetW(wsPropName, wsPropName.GetLength()); + FX_HashCode_String_GetW(wsPropName.c_str(), wsPropName.GetLength()); if (uHashCode != XFA_HASHCODE_Layout) { CXFA_Object* pObject = lpScriptContext->GetDocument()->GetXFAObject(uHashCode); diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 619ba65fff..1b79ad94be 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -284,13 +284,13 @@ void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, (bIsProperty && refNode->GetClassID() != XFA_ELEMENT_PageSet)) { refNode->GetClassName(wsTagName); ws = wsTagName; - wsName.Format(L"#%s[%d]", (const FX_WCHAR*)ws, + wsName.Format(L"#%s[%d]", ws.c_str(), XFA_GetIndex(refNode, eLogicType, bIsProperty, TRUE)); return; } ws = refNode->GetCData(XFA_ATTRIBUTE_Name); ws.Replace(L".", L"\\."); - wsName.Format(L"%s[%d]", (const FX_WCHAR*)ws, + wsName.Format(L"%s[%d]", ws.c_str(), XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); } diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 6ebec5da9c..09f513714c 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -96,8 +96,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( bClassName = TRUE; wsName = wsName.Right(wsName.GetLength() - 1); } - findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild(ToNode(rnd.m_CurNode), - wsName, bClassName); + findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild( + ToNode(rnd.m_CurNode), wsName.c_str(), bClassName); if (findNode == NULL) { return 0; } @@ -124,7 +124,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar( return -1; } uint32_t dwNameHash = - FX_HashCode_String_GetW((const FX_WCHAR*)wsName + 1, iNameLen - 1); + FX_HashCode_String_GetW(wsName.c_str() + 1, iNameLen - 1); if (dwNameHash == XFA_HASHCODE_Xfa) { nodes.Add(rnd.m_pSC->GetDocument()->GetRoot()); } else { @@ -152,8 +152,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory( rndFind.m_pSC = rnd.m_pSC; rndFind.m_CurNode = datasets; rndFind.m_wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); - rndFind.m_uHashName = - FX_HashCode_String_GetW(rndFind.m_wsName, rndFind.m_wsName.GetLength()); + rndFind.m_uHashName = FX_HashCode_String_GetW(rndFind.m_wsName.c_str(), + rndFind.m_wsName.GetLength()); rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_dwStyles = XFA_RESOLVENODE_Children; rndFind.m_wsCondition = rnd.m_wsCondition; @@ -179,8 +179,8 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( rndFind.m_dwStyles |= XFA_RESOLVENODE_TagName; rndFind.m_dwStyles &= ~XFA_RESOLVENODE_Attributes; rndFind.m_wsName = wsName; - rndFind.m_uHashName = - FX_HashCode_String_GetW(rndFind.m_wsName, rndFind.m_wsName.GetLength()); + rndFind.m_uHashName = FX_HashCode_String_GetW(rndFind.m_wsName.c_str(), + rndFind.m_wsName.GetLength()); rndFind.m_wsCondition = wsCondition; rndFind.m_CurNode = curNode; XFA_ResolveNodes_Normal(rndFind); @@ -618,7 +618,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( wsCondition.ReleaseBuffer(nConditionCount); wsCondition.TrimLeft(); wsCondition.TrimRight(); - rnd.m_uHashName = FX_HashCode_String_GetW(wsName, wsName.GetLength()); + rnd.m_uHashName = FX_HashCode_String_GetW(wsName.c_str(), wsName.GetLength()); return nStart; } void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index 1b3dddc674..ec7a10c10d 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -197,7 +197,8 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFDE_XMLElement* pXMLElement = static_cast(pXMLNode); CFX_WideString wsTag; pXMLElement->GetLocalTagName(wsTag); - uint32_t uTag = FX_HashCode_String_GetW(wsTag, wsTag.GetLength(), TRUE); + uint32_t uTag = + FX_HashCode_String_GetW(wsTag.c_str(), wsTag.GetLength(), TRUE); if (uTag == 0x0001f714) { wsPlainText += L"\n"; } else if (uTag == 0x00000070) { @@ -321,7 +322,7 @@ FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { int32_t nExponent = 0; int32_t cc = 0; FX_BOOL bNegative = FALSE, bExpSign = FALSE; - const FX_WCHAR* str = (const FX_WCHAR*)wsValue; + const FX_WCHAR* str = wsValue.c_str(); int32_t len = wsValue.GetLength(); if (str[0] == '+') { cc++; -- cgit v1.2.3