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

This commit is contained in:
Jesse Allen 2005-12-20 11:49:05 +01:00 committed by Alexandre Julliard
parent 9a95aa7da2
commit 39b725b799
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -286,12 +286,11 @@ static inline int pf_fill( pf_output *out, int len, pf_flags *flags, char left )
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 );