MSVCRT: handle %ls in sprintf

Mike McCormack mike at codeweavers.com
Fri Mar 4 09:24:54 CST 2005


ChangeLog:
* handle %ls in sprintf
-------------- next part --------------
? dlls/msvcrt/tests/x
Index: dlls/msvcrt/wcs.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/wcs.c,v
retrieving revision 1.21
diff -u -p -r1.21 wcs.c
--- dlls/msvcrt/wcs.c	4 Mar 2005 10:47:27 -0000	1.21
+++ dlls/msvcrt/wcs.c	4 Mar 2005 15:23:37 -0000
@@ -501,7 +501,7 @@ static int pf_vsnprintf( pf_output *out,
         r = 0;
 
         /* output a unicode string */
-        if( ( flags.Format == 's' && flags.WideString ) ||
+        if( ( flags.Format == 's' && (flags.WideString || flags.IntegerLength == 'l' )) ||
             ( !out->unicode && flags.Format == 'S' ) ||
             ( out->unicode && flags.Format == 's' ) )
         {
Index: dlls/msvcrt/tests/printf.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/printf.c,v
retrieving revision 1.5
diff -u -p -r1.5 printf.c
--- dlls/msvcrt/tests/printf.c	4 Mar 2005 10:47:27 -0000	1.5
+++ dlls/msvcrt/tests/printf.c	4 Mar 2005 15:23:37 -0000
@@ -131,6 +131,16 @@ static void test_sprintf( void )
     ok(!strcmp(buffer,"-s"), "failed\n");
     ok( r==2, "return count wrong\n");
 
+    format = "%ls";
+    r = sprintf(buffer, format, wide );
+    ok(!strcmp(buffer,"wide"), "failed\n");
+    ok( r==4, "return count wrong\n");
+
+    format = "%Ls";
+    r = sprintf(buffer, format, "not wide" );
+    ok(!strcmp(buffer,"not wide"), "failed\n");
+    ok( r==8, "return count wrong\n");
+
     format = "%b";
     r = sprintf(buffer, format);
     ok(!strcmp(buffer,"b"), "failed\n");


More information about the wine-patches mailing list