Commit 39b725b7 authored by Jesse Allen's avatar Jesse Allen Committed by Alexandre Julliard

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

parent 9a95aa7d
...@@ -66,6 +66,11 @@ static void test_sprintf( void ) ...@@ -66,6 +66,11 @@ static void test_sprintf( void )
ok(!strcmp(buffer,"0001"),"Character not zero-prefixed \"%s\"\n",buffer); ok(!strcmp(buffer,"0001"),"Character not zero-prefixed \"%s\"\n",buffer);
ok( r==4, "return count wrong\n"); 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"; format = "%p";
r = sprintf(buffer,format,(void *)57); r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer); ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
......
...@@ -286,12 +286,11 @@ static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left ) ...@@ -286,12 +286,11 @@ static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left )
int i, r = 0; int i, r = 0;
if( ( !left && flags->LeftAlign ) || if( ( !left && flags->LeftAlign ) ||
( left && !flags->LeftAlign ) || ( left && !flags->LeftAlign ))
( left && flags->PadZero ) )
{ {
for( i=0; (i<(flags->FieldLength-len)) && (r>=0); i++ ) for( i=0; (i<(flags->FieldLength-len)) && (r>=0); i++ )
{ {
if( flags->PadZero ) if( left && flags->PadZero )
r = pf_output_stringA( out, "0", 1 ); r = pf_output_stringA( out, "0", 1 );
else else
r = pf_output_stringA( out, " ", 1 ); r = pf_output_stringA( out, " ", 1 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment