[PATCH] msvcrt: remove unnecessary NULL check (Coverity)

Marcus Meissner marcus at jet.franken.de
Fri Dec 4 03:10:48 CST 2009


Hi,

The NULL check is not really helping anything, as the code
will just crash with empty formatW either.

And since I guess *printf with format=NULL will just crash,
lets just crash earlier.

Ciao, Marcus
---
 dlls/msvcrt/wcs.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 0f3e9ee..6e08822 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -810,12 +810,9 @@ int CDECL MSVCRT_vsnprintf( char *str, unsigned int len,
     out.used = 0;
     out.len = len;
 
-    if( format )
-    {
-        sz = MultiByteToWideChar( CP_ACP, 0, format, -1, NULL, 0 );
-        formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
-        MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
-    }
+    sz = MultiByteToWideChar( CP_ACP, 0, format, -1, NULL, 0 );
+    formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
+    MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
 
     r = pf_vsnprintf( &out, formatW, valist );
 
-- 
1.5.6



More information about the wine-patches mailing list