Commit 180326bb authored by Jesse Allen's avatar Jesse Allen Committed by Alexandre Julliard

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.
parent bd298b51
......@@ -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");
......
......@@ -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' )
......
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