KERNEL32: fix some gcc 4.0 warnings
Mike McCormack
mike at codeweavers.com
Sun Jul 3 20:35:22 CDT 2005
gcc 4.0 treats sizeof(x) as an unsigned int, so gives a format warning
where we use sizeof() as a parameter to a debug macro. eg.
toolhelp.c:89: warning: format '%ld' expects type 'long int', but
argument 5 has type 'unsigned int'
Mike
ChangeLog:
* fix some gcc 4.0 warnings
-------------- next part --------------
Index: dlls/kernel/toolhelp.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/toolhelp.c,v
retrieving revision 1.31
diff -u -p -r1.31 toolhelp.c
--- dlls/kernel/toolhelp.c 24 May 2005 10:12:06 -0000 1.31
+++ dlls/kernel/toolhelp.c 3 Jul 2005 16:31:38 -0000
@@ -86,7 +86,7 @@ static BOOL TOOLHELP_Thread32Next( HANDL
if (lpte->dwSize < sizeof(THREADENTRY32))
{
SetLastError( ERROR_INSUFFICIENT_BUFFER );
- ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(THREADENTRY32), lpte->dwSize);
+ ERR("Result buffer too small (%ld)\n", lpte->dwSize);
return FALSE;
}
SERVER_START_REQ( next_thread )
@@ -138,26 +138,16 @@ static BOOL TOOLHELP_Process32Next( HAND
{
BOOL ret;
WCHAR exe[MAX_PATH-1];
- DWORD len;
+ DWORD len, sz;
- if (unicode)
+ sz = unicode ? sizeof(PROCESSENTRY32W) : sizeof(PROCESSENTRY32);
+ if (lppe->dwSize < sz)
{
- if (lppe->dwSize < sizeof(PROCESSENTRY32W))
- {
- SetLastError( ERROR_INSUFFICIENT_BUFFER );
- ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(PROCESSENTRY32W), lppe->dwSize);
- return FALSE;
- }
- }
- else
- {
- if (lppe->dwSize < sizeof(PROCESSENTRY32))
- {
- SetLastError( ERROR_INSUFFICIENT_BUFFER );
- ERR("Result buffer too small (req: %d, was: %ld)\n", sizeof(PROCESSENTRY32), lppe->dwSize);
- return FALSE;
- }
+ SetLastError( ERROR_INSUFFICIENT_BUFFER );
+ ERR("Result buffer too small (req: %ld, was: %ld)\n", sz, lppe->dwSize);
+ return FALSE;
}
+
SERVER_START_REQ( next_process )
{
req->handle = handle;
More information about the wine-patches
mailing list