diff options
author | Bo Xu <bo_xu@foxitsoftware.com> | 2014-12-30 16:56:12 -0800 |
---|---|---|
committer | Bo Xu <bo_xu@foxitsoftware.com> | 2014-12-30 17:07:17 -0800 |
commit | c616483e834b791b92b0c0d4f99d0ea3b66f1a4f (patch) | |
tree | e9589ee48c4aeb5e0ab5e9ba0766e6d8c1f768dd /core | |
parent | bb1405dda43fd4b605fd9c2808dc0ead87f54ccc (diff) | |
download | pdfium-c616483e834b791b92b0c0d4f99d0ea3b66f1a4f.tar.xz |
XFA: merge patch from CL 733693003, get rid of FX_LPCSTR cast
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
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fxcrt/fx_string.h | 7 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 10 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp | 14 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 8 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_form.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_buffer.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 4 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_device.cpp | 10 | ||||
-rw-r--r-- | core/src/fxge/win32/fx_win32_dib.cpp | 8 |
16 files changed, 44 insertions, 37 deletions
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h index 47e8ecdf1e..d6701e3d44 100644 --- a/core/include/fxcrt/fx_string.h +++ b/core/include/fxcrt/fx_string.h @@ -184,6 +184,13 @@ public: static CFX_ByteString FromUnicode(const CFX_WideString& str); + // Explicit conversion to raw string + FX_LPCSTR c_str() const + { + return m_pData ? m_pData->m_String : ""; + } + + // Implicit conversion to C-style string -- deprecated operator FX_LPCSTR() const { return m_pData ? m_pData->m_String : ""; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 4a34de1c16..7795f1fe91 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -1107,7 +1107,7 @@ FX_INT32 CPDF_Creator::WriteDirectObj(FX_DWORD objnum, const CPDF_Object* pObj, break; } CPDF_Encryptor encryptor; - encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)(FX_LPCSTR)str, str.GetLength()); + encryptor.Initialize(m_pCryptoHandler, objnum, (FX_LPBYTE)str.c_str(), str.GetLength()); CFX_ByteString content = PDF_EncodeString(CFX_ByteString((FX_LPCSTR)encryptor.m_pData, encryptor.m_dwSize), bHex); if ((len = m_File.AppendString(content)) < 0) { return -1; @@ -1665,12 +1665,12 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } else { str.Format("%d %d\r\n", i, j - i); } - if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) { + if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { return -1; } while (i < j) { str.Format("%010d 00000 n\r\n", m_ObjectOffset[i ++]); - if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) { + if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { return -1; } } @@ -1707,13 +1707,13 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage3(IFX_Pause *pPause) } else { str.Format("%d %d\r\n", objnum, j - i); } - if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) { + if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { return -1; } while (i < j) { objnum = m_NewObjNumArray.ElementAt(i++); str.Format("%010d 00000 n\r\n", m_ObjectOffset[objnum]); - if (m_File.AppendBlock((FX_LPCSTR)str, str.GetLength()) < 0) { + if (m_File.AppendBlock(str.c_str(), str.GetLength()) < 0) { return -1; } } diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 19786f7451..b6c1dff84b 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -223,7 +223,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, FX_BOOL bVert, FX_B if (face.GetLength() >= LF_FACESIZE) { return NULL; } - FXSYS_strcpy(lfa.lfFaceName, (FX_LPCSTR)face); + FXSYS_strcpy(lfa.lfFaceName, face.c_str()); return AddWindowsFont(&lfa, bVert, bTranslateName); } extern CFX_ByteString _FPDF_GetNameFromTT(FX_LPCBYTE name_table, FX_DWORD name); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 879c2f3c0e..deb7127bbe 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -126,7 +126,7 @@ void CPDF_StreamContentParser::AddNameParam(FX_LPCSTR name, int len) m_ParamBuf1[index].m_Name.m_Len = len; } else { CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len)); - FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, (FX_LPCSTR)str, str.GetLength()); + FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), str.GetLength()); m_ParamBuf1[index].m_Name.m_Len = str.GetLength(); } } diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index f6daf40b8b..9514065eeb 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -438,7 +438,7 @@ CFX_WideString PDF_DecodeText(FX_LPCBYTE src_data, FX_DWORD src_len, CFX_CharMap } CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr, CFX_CharMap* pCharMap) { - return PDF_DecodeText((FX_LPCBYTE)(FX_LPCSTR)bstr, bstr.GetLength(), pCharMap); + return PDF_DecodeText((FX_LPCBYTE)bstr.c_str(), bstr.GetLength(), pCharMap); } CFX_ByteString PDF_EncodeText(FX_LPCWSTR pString, int len, CFX_CharMap* pCharMap) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 3dc0e551b4..b6d6dc70c0 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -25,12 +25,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas CRYPT_MD5Start(md5); CRYPT_MD5Update(md5, passcode, 32); CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O")); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)okey, okey.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)okey.c_str(), okey.GetLength()); FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P")); CRYPT_MD5Update(md5, (FX_LPBYTE)&perm, 4); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } if (!bIgnoreMeta && revision >= 3 && !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) { FX_DWORD tag = (FX_DWORD) - 1; @@ -406,7 +406,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ } FXSYS_memset32(test, 0, sizeof(test)); FXSYS_memset32(tmpkey, 0, sizeof(tmpkey)); - FXSYS_memcpy32(test, (FX_LPCSTR)ukey, copy_len); + FXSYS_memcpy32(test, ukey.c_str(), copy_len); for (int i = 19; i >= 0; i --) { for (int j = 0; j < key_len; j ++) { tmpkey[j] = key[j] ^ i; @@ -419,12 +419,12 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(FX_LPCBYTE password, FX_ CPDF_Array* pIdArray = m_pParser->GetIDArray(); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } CRYPT_MD5Finish(md5, ukeybuf); return FXSYS_memcmp32(test, ukeybuf, 16) == 0; } - if (FXSYS_memcmp32((FX_LPVOID)(FX_LPCSTR)ukey, ukeybuf, 16) == 0) { + if (FXSYS_memcmp32((FX_LPVOID)ukey.c_str(), ukeybuf, 16) == 0) { return TRUE; } return FALSE; @@ -461,7 +461,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(FX_LPCBYTE owner_pa } FX_BYTE okeybuf[64]; FXSYS_memset32(okeybuf, 0, sizeof(okeybuf)); - FXSYS_memcpy32(okeybuf, (FX_LPCSTR)okey, okeylen); + FXSYS_memcpy32(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { @@ -566,7 +566,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_ CRYPT_MD5Update(md5, defpasscode, 32); if (pIdArray) { CFX_ByteString id = pIdArray->GetString(0); - CRYPT_MD5Update(md5, (FX_LPBYTE)(FX_LPCSTR)id, id.GetLength()); + CRYPT_MD5Update(md5, (FX_LPBYTE)id.c_str(), id.GetLength()); } FX_BYTE digest[32]; CRYPT_MD5Finish(md5, digest); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index 07b447b1b6..c477ba6f6e 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -328,7 +328,7 @@ void CPDF_Object::SetUnicodeText(FX_LPCWSTR pUnicodes, int len) ((CPDF_String*)this)->m_String = PDF_EncodeText(pUnicodes, len); } else if (m_Type == PDFOBJ_STREAM) { CFX_ByteString result = PDF_EncodeText(pUnicodes, len); - ((CPDF_Stream*)this)->SetData((FX_LPBYTE)(FX_LPCSTR)result, result.GetLength(), FALSE, FALSE); + ((CPDF_Stream*)this)->SetData((FX_LPBYTE)result.c_str(), result.GetLength(), FALSE, FALSE); } } CPDF_Number::CPDF_Number(int value) diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index f650b771ec..09fc2139fe 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2198,9 +2198,9 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO } if (key.GetLength() >= 1) { if (nKeys < 32) { - pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } else { - pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } } } @@ -2384,9 +2384,9 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList return NULL; } if (key.GetLength() == 1) { - pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->SetAt(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } else { - pDict->AddValue(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj); + pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), pObj); } } if (pContext) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 7559bcee91..e5e68c2f5c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -284,14 +284,14 @@ CFX_ByteString PDF_NameDecode(FX_BSTR bstr) } CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) { - if (FXSYS_memchr((FX_LPCSTR)orig, '#', orig.GetLength()) == NULL) { + if (FXSYS_memchr(orig.c_str(), '#', orig.GetLength()) == NULL) { return orig; } return PDF_NameDecode(CFX_ByteStringC(orig)); } CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { - FX_LPBYTE src_buf = (FX_LPBYTE)(FX_LPCSTR)orig; + FX_LPBYTE src_buf = (FX_LPBYTE)orig.c_str(); int src_len = orig.GetLength(); int dest_len = 0; int i; diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 6b7e6bf2d6..d695cb98ba 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -446,7 +446,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt if (iCharSet == 1) { iCharSet = GetNativeCharSet(); } - HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, (FX_LPCSTR)csFontName); + HFONT hFont = ::CreateFontA(0, 0, 0, 0, 0, 0, 0, 0, iCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, csFontName.c_str()); if (hFont != NULL) { LOGFONTA lf; memset(&lf, 0, sizeof(LOGFONTA)); diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp index b208142d92..bb8466debe 100644 --- a/core/src/fxcrt/fx_basic_buffer.cpp +++ b/core/src/fxcrt/fx_basic_buffer.cpp @@ -371,7 +371,7 @@ CFX_ArchiveLoader& CFX_ArchiveLoader::operator >> (CFX_WideString& str) { CFX_ByteString encoded; operator >> (encoded); - str = CFX_WideString::FromUTF16LE((const unsigned short*)(FX_LPCSTR)encoded, encoded.GetLength()); + str = CFX_WideString::FromUTF16LE((const unsigned short*)encoded.c_str(), encoded.GetLength()); return *this; } FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index 1c47ee6c9b..cdf3d421f5 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -46,7 +46,7 @@ FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_BSTR fileName, FX_DWORD dwMode) } CFX_ByteString strMode; FXCRT_GetFileModeString(dwMode, strMode); - m_hFile = FXSYS_fopen(fileName.GetCStr(), (FX_LPCSTR)strMode); + m_hFile = FXSYS_fopen(fileName.GetCStr(), strMode.c_str()); return m_hFile != NULL; } FX_BOOL CFXCRT_FileAccess_CRT::Open(FX_WSTR fileName, FX_DWORD dwMode) 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 e27c51fcbb..8606645baf 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 3ee9441bc3..cbbcbc0c4d 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; |