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/fgas | |
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/fgas')
-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 |
3 files changed, 15 insertions, 16 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; |