From 9b2730eb8857b4c8d7f2764fc5fb32dac59b1456 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 11 Mar 2009 09:39:16 +0100 Subject: [PATCH] kernel32: Remove superfluous pointer casts. --- dlls/kernel32/console.c | 2 +- dlls/kernel32/dosmem.c | 2 +- dlls/kernel32/except.c | 4 ++-- dlls/kernel32/file.c | 8 ++++---- dlls/kernel32/format_msg.c | 8 ++++---- dlls/kernel32/heap.c | 2 +- dlls/kernel32/local16.c | 16 ++++++++-------- dlls/kernel32/locale.c | 8 ++++---- dlls/kernel32/ne_module.c | 4 ++-- dlls/kernel32/oldconfig.c | 14 +++++++------- dlls/kernel32/profile.c | 18 +++++++++--------- dlls/kernel32/sync.c | 2 +- dlls/kernel32/task.c | 4 ++-- dlls/kernel32/tests/change.c | 13 ++++++------- dlls/kernel32/tests/codepage.c | 2 +- dlls/kernel32/tests/comm.c | 6 +++--- dlls/kernel32/tests/loader.c | 2 +- dlls/kernel32/tests/pipe.c | 4 ++-- dlls/kernel32/tests/sync.c | 4 ++-- dlls/kernel32/tests/thread.c | 13 ++++++------- dlls/kernel32/tests/toolhelp.c | 2 +- dlls/kernel32/thunk.c | 2 +- dlls/kernel32/toolhelp.c | 6 +++--- dlls/kernel32/volume.c | 2 +- 24 files changed, 73 insertions(+), 75 deletions(-) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index d247e1b9cf3..0caa0eadd17 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -1338,7 +1338,7 @@ BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer, DWORD nNumberOfCharsToRead, LPDWORD lpNumberOfCharsRead, LPVOID lpReserved) { DWORD charsread; - LPWSTR xbuf = (LPWSTR)lpBuffer; + LPWSTR xbuf = lpBuffer; DWORD mode; TRACE("(%p,%p,%d,%p,%p)\n", diff --git a/dlls/kernel32/dosmem.c b/dlls/kernel32/dosmem.c index 8b0653b291d..f1621394e29 100644 --- a/dlls/kernel32/dosmem.c +++ b/dlls/kernel32/dosmem.c @@ -92,7 +92,7 @@ BOOL load_winedos(void) if (hRunOnce == 0) { HANDLE hEvent = CreateEventW( NULL, TRUE, FALSE, NULL ); - if (InterlockedCompareExchangePointer( (PVOID)&hRunOnce, hEvent, 0 ) == 0) + if (InterlockedCompareExchangePointer( &hRunOnce, hEvent, 0 ) == 0) { HMODULE hModule; diff --git a/dlls/kernel32/except.c b/dlls/kernel32/except.c index 21d3584b21a..53a4515033b 100644 --- a/dlls/kernel32/except.c +++ b/dlls/kernel32/except.c @@ -366,7 +366,7 @@ static int start_debugger_atomic(PEXCEPTION_POINTERS epointers) /* ask for manual reset, so that once the debugger is started, * every thread will know it */ NtCreateEvent( &hEvent, EVENT_ALL_ACCESS, &attr, TRUE, FALSE ); - if (InterlockedCompareExchangePointer( (PVOID)&hRunOnce, hEvent, 0 ) == 0) + if (InterlockedCompareExchangePointer( &hRunOnce, hEvent, 0 ) == 0) { /* ok, our event has been set... we're the winning thread */ BOOL ret = start_debugger( epointers, hRunOnce ); @@ -408,7 +408,7 @@ static inline BOOL check_resource_write( void *addr ) if (!VirtualQuery( addr, &info, sizeof(info) )) return FALSE; if (info.State == MEM_FREE || !(info.Type & MEM_IMAGE)) return FALSE; - if (!(rsrc = RtlImageDirectoryEntryToData( (HMODULE)info.AllocationBase, TRUE, + if (!(rsrc = RtlImageDirectoryEntryToData( info.AllocationBase, TRUE, IMAGE_DIRECTORY_ENTRY_RESOURCE, &size ))) return FALSE; if (addr < rsrc || (char *)addr >= (char *)rsrc + size) return FALSE; diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index e7572053189..97429644999 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -347,7 +347,7 @@ static void FILE_InitProcessDosHandles( void ) */ static void WINAPI FILE_ReadWriteApc(void* apc_user, PIO_STATUS_BLOCK io_status, ULONG reserved) { - LPOVERLAPPED_COMPLETION_ROUTINE cr = (LPOVERLAPPED_COMPLETION_ROUTINE)apc_user; + LPOVERLAPPED_COMPLETION_ROUTINE cr = apc_user; cr(RtlNtStatusToDosError(io_status->u.Status), io_status->Information, (LPOVERLAPPED)io_status); } @@ -1953,7 +1953,7 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data ) SetLastError( ERROR_INVALID_HANDLE ); return ret; } - info = (FIND_FIRST_INFO *)handle; + info = handle; if (info->magic != FIND_FIRST_MAGIC) { SetLastError( ERROR_INVALID_HANDLE ); @@ -2037,7 +2037,7 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data ) */ BOOL WINAPI FindClose( HANDLE handle ) { - FIND_FIRST_INFO *info = (FIND_FIRST_INFO *)handle; + FIND_FIRST_INFO *info = handle; if (!handle || handle == INVALID_HANDLE_VALUE) { @@ -2105,7 +2105,7 @@ HANDLE WINAPI FindFirstFileExA( LPCSTR lpFileName, FINDEX_INFO_LEVELS fInfoLevel handle = FindFirstFileExW(nameW, fInfoLevelId, &dataW, fSearchOp, lpSearchFilter, dwAdditionalFlags); if (handle == INVALID_HANDLE_VALUE) return handle; - dataA = (WIN32_FIND_DATAA *) lpFindFileData; + dataA = lpFindFileData; dataA->dwFileAttributes = dataW.dwFileAttributes; dataA->ftCreationTime = dataW.ftCreationTime; dataA->ftLastAccessTime = dataW.ftLastAccessTime; diff --git a/dlls/kernel32/format_msg.c b/dlls/kernel32/format_msg.c index 41a2317f214..c251514dae6 100644 --- a/dlls/kernel32/format_msg.c +++ b/dlls/kernel32/format_msg.c @@ -165,8 +165,8 @@ DWORD WINAPI FormatMessageA( from = NULL; if (dwFlags & FORMAT_MESSAGE_FROM_STRING) { - from = HeapAlloc( GetProcessHeap(), 0, strlen((LPCSTR)lpSource)+1 ); - strcpy( from, (LPCSTR)lpSource ); + from = HeapAlloc( GetProcessHeap(), 0, strlen(lpSource) + 1 ); + strcpy( from, lpSource ); } else { from = NULL; @@ -384,9 +384,9 @@ DWORD WINAPI FormatMessageW( FIXME("line wrapping not supported.\n"); from = NULL; if (dwFlags & FORMAT_MESSAGE_FROM_STRING) { - from = HeapAlloc( GetProcessHeap(), 0, (strlenW((LPCWSTR)lpSource) + 1) * + from = HeapAlloc( GetProcessHeap(), 0, (strlenW(lpSource) + 1) * sizeof(WCHAR) ); - strcpyW( from, (LPCWSTR)lpSource ); + strcpyW( from, lpSource ); } else { from = NULL; diff --git a/dlls/kernel32/heap.c b/dlls/kernel32/heap.c index 41987a5530f..c08fb5112ac 100644 --- a/dlls/kernel32/heap.c +++ b/dlls/kernel32/heap.c @@ -311,7 +311,7 @@ BOOL WINAPI HeapSetInformation( HANDLE heap, HEAP_INFORMATION_CLASS infoclass, P #define MAGIC_GLOBAL_USED 0x5342 #define HANDLE_TO_INTERN(h) ((PGLOBAL32_INTERN)(((char *)(h))-2)) -#define INTERN_TO_HANDLE(i) ((HGLOBAL) &((i)->Pointer)) +#define INTERN_TO_HANDLE(i) (&((i)->Pointer)) #define POINTER_TO_HANDLE(p) (*(((const HGLOBAL *)(p))-2)) #define ISHANDLE(h) (((ULONG_PTR)(h)&2)!=0) #define ISPOINTER(h) (((ULONG_PTR)(h)&2)==0) diff --git a/dlls/kernel32/local16.c b/dlls/kernel32/local16.c index a5b2fc72dc1..6171975add0 100644 --- a/dlls/kernel32/local16.c +++ b/dlls/kernel32/local16.c @@ -1859,7 +1859,7 @@ HANDLE WINAPI Local32Init16( WORD segment, DWORD tableSize, HeapFree( GetProcessHeap(), 0, oldBase ); } - return (HANDLE)header; + return header; } /*********************************************************************** @@ -1957,7 +1957,7 @@ static VOID Local32_FromHandle( LOCAL32HEADER *header, INT16 type, */ DWORD WINAPI Local32Alloc16( HANDLE heap, DWORD size, INT16 type, DWORD flags ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; DWORD addr; @@ -2036,7 +2036,7 @@ DWORD WINAPI Local32Alloc16( HANDLE heap, DWORD size, INT16 type, DWORD flags ) DWORD WINAPI Local32ReAlloc16( HANDLE heap, DWORD addr, INT16 type, DWORD size, DWORD flags ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; @@ -2069,7 +2069,7 @@ DWORD WINAPI Local32ReAlloc16( HANDLE heap, DWORD addr, INT16 type, */ BOOL WINAPI Local32Free16( HANDLE heap, DWORD addr, INT16 type ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; @@ -2115,7 +2115,7 @@ BOOL WINAPI Local32Free16( HANDLE heap, DWORD addr, INT16 type ) */ DWORD WINAPI Local32Translate16( HANDLE heap, DWORD addr, INT16 type1, INT16 type2 ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; @@ -2131,7 +2131,7 @@ DWORD WINAPI Local32Translate16( HANDLE heap, DWORD addr, INT16 type1, INT16 typ */ DWORD WINAPI Local32Size16( HANDLE heap, DWORD addr, INT16 type ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; @@ -2146,7 +2146,7 @@ DWORD WINAPI Local32Size16( HANDLE heap, DWORD addr, INT16 type ) */ BOOL WINAPI Local32ValidHandle16( HANDLE heap, WORD addr ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; LPDWORD handle; LPBYTE ptr; @@ -2159,7 +2159,7 @@ BOOL WINAPI Local32ValidHandle16( HANDLE heap, WORD addr ) */ WORD WINAPI Local32GetSegment16( HANDLE heap ) { - LOCAL32HEADER *header = (LOCAL32HEADER *)heap; + LOCAL32HEADER *header = heap; return header->segment; } diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 03554c3a6e7..fa17689fa2f 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -241,8 +241,8 @@ static const union cptable *get_codepage_table( unsigned int codepage ) */ static int charset_cmp( const void *name, const void *entry ) { - const struct charset_entry *charset = (const struct charset_entry *)entry; - return strcasecmp( (const char *)name, charset->charset_name ); + const struct charset_entry *charset = entry; + return strcasecmp( name, charset->charset_name ); } /*********************************************************************** @@ -621,7 +621,7 @@ static BOOL locale_update_registry( HKEY hkey, const WCHAR *name, LCID lcid, RtlInitUnicodeString( &nameW, name ); count = sizeof(bufferW); - if (!NtQueryValueKey(hkey, &nameW, KeyValuePartialInformation, (LPBYTE)bufferW, count, &count)) + if (!NtQueryValueKey(hkey, &nameW, KeyValuePartialInformation, bufferW, count, &count)) { const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW; LPCWSTR text = (LPCWSTR)info->Data; @@ -3538,7 +3538,7 @@ GEOID WINAPI GetUserGeoID( GEOCLASS GeoClass ) if ((hSubkey = NLS_RegOpenKey(hkey, geoW))) { if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation, - (LPBYTE)bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength) + bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength) ret = strtolW((LPCWSTR)info->Data, &end, 10); } break; diff --git a/dlls/kernel32/ne_module.c b/dlls/kernel32/ne_module.c index 7e81dc940b8..046f7e3bd00 100644 --- a/dlls/kernel32/ne_module.c +++ b/dlls/kernel32/ne_module.c @@ -224,7 +224,7 @@ void __wine_dll_unregister_16( const IMAGE_DOS_HEADER *header ) */ NE_MODULE *NE_GetPtr( HMODULE16 hModule ) { - return (NE_MODULE *)GlobalLock16( GetExePtr(hModule) ); + return GlobalLock16( GetExePtr(hModule) ); } @@ -1250,7 +1250,7 @@ HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock ) * in the meantime), or else to a stub module which contains only header * information. */ - params = (LOADPARAMS16 *)paramBlock; + params = paramBlock; if (params->showCmd) cmdShow = ((WORD *)MapSL( params->showCmd ))[1]; cmdline = MapSL( params->cmdLine ); diff --git a/dlls/kernel32/oldconfig.c b/dlls/kernel32/oldconfig.c index 20b6eaaeff5..26064f4fc6d 100644 --- a/dlls/kernel32/oldconfig.c +++ b/dlls/kernel32/oldconfig.c @@ -146,11 +146,11 @@ static void create_scsi_entry( PSCSI_ADDRESS scsi_addr, LPCSTR lpDriver, UINT uD RtlCreateUnicodeStringFromAsciiz( &nameW, "Driver" ); RtlMultiByteToUnicodeN( dataW, sizeof(dataW), &sizeW, lpDriver, strlen(lpDriver)+1); - NtSetValueKey( portKey, &nameW, 0, REG_SZ, (BYTE*)dataW, sizeW ); + NtSetValueKey( portKey, &nameW, 0, REG_SZ, dataW, sizeW ); RtlFreeUnicodeString( &nameW ); value = 10; RtlCreateUnicodeStringFromAsciiz( &nameW, "FirstBusTimeScanInMs" ); - NtSetValueKey( portKey,&nameW, 0, REG_DWORD, (BYTE *)&value, sizeof(DWORD)); + NtSetValueKey( portKey,&nameW, 0, REG_DWORD, &value, sizeof(DWORD) ); RtlFreeUnicodeString( &nameW ); value = 0; @@ -167,7 +167,7 @@ static void create_scsi_entry( PSCSI_ADDRESS scsi_addr, LPCSTR lpDriver, UINT uD } #endif RtlCreateUnicodeStringFromAsciiz( &nameW, "DMAEnabled" ); - NtSetValueKey( portKey,&nameW, 0, REG_DWORD, (BYTE *)&value, sizeof(DWORD)); + NtSetValueKey( portKey,&nameW, 0, REG_DWORD, &value, sizeof(DWORD) ); RtlFreeUnicodeString( &nameW ); } @@ -234,25 +234,25 @@ static void create_scsi_entry( PSCSI_ADDRESS scsi_addr, LPCSTR lpDriver, UINT uD } RtlCreateUnicodeStringFromAsciiz( &nameW, "Type" ); RtlMultiByteToUnicodeN( dataW, sizeof(dataW), &sizeW, data, strlen(data)+1); - NtSetValueKey( lunKey, &nameW, 0, REG_SZ, (BYTE*)dataW, sizeW ); + NtSetValueKey( lunKey, &nameW, 0, REG_SZ, dataW, sizeW ); RtlFreeUnicodeString( &nameW ); RtlCreateUnicodeStringFromAsciiz( &nameW, "Identifier" ); RtlMultiByteToUnicodeN( dataW, sizeof(dataW), &sizeW, lpDriveName, strlen(lpDriveName)+1); - NtSetValueKey( lunKey, &nameW, 0, REG_SZ, (BYTE*)dataW, sizeW ); + NtSetValueKey( lunKey, &nameW, 0, REG_SZ, dataW, sizeW ); RtlFreeUnicodeString( &nameW ); if (uDriveType == DRIVE_CDROM || uDriveType == DRIVE_REMOVABLE) { RtlCreateUnicodeStringFromAsciiz( &nameW, "DeviceName" ); RtlMultiByteToUnicodeN( dataW, sizeof(dataW), &sizeW, buffer, strlen(buffer)+1); - NtSetValueKey( lunKey, &nameW, 0, REG_SZ, (BYTE*)dataW, sizeW ); + NtSetValueKey( lunKey, &nameW, 0, REG_SZ, dataW, sizeW ); RtlFreeUnicodeString( &nameW ); } RtlCreateUnicodeStringFromAsciiz( &nameW, "UnixDeviceName" ); RtlMultiByteToUnicodeN( dataW, sizeof(dataW), &sizeW, lpUnixDeviceName, strlen(lpUnixDeviceName)+1); - NtSetValueKey( lunKey, &nameW, 0, REG_SZ, (BYTE*)dataW, sizeW ); + NtSetValueKey( lunKey, &nameW, 0, REG_SZ, dataW, sizeW ); RtlFreeUnicodeString( &nameW ); NtClose( lunKey ); diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c index 1a250315b76..8b77aaa3805 100644 --- a/dlls/kernel32/profile.c +++ b/dlls/kernel32/profile.c @@ -122,7 +122,7 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len, static inline void PROFILE_ByteSwapShortBuffer(WCHAR * buffer, int len) { int i; - USHORT * shortbuffer = (USHORT *)buffer; + USHORT * shortbuffer = buffer; for (i = 0; i < len; i++) shortbuffer[i] = RtlUshortByteSwap(shortbuffer[i]); } @@ -345,37 +345,37 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) case ENCODING_ANSI: TRACE("ANSI encoding\n"); - len = MultiByteToWideChar(CP_ACP, 0, (char *)pBuffer, dwFileSize, NULL, 0); + len = MultiByteToWideChar(CP_ACP, 0, pBuffer, dwFileSize, NULL, 0); szFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (!szFile) { HeapFree(GetProcessHeap(), 0, buffer_base); return NULL; } - MultiByteToWideChar(CP_ACP, 0, (char *)pBuffer, dwFileSize, szFile, len); + MultiByteToWideChar(CP_ACP, 0, pBuffer, dwFileSize, szFile, len); szEnd = szFile + len; break; case ENCODING_UTF8: TRACE("UTF8 encoding\n"); - - len = MultiByteToWideChar(CP_UTF8, 0, (char *)pBuffer, dwFileSize, NULL, 0); + + len = MultiByteToWideChar(CP_UTF8, 0, pBuffer, dwFileSize, NULL, 0); szFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); if (!szFile) { HeapFree(GetProcessHeap(), 0, buffer_base); return NULL; } - MultiByteToWideChar(CP_UTF8, 0, (char *)pBuffer, dwFileSize, szFile, len); + MultiByteToWideChar(CP_UTF8, 0, pBuffer, dwFileSize, szFile, len); szEnd = szFile + len; break; case ENCODING_UTF16LE: TRACE("UTF16 Little Endian encoding\n"); - szFile = (WCHAR *)pBuffer; + szFile = pBuffer; szEnd = (WCHAR *)((char *)pBuffer + dwFileSize); break; case ENCODING_UTF16BE: TRACE("UTF16 Big Endian encoding\n"); - szFile = (WCHAR *)pBuffer; + szFile = pBuffer; szEnd = (WCHAR *)((char *)pBuffer + dwFileSize); PROFILE_ByteSwapShortBuffer(szFile, dwFileSize / sizeof(WCHAR)); break; @@ -1708,7 +1708,7 @@ BOOL WINAPI GetPrivateProfileStructW (LPCWSTR section, LPCWSTR key, { BOOL highnibble = TRUE; BYTE b = 0, val; - LPBYTE binbuf = (LPBYTE)buf; + LPBYTE binbuf = buf; end -= 2; /* don't include checksum in output data */ /* translate ASCII hex format into binary data */ diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c index 38002d7c584..ab596880afe 100644 --- a/dlls/kernel32/sync.c +++ b/dlls/kernel32/sync.c @@ -73,7 +73,7 @@ HANDLE get_BaseNamedObjects_handle(void) InitializeObjectAttributes(&attr, &str, 0, 0, NULL); NtOpenDirectoryObject(&dir, DIRECTORY_CREATE_OBJECT|DIRECTORY_TRAVERSE, &attr); - if (InterlockedCompareExchangePointer( (PVOID)&handle, dir, 0 ) != 0) + if (InterlockedCompareExchangePointer( &handle, dir, 0 ) != 0) { /* someone beat us here... */ CloseHandle( dir ); diff --git a/dlls/kernel32/task.c b/dlls/kernel32/task.c index af5fac322b5..0381097187d 100644 --- a/dlls/kernel32/task.c +++ b/dlls/kernel32/task.c @@ -343,8 +343,8 @@ static TDB *TASK_Create( NE_MODULE *pModule, UINT16 cmdShow, LPCSTR cmdline, BYT /* Allocate a code segment alias for the TDB */ - pTask->hCSAlias = GLOBAL_CreateBlock( GMEM_FIXED, (void *)pTask, - sizeof(TDB), pTask->hPDB, WINE_LDT_FLAGS_CODE ); + pTask->hCSAlias = GLOBAL_CreateBlock( GMEM_FIXED, pTask, sizeof(TDB), + pTask->hPDB, WINE_LDT_FLAGS_CODE ); /* Default DTA overwrites command line */ diff --git a/dlls/kernel32/tests/change.c b/dlls/kernel32/tests/change.c index 7f011a059aa..50d899a424f 100644 --- a/dlls/kernel32/tests/change.c +++ b/dlls/kernel32/tests/change.c @@ -38,7 +38,7 @@ static DWORD CALLBACK NotificationThread(LPVOID arg) { - HANDLE change = (HANDLE) arg; + HANDLE change = arg; BOOL notified = FALSE; BOOL ret = FALSE; DWORD status; @@ -65,8 +65,7 @@ static HANDLE StartNotificationThread(LPCSTR path, BOOL subtree, DWORD flags) change = FindFirstChangeNotificationA(path, subtree, flags); ok(change != INVALID_HANDLE_VALUE, "FindFirstChangeNotification error: %d\n", GetLastError()); - thread = CreateThread(NULL, 0, NotificationThread, (LPVOID)change, - 0, &threadId); + thread = CreateThread(NULL, 0, NotificationThread, change, 0, &threadId); ok(thread != NULL, "CreateThread error: %d\n", GetLastError()); return thread; @@ -356,8 +355,8 @@ static void test_ffcnMultipleThreads(void) * directory object with an empty wine user APC queue for this thread (bug #7286) */ /* Create our notification thread */ - handles[1] = CreateThread(NULL, 0, NotificationThread, (LPVOID)handles[0], - 0, &threadId); + handles[1] = CreateThread(NULL, 0, NotificationThread, handles[0], 0, + &threadId); ok(handles[1] != NULL, "CreateThread error: %d\n", GetLastError()); status = WaitForMultipleObjects(2, handles, FALSE, 5000); @@ -848,8 +847,8 @@ static void test_ffcn_directory_overlap(void) ret = FindCloseChangeNotification(parent_watch); ok(ret, "FindCloseChangeNotification error: %d\n", GetLastError()); - child_thread = CreateThread(NULL, 0, NotificationThread, - (LPVOID)child_watch, 0, &threadId); + child_thread = CreateThread(NULL, 0, NotificationThread, child_watch, 0, + &threadId); ok(child_thread != NULL, "CreateThread error: %d\n", GetLastError()); /* Create a file in child */ diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 8dc6af949ed..906124156b7 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -205,7 +205,7 @@ static void test_overlapped_buffers(void) int ret; SetLastError(0xdeadbeef); - memcpy((WCHAR *)(buf + 1), strW, sizeof(strW)); + memcpy(buf + 1, strW, sizeof(strW)); ret = WideCharToMultiByte(CP_ACP, 0, (WCHAR *)(buf + 1), -1, buf, sizeof(buf), NULL, NULL); ok(ret == sizeof(strA), "unexpected ret %d\n", ret); ok(!memcmp(buf, strA, sizeof(strA)), "conversion failed: %s\n", buf); diff --git a/dlls/kernel32/tests/comm.c b/dlls/kernel32/tests/comm.c index 8da29dffac0..99fe505d294 100644 --- a/dlls/kernel32/tests/comm.c +++ b/dlls/kernel32/tests/comm.c @@ -1161,7 +1161,7 @@ static void test_WaitRx(HANDLE hcom) */ static DWORD CALLBACK toggle_ctlLine(LPVOID arg) { - DWORD_PTR *args = (DWORD_PTR *) arg; + DWORD_PTR *args = arg; DWORD timeout = args[0]; DWORD ctl = args[1]; HANDLE hcom = (HANDLE) args[2]; @@ -1264,7 +1264,7 @@ static void test_WaitCts(HANDLE hcom) */ static DWORD CALLBACK reset_CommMask(LPVOID arg) { - DWORD_PTR *args = (DWORD_PTR *) arg; + DWORD_PTR *args = arg; DWORD timeout = args[0]; HANDLE hcom = (HANDLE) args[1]; @@ -1565,7 +1565,7 @@ static void test_WaitDcd(HANDLE hcom) */ static DWORD CALLBACK set_CommBreak(LPVOID arg) { - DWORD_PTR *args = (DWORD_PTR *) arg; + DWORD_PTR *args = arg; DWORD timeout = args[0]; HANDLE hcom = (HANDLE) args[1]; diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c index 45cdcf6a1e4..9361ed58c12 100644 --- a/dlls/kernel32/tests/loader.c +++ b/dlls/kernel32/tests/loader.c @@ -402,7 +402,7 @@ static void test_Loader(void) "%d: VirtualQuery error %d\n", i, GetLastError()); if (nt_header.OptionalHeader.SectionAlignment < si.dwPageSize) { - ok(info.BaseAddress == (char *)hlib, "%d: got %p != expected %p\n", i, info.BaseAddress, (char *)hlib); + ok(info.BaseAddress == hlib, "%d: got %p != expected %p\n", i, info.BaseAddress, hlib); ok(info.RegionSize == ALIGN_SIZE(nt_header.OptionalHeader.SizeOfImage, si.dwPageSize), "%d: got %lx != expected %x\n", i, info.RegionSize, ALIGN_SIZE(nt_header.OptionalHeader.SizeOfImage, si.dwPageSize)); ok(info.Protect == PAGE_EXECUTE_WRITECOPY, "%d: %x != PAGE_EXECUTE_WRITECOPY\n", i, info.Protect); diff --git a/dlls/kernel32/tests/pipe.c b/dlls/kernel32/tests/pipe.c index 51197ecdd55..a1080faad3d 100644 --- a/dlls/kernel32/tests/pipe.c +++ b/dlls/kernel32/tests/pipe.c @@ -946,7 +946,7 @@ struct named_pipe_client_params static DWORD CALLBACK named_pipe_client_func(LPVOID p) { - struct named_pipe_client_params *params = (struct named_pipe_client_params *)p; + struct named_pipe_client_params *params = p; HANDLE pipe; BOOL ret; const char message[] = "Test"; @@ -1391,7 +1391,7 @@ static DWORD CALLBACK overlapped_server(LPVOID arg) OVERLAPPED ol; HANDLE pipe; int ret, err; - struct overlapped_server_args *a = (struct overlapped_server_args*)arg; + struct overlapped_server_args *a = arg; DWORD num; char buf[100]; diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index b15c090708e..ea36fc60847 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -490,7 +490,7 @@ static void test_iocp_callback(void) ok(retb == TRUE, "BindIoCompletionCallback failed\n"); memset(&overlapped, 0, sizeof(overlapped)); - retb = WriteFile(hFile, (const void *) buffer, 4, &bytesWritten, &overlapped); + retb = WriteFile(hFile, buffer, 4, &bytesWritten, &overlapped); ok(retb == TRUE || GetLastError() == ERROR_IO_PENDING, "WriteFile failed, lastError = %d\n", GetLastError()); ret = WaitForSingleObject(sem, 5000); @@ -534,7 +534,7 @@ static void test_iocp_callback(void) static void CALLBACK timer_queue_cb1(PVOID p, BOOLEAN timedOut) { - int *pn = (int *) p; + int *pn = p; ok(timedOut, "Timer callbacks should always time out\n"); ++*pn; } diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c index fa57fd96505..c1d65c1dd93 100644 --- a/dlls/kernel32/tests/thread.c +++ b/dlls/kernel32/tests/thread.c @@ -183,7 +183,7 @@ INT obeying_ars = 0; /* -1 == no, 0 == dunno yet, 1 == yes */ */ static DWORD WINAPI threadFunc1(LPVOID p) { - t1Struct *tstruct = (t1Struct *)p; + t1Struct *tstruct = p; int i; /* write our thread # into shared memory */ tstruct->threadmem[tstruct->threadnum]=GetCurrentThreadId(); @@ -225,7 +225,7 @@ static DWORD WINAPI threadFunc3(LPVOID p) static DWORD WINAPI threadFunc4(LPVOID p) { - HANDLE event = (HANDLE)p; + HANDLE event = p; if(event != NULL) { SetEvent(event); } @@ -236,7 +236,7 @@ static DWORD WINAPI threadFunc4(LPVOID p) #if CHECK_STACK static DWORD WINAPI threadFunc5(LPVOID p) { - DWORD *exitCode = (DWORD *)p; + DWORD *exitCode = p; SYSTEM_INFO sysInfo; sysInfo.dwPageSize=0; GetSystemInfo(&sysInfo); @@ -255,13 +255,13 @@ static DWORD WINAPI threadFunc5(LPVOID p) static DWORD WINAPI threadFunc_SetEvent(LPVOID p) { - SetEvent((HANDLE) p); + SetEvent(p); return 0; } static DWORD WINAPI threadFunc_CloseHandle(LPVOID p) { - CloseHandle((HANDLE) p); + CloseHandle(p); return 0; } @@ -550,8 +550,7 @@ static VOID test_TerminateThread(void) HANDLE thread,access_thread,event; DWORD threadId,exitCode; event=CreateEventA(NULL,TRUE,FALSE,NULL); - thread = CreateThread(NULL,0,threadFunc4, - (LPVOID)event, 0,&threadId); + thread = CreateThread(NULL,0,threadFunc4,event,0,&threadId); ok(thread!=NULL,"Create Thread failed\n"); /* TerminateThread has a race condition in Wine. If the thread is terminated before it starts, it leaves a process behind. Therefore, we wait for the diff --git a/dlls/kernel32/tests/toolhelp.c b/dlls/kernel32/tests/toolhelp.c index 708a81ebe84..dfe4ad8d0d5 100644 --- a/dlls/kernel32/tests/toolhelp.c +++ b/dlls/kernel32/tests/toolhelp.c @@ -44,7 +44,7 @@ static BOOL (WINAPI *pThread32Next)(HANDLE, LPTHREADENTRY32); static DWORD WINAPI sub_thread(void* pmt) { - DWORD w = WaitForSingleObject((HANDLE)pmt, WAIT_TIME); + DWORD w = WaitForSingleObject(pmt, WAIT_TIME); return w; } diff --git a/dlls/kernel32/thunk.c b/dlls/kernel32/thunk.c index 1f946979349..87856445bc5 100644 --- a/dlls/kernel32/thunk.c +++ b/dlls/kernel32/thunk.c @@ -1304,7 +1304,7 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT86 *context ) DWORD argSize = context->Ebp - context->Esp; char *stack16 = (char *)context->Esp - 4; STACK16FRAME *frame16 = (STACK16FRAME *)stack16 - 1; - STACK32FRAME *frame32 = (STACK32FRAME *)NtCurrentTeb()->WOW32Reserved; + STACK32FRAME *frame32 = NtCurrentTeb()->WOW32Reserved; char *stack32 = (char *)frame32 - argSize; WORD stackSel = SELECTOROF(frame32->frame16); DWORD stackBase = GetSelectorBase(stackSel); diff --git a/dlls/kernel32/toolhelp.c b/dlls/kernel32/toolhelp.c index 77a0cd7ba9c..6fbf4bf4be0 100644 --- a/dlls/kernel32/toolhelp.c +++ b/dlls/kernel32/toolhelp.c @@ -160,9 +160,9 @@ static void fill_module( struct snapshot* snap, ULONG* offset, ULONG process, mod->th32ProcessID = process ? process : GetCurrentProcessId(); mod->GlblcntUsage = 0xFFFF; /* FIXME */ mod->ProccntUsage = 0xFFFF; /* FIXME */ - mod->modBaseAddr = (BYTE*)ldr_mod[i].BaseAddress; + mod->modBaseAddr = ldr_mod[i].BaseAddress; mod->modBaseSize = ldr_mod[i].SizeOfImage; - mod->hModule = (HMODULE)ldr_mod[i].BaseAddress; + mod->hModule = ldr_mod[i].BaseAddress; l = min(ldr_mod[i].BaseDllName.Length, sizeof(mod->szModule) - sizeof(WCHAR)); memcpy(mod->szModule, ldr_mod[i].BaseDllName.Buffer, l); @@ -264,7 +264,7 @@ static void fill_thread( struct snapshot* snap, ULONG* offset, LPVOID info, ULON thd_entry = (THREADENTRY32*)&snap->data[*offset]; - spi = (SYSTEM_PROCESS_INFORMATION*)info; + spi = info; do { spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + poff); diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c index 6baf8c5e888..d30ae106681 100644 --- a/dlls/kernel32/volume.c +++ b/dlls/kernel32/volume.c @@ -1479,7 +1479,7 @@ HANDLE WINAPI FindFirstVolumeW( LPWSTR volume, DWORD len ) HeapFree( GetProcessHeap(), 0, output ); return INVALID_HANDLE_VALUE; } - return (HANDLE)output; + return output; } CloseHandle( mgr ); return INVALID_HANDLE_VALUE;