msvcrt: Fix printf sign flags.

Fix the printf sign flags so that '+' doesn't always override ' '
space alone.  If they both appear, continue parsing and let '+' take
precedence.
This commit is contained in:
Jesse Allen 2005-12-21 20:07:03 +01:00 committed by Alexandre Julliard
parent bd298b511e
commit 180326bb0a
2 changed files with 14 additions and 1 deletions

View File

@ -56,6 +56,16 @@ static void test_sprintf( void )
ok(!strcmp(buffer, "I"), "Problem with \"I\" interpretation\n");
ok( r==1, "return count wrong\n");
format = "% d";
r = sprintf(buffer,format,1);
ok(!strcmp(buffer, " 1"),"Problem with sign place-holder: '%s'\n",buffer);
ok( r==2, "return count wrong\n");
format = "%+ d";
r = sprintf(buffer,format,1);
ok(!strcmp(buffer, "+1"),"Problem with sign flags: '%s'\n",buffer);
ok( r==2, "return count wrong\n");
format = "%S";
r = sprintf(buffer,format,wide);
ok(!strcmp(buffer,"wide"),"Problem with wide string format\n");

View File

@ -438,7 +438,10 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
while (*p)
{
if( *p == '+' || *p == ' ' )
flags.Sign = '+';
{
if ( flags.Sign != '+' )
flags.Sign = *p;
}
else if( *p == '-' )
flags.LeftAlign = *p;
else if( *p == '0' )