Jesse Allen : msvcrt: Ignore PadZero when LeftAlign is true in printf conversions.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 20 04:56:27 CST 2005


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

Author: Jesse Allen <the3dfxdude at gmail.com>
Date:   Tue Dec 20 11:49:05 2005 +0100

msvcrt: Ignore PadZero when LeftAlign is true in printf conversions.

---

 dlls/msvcrt/tests/printf.c |    5 +++++
 dlls/msvcrt/wcs.c          |    5 ++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index 72b12a4..3979a95 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -66,6 +66,11 @@ static void test_sprintf( void )
     ok(!strcmp(buffer,"0001"),"Character not zero-prefixed \"%s\"\n",buffer);
     ok( r==4, "return count wrong\n");
 
+    format = "%-04c";
+    r = sprintf(buffer,format,'1');
+    ok(!strcmp(buffer,"1   "),"Character zero-padded and/or not left-adjusted \"%s\"\n",buffer);
+    ok( r==4, "return count wrong\n");
+
     format = "%p";
     r = sprintf(buffer,format,(void *)57);
     ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index b8dc39e..efb93d8 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -286,12 +286,11 @@ static inline int pf_fill( pf_output *ou
     int i, r = 0;
 
     if( ( !left &&  flags->LeftAlign ) || 
-        (  left && !flags->LeftAlign ) ||
-        (  left &&  flags->PadZero   ) )
+        (  left && !flags->LeftAlign ))
     {
         for( i=0; (i<(flags->FieldLength-len)) && (r>=0); i++ )
         {
-            if( flags->PadZero )
+            if( left && flags->PadZero )
                 r = pf_output_stringA( out, "0", 1 );
             else
                 r = pf_output_stringA( out, " ", 1 );




More information about the wine-cvs mailing list