Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StdAfx.h に定義されている malloc と GlobalLock の型変換マクロを削除する #1842

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions sakura_core/StdAfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,5 @@
// プリコンパイルの有無がビルドパフォーマンスに大きく影響するため。
#include "env/DLLSHAREDATA.h"

//その他
#define malloc_char (char*)malloc
#define GlobalLockChar (char*)::GlobalLock
#define GlobalLockUChar (unsigned char*)::GlobalLock
#define GlobalLockWChar (wchar_t*)::GlobalLock
#define GlobalLockBYTE (BYTE*)::GlobalLock

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ は前行の直前に追加の宣言を挿入します。
16 changes: 8 additions & 8 deletions sakura_core/_os/CClipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool CClipboard::SetText(
nTextLen + 1
);
if( hgClipText ){
char* pszClip = GlobalLockChar( hgClipText );
char* pszClip = static_cast<char*>(::GlobalLock(hgClipText));
memcpy( pszClip, pszText, nTextLen );
pszClip[nTextLen] = '\0';
::GlobalUnlock( hgClipText );
Expand All @@ -106,7 +106,7 @@ bool CClipboard::SetText(
if( !hgClipText )break;

//確保した領域にデータをコピー
wchar_t* pszClip = GlobalLockWChar( hgClipText );
wchar_t* pszClip = static_cast<wchar_t*>(::GlobalLock(hgClipText));
wmemcpy( pszClip, pData, nDataLen ); //データ
pszClip[nDataLen] = L'\0'; //終端ヌル
::GlobalUnlock( hgClipText );
Expand Down Expand Up @@ -135,7 +135,7 @@ bool CClipboard::SetText(
if( !hgClipSakura )break;

//確保した領域にデータをコピー
BYTE* pClip = GlobalLockBYTE( hgClipSakura );
BYTE* pClip = static_cast<BYTE*>(::GlobalLock(hgClipSakura));
*((int*)pClip) = nDataLen; pClip += sizeof(int); //データの長さ
wmemcpy( (wchar_t*)pClip, pData, nDataLen ); pClip += nDataLen*sizeof(wchar_t); //データ
*((wchar_t*)pClip) = L'\0'; pClip += sizeof(wchar_t); //終端ヌル
Expand All @@ -157,7 +157,7 @@ bool CClipboard::SetText(
1
);
if( hgClipMSDEVColumn ){
BYTE* pClip = GlobalLockBYTE( hgClipMSDEVColumn );
BYTE* pClip = static_cast<BYTE*>(::GlobalLock(hgClipMSDEVColumn));
pClip[0] = 0;
::GlobalUnlock( hgClipMSDEVColumn );
SetClipboardData( uFormat, hgClipMSDEVColumn );
Expand Down Expand Up @@ -241,7 +241,7 @@ bool CClipboard::SetHtmlText(const CNativeW& cmemBUf)
if( !hgClipText ) return false;

//確保した領域にデータをコピー
char* pszClip = GlobalLockChar( hgClipText );
char* pszClip = static_cast<char*>(::GlobalLock(hgClipText));
memcpy_raw( pszClip, cmemHeader.GetStringPtr(), cmemHeader.GetStringLength() ); //データ
memcpy_raw( pszClip + cmemHeader.GetStringLength(), cmemUtf8.GetStringPtr(), cmemUtf8.GetStringLength() ); //データ
memcpy_raw( pszClip + cmemHeader.GetStringLength() + cmemUtf8.GetStringLength(), cmemFooter.GetStringPtr(), cmemFooter.GetStringLength() ); //データ
Expand Down Expand Up @@ -319,7 +319,7 @@ bool CClipboard::GetText(CNativeW* cmemBuf, bool* pbColumnSelect, bool* pbLineSe
}
if( hUnicode != NULL ){
//DWORD nLen = GlobalSize(hUnicode);
wchar_t* szData = GlobalLockWChar(hUnicode);
wchar_t* szData = static_cast<wchar_t*>(::GlobalLock(hUnicode));
cmemBuf->SetString( szData );
::GlobalUnlock(hUnicode);
return true;
Expand All @@ -332,7 +332,7 @@ bool CClipboard::GetText(CNativeW* cmemBuf, bool* pbColumnSelect, bool* pbLineSe
hText = GetClipboardData( CF_OEMTEXT );
}
if( hText != NULL ){
char* szData = GlobalLockChar(hText);
char* szData = static_cast<char*>(::GlobalLock(hText));
//SJIS→UNICODE
CMemory cmemSjis( szData, GlobalSize(hText) );
CNativeW cmemUni;
Expand Down Expand Up @@ -515,7 +515,7 @@ bool CClipboard::SetClipboradByFormat(const CStringRef& cstr, const wchar_t* pFo
if( !hgClipText ){
return false;
}
char* pszClip = GlobalLockChar( hgClipText );
char* pszClip = static_cast<char*>(::GlobalLock(hgClipText));
memcpy( pszClip, pBuf, nTextByteLen );
if( nulLen ){
memset( &pszClip[nTextByteLen], 0, nulLen );
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/dlg/CDlgProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void CDlgProperty::SetData( void )
in.Close();
goto end_of_CodeTest;
}
pBuf = GlobalLockChar( hgData );
pBuf = static_cast<char*>(::GlobalLock(hgData));
in.Read( pBuf, nBufLen );
in.Close();

Expand Down