Commit 7c4cb515 authored by Gregg Mattinson's avatar Gregg Mattinson Committed by Alexandre Julliard

Cast void* to char* for pointer arithmetic.

parent d0207594
......@@ -519,8 +519,8 @@ static const char* DEBUG_GetDbgInfo(enum DbgInfoLoad dil)
*/
static int DEBUG_ModuleCompare(const void* p1, const void* p2)
{
return (*((const DBG_MODULE**)p1))->load_addr -
(*((const DBG_MODULE**)p2))->load_addr;
return (char*)(*((const DBG_MODULE**)p1))->load_addr -
(char*)(*((const DBG_MODULE**)p2))->load_addr;
}
/***********************************************************************
......@@ -641,4 +641,3 @@ void DEBUG_WalkModules(void)
}
DBG_free(amod);
}
......@@ -90,7 +90,7 @@ void DPLAYX_PrivHeapFree( LPVOID addr )
return;
}
lpAddrStart = addr - sizeof(DWORD); /* Find block header */
lpAddrStart = (char*)addr - sizeof(DWORD); /* Find block header */
dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize;
lpMemArea[ dwBlockUsed ].used = 0;
......@@ -1342,4 +1342,3 @@ LPCSTR DPLAYX_HresultToString(HRESULT hr)
return szTempStr;
}
}
......@@ -1771,7 +1771,7 @@ MSVCRT_size_t MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, M
file->_ptr += pcnt;
read += pcnt ;
rcnt -= pcnt ;
ptr += pcnt;
ptr = (char*)ptr + pcnt;
} else if(!(file->_flag & MSVCRT__IOREAD )) {
if(file->_flag & MSVCRT__IORW) {
file->_flag |= MSVCRT__IOREAD;
......@@ -2164,7 +2164,7 @@ MSVCRT_size_t MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t n
file->_ptr += pcnt;
written = pcnt;
wrcnt -= pcnt;
ptr += pcnt;
ptr = (char*)ptr + pcnt;
} else if(!(file->_flag & MSVCRT__IOWRT)) {
if(file->_flag & MSVCRT__IORW) {
file->_flag |= MSVCRT__IOWRT;
......
......@@ -68,7 +68,7 @@ void* _lfind(const void* match, const void* start,
{
if (cf(match, start) == 0)
return (void *)start; /* found */
start += elem_size;
start = (char*)start + elem_size;
} while (--size);
return NULL;
}
......@@ -86,7 +86,7 @@ void* _lsearch(const void* match, void* start,
{
if (cf(match, start) == 0)
return start; /* found */
start += elem_size;
start = (char*)start + elem_size;
} while (--size);
/* not found, add to end */
......
......@@ -1973,7 +1973,7 @@ BOOL WINAPI SHLWAPI_351 (
LPVOID z) /* [in/out] buffer (+0x208 sent to GetFileVersionInfoA) */
{
GET_FUNC(pGetFileVersionInfoW, version, "GetFileVersionInfoW", 0);
return pGetFileVersionInfoW(w, x, y-0x208, z+0x208);
return pGetFileVersionInfoW(w, x, y-0x208, (char*)z+0x208);
}
/*************************************************************************
......@@ -1989,7 +1989,7 @@ WORD WINAPI SHLWAPI_352 (
UINT* z) /* [in] ver length - passed to VerQueryValueA as #4 */
{
GET_FUNC(pVerQueryValueW, version, "VerQueryValueW", 0);
return pVerQueryValueW(w+0x208, x, y, z);
return pVerQueryValueW((char*)w+0x208, x, y, z);
}
/**************************************************************************
......
......@@ -427,7 +427,7 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
lpwhr->StdHeaders[i].lpszField &&
lpwhr->StdHeaders[i].lpszValue)
{
cnt += sprintf(lpBuffer + cnt, "%s: %s%s", lpwhr->StdHeaders[i].lpszField, lpwhr->StdHeaders[i].lpszValue,
cnt += sprintf((char*)lpBuffer + cnt, "%s: %s%s", lpwhr->StdHeaders[i].lpszField, lpwhr->StdHeaders[i].lpszValue,
index == HTTP_QUERY_RAW_HEADERS_CRLF ? "\r\n" : "\0");
}
}
......@@ -439,13 +439,13 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel,
lpwhr->pCustHeaders[i].lpszField &&
lpwhr->pCustHeaders[i].lpszValue)
{
cnt += sprintf(lpBuffer + cnt, "%s: %s%s",
cnt += sprintf((char*)lpBuffer + cnt, "%s: %s%s",
lpwhr->pCustHeaders[i].lpszField, lpwhr->pCustHeaders[i].lpszValue,
index == HTTP_QUERY_RAW_HEADERS_CRLF ? "\r\n" : "\0");
}
}
strcpy(lpBuffer + cnt, index == HTTP_QUERY_RAW_HEADERS_CRLF ? "\r\n" : "");
strcpy((char*)lpBuffer + cnt, index == HTTP_QUERY_RAW_HEADERS_CRLF ? "\r\n" : "");
*lpdwBufferLength = cnt + delim;
bSuccess = TRUE;
......
......@@ -690,7 +690,7 @@ static MMDRV_MapType MMDRV_MidiOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
if (ptr) {
SEGPTR segptr = MapLS(ptr);
*(LPMIDIOPENDESC*)ptr = mod32;
*(LPDWORD)(ptr + sizeof(LPMIDIOPENDESC)) = *lpdwUser;
*(LPDWORD)((char*)ptr + sizeof(LPMIDIOPENDESC)) = *lpdwUser;
mod16 = (LPMIDIOPENDESC16)((LPSTR)ptr + sizeof(LPMIDIOPENDESC) + 2*sizeof(DWORD));
mod16->hMidi = mod32->hMidi;
......@@ -1067,7 +1067,7 @@ static MMDRV_MapType MMDRV_WaveIn_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPDW
if (ptr) {
SEGPTR seg_ptr = MapLS( ptr );
*(LPWAVEOPENDESC*)ptr = wod32;
*(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
*(LPDWORD)((char*)ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
wod16 = (LPWAVEOPENDESC16)((LPSTR)ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD));
wod16->hWave = wod32->hWave;
......@@ -1626,7 +1626,7 @@ static MMDRV_MapType MMDRV_WaveOut_Map32ATo16 (UINT wMsg, LPDWORD lpdwUser, LPD
if (ptr) {
SEGPTR seg_ptr = MapLS( ptr );
*(LPWAVEOPENDESC*)ptr = wod32;
*(LPDWORD)(ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
*(LPDWORD)((char*)ptr + sizeof(LPWAVEOPENDESC)) = *lpdwUser;
wod16 = (LPWAVEOPENDESC16)((LPSTR)ptr + sizeof(LPWAVEOPENDESC) + 2*sizeof(DWORD));
wod16->hWave = wod32->hWave;
......
......@@ -1111,7 +1111,7 @@ BOOL WINAPI SMB_ReadFile(HANDLE hFile, LPVOID buffer, DWORD bytesToRead, LPDWORD
if(!read)
break;
total += read;
buffer += read;
buffer = (char*)buffer + read;
offset += read;
if(total>=bytesToRead)
break;
......
......@@ -1621,7 +1621,7 @@ VOID WINAPI GlobalMemoryStatus(
#endif
/* FIXME: should do something for other systems */
GetSystemInfo(&si);
lpmem->dwTotalVirtual = si.lpMaximumApplicationAddress-si.lpMinimumApplicationAddress;
lpmem->dwTotalVirtual = (char*)si.lpMaximumApplicationAddress-(char*)si.lpMinimumApplicationAddress;
/* FIXME: we should track down all the already allocated VM pages and substract them, for now arbitrarily remove 64KB so that it matches NT */
lpmem->dwAvailVirtual = lpmem->dwTotalVirtual-64*1024;
memcpy(&cached_memstatus,lpmem,sizeof(MEMORYSTATUS));
......
......@@ -168,7 +168,7 @@ static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size, unsigne
for (i = 0; i < count; i++)
{
wine_ldt_set_entry( sel + (i << __AHSHIFT), &entry );
wine_ldt_set_base( &entry, wine_ldt_get_base(&entry) + 0x10000 );
wine_ldt_set_base( &entry, (char*)wine_ldt_get_base(&entry) + 0x10000);
/* yep, Windows sets limit like that, not 64K sel units */
wine_ldt_set_limit( &entry, wine_ldt_get_limit(&entry) - 0x10000 );
}
......
......@@ -221,7 +221,7 @@ static FILE_VIEW *VIRTUAL_FindView( const void *addr ) /* [in] Address */
view = NULL;
break;
}
if (view->base + view->size > addr) break;
if ((char*)view->base + view->size > (char*)addr) break;
view = view->next;
}
LeaveCriticalSection(&csVirtual);
......
......@@ -81,8 +81,8 @@ void* PRD(unsigned long prd, unsigned long len)
unsigned long Offset(void* ptr)
{
if (ptr < base) {printf("<<<<<ptr below\n");return 0;}
if (ptr >= base + total_len) {printf("<<<<<ptr above\n");return 0;}
return ptr - base;
if ((char *)ptr >= (char*)base + total_len) {printf("<<<<<ptr above\n");return 0;}
return (char*)ptr - (char*)base;
}
void* RVA(unsigned long rva, unsigned long len)
......
......@@ -328,9 +328,9 @@ DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DW
/* allocate our structure to remember old colors */
LPVOID pOldCol = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)+n*sizeof(HPEN)+n*sizeof(HBRUSH));
LPVOID p = pOldCol;
*(DWORD *)p = n; p += sizeof(DWORD);
memcpy(p, SysColorPens, n*sizeof(HPEN)); p += n*sizeof(HPEN);
memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p += n*sizeof(HBRUSH);
*(DWORD *)p = n; p = (char*)p + sizeof(DWORD);
memcpy(p, SysColorPens, n*sizeof(HPEN)); p = (char*)p + n*sizeof(HPEN);
memcpy(p, SysColorBrushes, n*sizeof(HBRUSH)); p = (char*)p + n*sizeof(HBRUSH);
for (i=0; i < n; i++)
{
......@@ -345,16 +345,16 @@ DWORD WINAPI SetSysColorsTemp( const COLORREF *pPens, const HBRUSH *pBrushes, DW
LPVOID pOldCol = (LPVOID)n;
LPVOID p = pOldCol;
DWORD nCount = *(DWORD *)p;
p += sizeof(DWORD);
p = (char*)p + sizeof(DWORD);
for (i=0; i < nCount; i++)
{
DeleteObject(SysColorPens[i]);
SysColorPens[i] = *(HPEN *)p; p += sizeof(HPEN);
SysColorPens[i] = *(HPEN *)p; p = (char*)p + sizeof(HPEN);
}
for (i=0; i < nCount; i++)
{
SysColorBrushes[i] = *(HBRUSH *)p; p += sizeof(HBRUSH);
SysColorBrushes[i] = *(HBRUSH *)p; p = (char*)p + sizeof(HBRUSH);
}
/* get rid of storage structure */
HeapFree(GetProcessHeap(), 0, pOldCol);
......@@ -395,5 +395,3 @@ HPEN SYSCOLOR_GetPen( INT index )
return SysColorPens[index];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment