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:
parent
bd298b511e
commit
180326bb0a
|
@ -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' )
|
||||
|
|
Loading…
Reference in New Issue