diff options
author | tsepez <tsepez@chromium.org> | 2016-04-13 15:41:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-13 15:41:21 -0700 |
commit | b4c9f3f04673753da30011e9f1282cd5d1fa0f40 (patch) | |
tree | 9890d43409c8d60b1041de921c961067907419fb /xfa | |
parent | cdce75706de7e76e73550a0582e1fd28af324fd0 (diff) | |
download | pdfium-b4c9f3f04673753da30011e9f1282cd5d1fa0f40.tar.xz |
Remove implicit cast from CFX_ByteString to (const char*).
BUG=
Review URL: https://codereview.chromium.org/1885973002
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fgas/crt/fgas_codepage.cpp | 2 | ||||
-rw-r--r-- | xfa/fgas/crt/fgas_stream.cpp | 10 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 19 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp | 2 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp | 10 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp | 8 | ||||
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdoc.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 16 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_locale.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_object_imp.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/xfa_script_imp.cpp | 6 | ||||
-rw-r--r-- | xfa/fxjse/class.cpp | 4 |
14 files changed, 47 insertions, 47 deletions
diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 57d97db83c..4734a0005e 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -339,5 +339,5 @@ uint16_t FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) { *pBuf++ = (FX_CHAR)*pStr++; } csStr.ReleaseBuffer(iLength); - return FX_GetCodePageFromStringA(csStr, iLength); + return FX_GetCodePageFromStringA(csStr.c_str(), iLength); } diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 02fa2109d1..1a3b239184 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -420,7 +420,7 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } } #else - CFX_ByteString wsMode; + const FX_CHAR* wsMode = "rb"; if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Append) { wsMode = "a+b"; @@ -429,18 +429,16 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } else { wsMode = "r+b"; } - } else { - wsMode = "rb"; } CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName); - m_hFile = FXSYS_fopen(szFileName, wsMode); + m_hFile = FXSYS_fopen(szFileName.c_str(), wsMode); if (m_hFile == NULL) { if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Create) { - m_hFile = FXSYS_fopen(szFileName, "w+b"); + m_hFile = FXSYS_fopen(szFileName.c_str(), "w+b"); } if (m_hFile == NULL) { - m_hFile = FXSYS_fopen(szFileName, "r+b"); + m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b"); if (m_hFile == NULL) { return FALSE; } diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 7dc0272976..89087aacf8 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -491,7 +491,8 @@ Restart: if (m_FolderPaths.GetSize() < 1) { return ""; } - pCurHandle = FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1]); + pCurHandle = + FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str()); FX_HandleParentPath hpp; hpp.pFileHandle = pCurHandle; hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1]; @@ -525,7 +526,7 @@ Restart: hpp.bsParentPath = m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + bsFolderSpearator + bsName; - hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath); + hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); if (hpp.pFileHandle == NULL) { continue; } @@ -701,7 +702,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, CFX_ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); - uint32_t dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { @@ -758,7 +759,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, else bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); - uint32_t dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { if (!pFonts) @@ -859,8 +860,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, CFX_ByteString bsHash; bsHash += CFX_WideString(pszFileName).UTF8Encode(); - uint32_t dwHash = - FX_HashCode_String_GetA((const FX_CHAR*)bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); IFX_FileAccess* pFontAccess = nullptr; if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { pFontAccess = FX_CreateDefaultFileAccess(pszFileName); @@ -894,7 +894,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, if (bWantCache) { CFX_ByteString bsHash; bsHash.Format("%d, %d", (uintptr_t)pFontAccess, iFaceIndex); - dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) { if (pFont) { if (pFaceCount) @@ -1032,8 +1032,9 @@ IFX_FileRead* CFX_FontMgrImp::CreateFontStream( IFX_SystemFontInfo* pSystemFontInfo, uint32_t index) { int iExact = 0; - void* hFont = pSystemFontInfo->MapFont( - 0, 0, FXFONT_DEFAULT_CHARSET, 0, pFontMapper->GetFaceName(index), iExact); + void* hFont = + pSystemFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, + pFontMapper->GetFaceName(index).c_str(), iExact); if (!hFont) return nullptr; diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index ac05e78910..98ec75ac2f 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -211,7 +211,7 @@ int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents, patternIndex = (int32_t)ch; position++; } else { - patternIndex = FXSYS_atoi(contents.Mid(position, 2)); + patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str()); if (contents.GetAt(position + 1) < '0' || contents.GetAt(position + 1) > '9') { position += 1; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index b534602fb3..bdc5e1f2c7 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -66,9 +66,9 @@ int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } @@ -107,7 +107,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, return NULL; } m_iDataLenth = 13; - int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1)); + int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str()); int32_t parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit]; outLength = m_codeWidth; uint8_t* result = FX_Alloc(uint8_t, m_codeWidth); @@ -120,7 +120,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, } int32_t i = 0; for (i = 1; i <= 6; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); if ((parities >> (6 - i) & 1) == 1) { digit += 10; } @@ -137,7 +137,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, return NULL; } for (i = 7; i <= 12; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e); if (e != BCExceptionNO) { diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 5336867538..4427cb8970 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -76,9 +76,9 @@ int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } @@ -128,7 +128,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, } int32_t i = 0; for (i = 0; i <= 3; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 0, e); if (e != BCExceptionNO) { @@ -142,7 +142,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, return NULL; } for (i = 4; i <= 7; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e); if (e != BCExceptionNO) { diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 21ccafc20c..943384d55c 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -70,9 +70,9 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } 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; diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index c93e0bc581..29a8077bd0 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -241,8 +241,8 @@ static void FXJSE_Context_GlobalObjToString( CFX_ByteString szStringVal; szStringVal.Format("[object %s]", lpClass->name); info.GetReturnValue().Set(v8::String::NewFromUtf8( - info.GetIsolate(), (const FX_CHAR*)szStringVal, - v8::String::kNormalString, szStringVal.GetLength())); + info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString, + szStringVal.GetLength())); } else { v8::Local<v8::String> local_str = info.This() |