diff options
Diffstat (limited to 'xfa/fxfa')
24 files changed, 159 insertions, 149 deletions
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<uint32_t> 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<CXFA_FMSimpleExpression> 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<CFDE_XMLElement*>(pXMLNode) - ->GetString(CFX_WideString::FromUTF8(bsAttributeName.AsStringC()), - wsAttributeValue); + static_cast<CFDE_XMLElement*>(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<CFDE_XMLElement*>(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<CFDE_XMLElement*>(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++; |