Alexandre Julliard : kernel32: Don' t use sizeof in traces to avoid printf format warnings.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 14 06:50:47 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 1c66c611a118c1cfec5ee278ee117c5a6ddb27be
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=1c66c611a118c1cfec5ee278ee117c5a6ddb27be

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 13 14:10:39 2006 +0200

kernel32: Don't use sizeof in traces to avoid printf format warnings.

---

 dlls/kernel/format_msg.c |   10 ++++------
 dlls/kernel/toolhelp.c   |    4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/dlls/kernel/format_msg.c b/dlls/kernel/format_msg.c
index 375c5da..26ffcec 100644
--- a/dlls/kernel/format_msg.c
+++ b/dlls/kernel/format_msg.c
@@ -138,6 +138,7 @@ DWORD WINAPI FormatMessageA(
 	va_list* _args )
 {
     LPDWORD args=(LPDWORD)_args;
+    DWORD ret = 0;
 #if defined(__i386__) || defined(__sparc__)
 /* This implementation is completely dependent on the format of the va_list on x86 CPUs */
     LPSTR	target,t;
@@ -331,13 +332,10 @@ #define ADD_TO_T(c) do { \
     }
     HeapFree(GetProcessHeap(),0,target);
     HeapFree(GetProcessHeap(),0,from);
-    TRACE("-- returning %d\n", (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?  strlen(*(LPSTR*)lpBuffer):strlen(lpBuffer));
-    return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
-        strlen(*(LPSTR*)lpBuffer):
-            strlen(lpBuffer);
-#else
-    return 0;
+    ret = (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer) : strlen(lpBuffer);
 #endif /* __i386__ */
+    TRACE("-- returning %ld\n", ret);
+    return ret;
 }
 #undef ADD_TO_T
 
diff --git a/dlls/kernel/toolhelp.c b/dlls/kernel/toolhelp.c
index 47b63a3..2a3cba2 100644
--- a/dlls/kernel/toolhelp.c
+++ b/dlls/kernel/toolhelp.c
@@ -501,7 +501,7 @@ static BOOL module_nextW( HANDLE hSnapSh
     if (lpme->dwSize < sizeof (MODULEENTRY32W))
     {
         SetLastError( ERROR_INSUFFICIENT_BUFFER );
-        WARN("Result buffer too small (req: %d, was: %ld)\n", sizeof(MODULEENTRY32W), lpme->dwSize);
+        WARN("Result buffer too small (was: %ld)\n", lpme->dwSize);
         return FALSE;
     }
     if ((snap = MapViewOfFile( hSnapShot, FILE_MAP_ALL_ACCESS, 0, 0, 0 )))
@@ -553,7 +553,7 @@ static BOOL module_nextA( HANDLE handle,
     if (lpme->dwSize < sizeof(MODULEENTRY32))
     {
         SetLastError( ERROR_INSUFFICIENT_BUFFER );
-        WARN("Result buffer too small (req: %d, was: %ld)\n", sizeof(MODULEENTRY32), lpme->dwSize);
+        WARN("Result buffer too small (was: %ld)\n", lpme->dwSize);
         return FALSE;
     }
 




More information about the wine-cvs mailing list