From b4c9f3f04673753da30011e9f1282cd5d1fa0f40 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 13 Apr 2016 15:41:21 -0700 Subject: Remove implicit cast from CFX_ByteString to (const char*). BUG= Review URL: https://codereview.chromium.org/1885973002 --- xfa/fxfa/app/xfa_ffdoc.cpp | 5 ++--- xfa/fxfa/app/xfa_ffwidget.cpp | 2 +- xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 16 ++++++++-------- xfa/fxfa/parser/xfa_locale.cpp | 4 ++-- xfa/fxfa/parser/xfa_object_imp.cpp | 2 +- xfa/fxfa/parser/xfa_script_imp.cpp | 6 ++++-- 6 files changed, 18 insertions(+), 17 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 04fe075d2c..c83895c25e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -412,9 +412,8 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, if (pCSContext) { pCSContext->GetChecksum(bsChecksum); } - bFlags = pExport->Export(pFile, pNode, 0, bsChecksum.GetLength() - ? (const FX_CHAR*)bsChecksum - : NULL); + bFlags = pExport->Export( + pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : NULL); } else { bFlags = pExport->Export(pFile); } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index f2c8ad79a0..037e6560de 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -991,7 +991,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, CFX_ByteString bsData = wsImage.UTF8Encode(); int32_t iLength = bsData.GetLength(); pImageBuffer = FX_Alloc(uint8_t, iLength); - int32_t iRead = XFA_Base64Decode((const FX_CHAR*)bsData, pImageBuffer); + int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); if (iRead > 0) { pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index e687ee53b8..68d3a374b8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -3249,9 +3249,9 @@ void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); javaScript = wsJavaScriptBuf.GetWideString(); - FXJSE_ExecuteScript(hContext, - FX_UTF8Encode(javaScript, javaScript.GetLength()), - returnValue); + FXJSE_ExecuteScript( + hContext, FX_UTF8Encode(javaScript, javaScript.GetLength()).c_str(), + returnValue); FXJSE_Value_Set(args.GetReturnValue(), returnValue); FXJSE_Value_Release(returnValue); FXJSE_Context_Release(hContext); @@ -3470,7 +3470,7 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, FXJSE_Value_SetNull(args.GetReturnValue()); } else { HValueToUTF8String(unitspanValue, unitspanString); - const FX_CHAR* pData = unitspanString; + const FX_CHAR* pData = unitspanString.c_str(); if (pData) { int32_t u = 0; while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || @@ -3505,7 +3505,7 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, unitValue = GetSimpleHValue(hThis, args, 1); CFX_ByteString unitTempString; HValueToUTF8String(unitValue, unitTempString); - const FX_CHAR* pData = unitTempString; + const FX_CHAR* pData = unitTempString.c_str(); int32_t u = 0; while (*(pData + u) == ' ' || *(pData + u) == 0x09 || *(pData + u) == 0x0B || *(pData + u) == 0x0C || @@ -4904,8 +4904,8 @@ void CXFA_FM2JSContext::Str(FXJSE_HOBJECT hThis, formatStr += CFX_ByteString::FormatInteger(iPrecision); } formatStr += "f"; - numberString.Format(formatStr, fNumber); - const FX_CHAR* pData = numberString; + numberString.Format(formatStr.c_str(), fNumber); + const FX_CHAR* pData = numberString.c_str(); int32_t iLength = numberString.GetLength(); int32_t u = 0; while (u < iLength) { @@ -6990,7 +6990,7 @@ int32_t CXFA_FM2JSContext::HValueToInteger(FXJSE_HOBJECT hThis, } else if (FXJSE_Value_IsUTF8String(hValue)) { CFX_ByteString szValue; FXJSE_Value_ToUTF8String(hValue, szValue); - iValue = FXSYS_atoi(szValue); + iValue = FXSYS_atoi(szValue.c_str()); } else { iValue = FXJSE_Value_ToInteger(hValue); } diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index b974939f41..91ca23e920 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -76,8 +76,8 @@ void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, if (!pElement) { return; } - GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, - bsSymbols.GetLength() - 1), + GetPattern(pElement, + CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1), wsName.AsStringC(), wsNumSymbol); } void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 8b8db882ea..157d7dfa57 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1730,7 +1730,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { FXJSE_Value_ToUTF8String(hValue, newValue); } - int32_t iValue = FXSYS_atoi(newValue); + int32_t iValue = FXSYS_atoi(newValue.c_str()); CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 71fec27814..d92cdc7271 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -101,7 +101,8 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, CXFA_Object* pOriginalObject = m_pThisObject; m_pThisObject = pThisObject; FXJSE_HVALUE pValue = pThisObject ? GetJSValueFromMap(pThisObject) : NULL; - FX_BOOL bRet = FXJSE_ExecuteScript(m_hJsContext, btScript, hRetValue, pValue); + FX_BOOL bRet = + FXJSE_ExecuteScript(m_hJsContext, btScript.c_str(), hRetValue, pValue); m_pThisObject = pOriginalObject; m_eScriptType = eSaveType; return bRet; @@ -466,7 +467,8 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { CreateVariablesContext(pScriptNode, pThisObject); CXFA_Object* pOriginalObject = m_pThisObject; m_pThisObject = pThisObject; - FX_BOOL bRet = FXJSE_ExecuteScript(hVariablesContext, btScript, hRetValue); + FX_BOOL bRet = + FXJSE_ExecuteScript(hVariablesContext, btScript.c_str(), hRetValue); m_pThisObject = pOriginalObject; FXJSE_Value_Release(hRetValue); return bRet; -- cgit v1.2.3