From 659a56bcbeb12b22708fe979d12b318080d828ba Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Tue, 30 Dec 2014 16:56:12 -0800 Subject: Get rid of FX_LPCSTR cast. Follow up on https://codereview.chromium.org/733693003 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/809993004 --- core/src/fxge/android/fpf_skiafontmgr.cpp | 2 +- core/src/fxge/ge/fx_ge_fontmap.cpp | 4 ++-- core/src/fxge/win32/fx_win32_device.cpp | 10 +++++----- core/src/fxge/win32/fx_win32_dib.cpp | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 1525293ab2..a9bef8a2b8 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -208,7 +208,7 @@ static FX_DWORD FPF_SKIAGetFamilyHash(FX_BSTR bsFamily, FX_DWORD dwStyle, FX_BYT bsFont += "Serif"; } bsFont += uCharset; - return FPF_GetHashCode_StringA((FX_LPCSTR)bsFont, bsFont.GetLength(), TRUE); + return FPF_GetHashCode_StringA(bsFont.c_str(), bsFont.GetLength(), TRUE); } static FX_BOOL FPF_SkiaIsCJK(FX_BYTE uCharset) { diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 36f28f330c..22c399150d 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -287,7 +287,7 @@ extern "C" { } int _PDF_GetStandardFontName(CFX_ByteString& name) { - _AltFontName* found = (_AltFontName*)FXSYS_bsearch((FX_LPCSTR)name, g_AltFontNames, + _AltFontName* found = (_AltFontName*)FXSYS_bsearch(name.c_str(), g_AltFontNames, sizeof g_AltFontNames / sizeof (_AltFontName), sizeof (_AltFontName), compareString); if (found == NULL) { return -1; @@ -838,7 +838,7 @@ static CFX_ByteString _GetFontFamily(CFX_ByteString fontName, int nStyle) } return fontName; } - _AltFontFamily* found = (_AltFontFamily*)FXSYS_bsearch((FX_LPCSTR)fontName, g_AltFontFamilies, + _AltFontFamily* found = (_AltFontFamily*)FXSYS_bsearch(fontName.c_str(), g_AltFontFamilies, sizeof g_AltFontFamilies / sizeof (_AltFontFamily), sizeof (_AltFontFamily), compareFontFamilyString); if (found == NULL) { return fontName; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index 06e9777650..debf94d7a6 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -214,7 +214,7 @@ FX_BOOL _GetSubFontName(CFX_ByteString& name) { int size = sizeof g_JpFontNameMap; void* pFontnameMap = (void*)g_JpFontNameMap; - _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch((FX_LPCSTR)name, pFontnameMap, + _FontNameMap* found = (_FontNameMap*)FXSYS_bsearch(name.c_str(), pFontnameMap, size / sizeof (_FontNameMap), sizeof (_FontNameMap), compareString); if (found == NULL) { return FALSE; @@ -483,13 +483,13 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R int pitch = pBitmap->GetPitch(); LPBYTE pBuffer = pBitmap->GetBuffer(); CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); - ((BITMAPINFOHEADER*)(FX_LPCSTR)info)->biHeight *= -1; + ((BITMAPINFOHEADER*)info.c_str())->biHeight *= -1; FX_RECT dst_rect(0, 0, width, height); dst_rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight()); int dst_width = dst_rect.Width(); int dst_height = dst_rect.Height(); ::StretchDIBits(m_hDC, left, top, dst_width, dst_height, - 0, 0, dst_width, dst_height, pBuffer, (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS, SRCCOPY); + 0, 0, dst_width, dst_height, pBuffer, (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS, SRCCOPY); delete pBitmap; } else { CFX_DIBitmap* pBitmap = (CFX_DIBitmap*)pBitmap1; @@ -502,7 +502,7 @@ FX_BOOL CGdiDeviceDriver::GDI_SetDIBits(const CFX_DIBitmap* pBitmap1, const FX_R LPBYTE pBuffer = pBitmap->GetBuffer(); CFX_ByteString info = CFX_WindowsDIB::GetBitmapInfo(pBitmap); ::SetDIBitsToDevice(m_hDC, left, top, width, height, pSrcRect->left, pBitmap->GetHeight() - pSrcRect->bottom, - 0, pBitmap->GetHeight(), pBuffer, (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS); + 0, pBitmap->GetHeight(), pBuffer, (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); if (pBitmap != pBitmap1) { delete pBitmap; } @@ -536,7 +536,7 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchDIBits(const CFX_DIBitmap* pBitmap1, int de CFX_ByteString toStrechBitmapInfo = CFX_WindowsDIB::GetBitmapInfo(pToStrechBitmap); ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height, 0, 0, pToStrechBitmap->GetWidth(), pToStrechBitmap->GetHeight(), pToStrechBitmap->GetBuffer(), - (BITMAPINFO*)(FX_LPCSTR)toStrechBitmapInfo, DIB_RGB_COLORS, SRCCOPY); + (BITMAPINFO*)toStrechBitmapInfo.c_str(), DIB_RGB_COLORS, SRCCOPY); if (del) { delete pToStrechBitmap; } diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp index e369073cc2..2ecf539ff7 100644 --- a/core/src/fxge/win32/fx_win32_dib.cpp +++ b/core/src/fxge/win32/fx_win32_dib.cpp @@ -108,8 +108,8 @@ HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) { CFX_ByteString info = GetBitmapInfo(pBitmap); HBITMAP hBitmap = NULL; - hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)(FX_LPCSTR)info, CBM_INIT, - pBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS); + hBitmap = CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT, + pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); return hBitmap; } void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) @@ -146,7 +146,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(FX_LPCWSTR filename) return NULL; } CFX_ByteString info = GetBitmapInfo(pDIBitmap); - int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS); + int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); if (!ret) { if (pDIBitmap) { delete pDIBitmap; @@ -182,7 +182,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) return NULL; } CFX_ByteString info = GetBitmapInfo(pDIBitmap); - int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)(FX_LPCSTR)info, DIB_RGB_COLORS); + int ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(), DIB_RGB_COLORS); if (!ret) { if (pDIBitmap) { delete pDIBitmap; -- cgit v1.2.3