Commit 0fb9ef68 authored by Uwe Bonnes's avatar Uwe Bonnes Committed by Alexandre Julliard

Advance over * argument for precision.

Honor precision argument for strings.
parent 20894e2f
......@@ -76,6 +76,16 @@ static void test_sprintf( void )
ok(!strcmp(buffer,"0foo"),"String not zero-prefixed \"%s\"\n",buffer);
ok( r==4, "return count wrong\n");
format = "%.1s";
r = sprintf(buffer,format,"foo");
ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer);
ok( r==1, "return count wrong\n");
format = "%.*s";
r = sprintf(buffer,format,1,"foo");
ok(!strcmp(buffer,"f"),"Precision ignored \"%s\"\n",buffer);
ok( r==1, "return count wrong\n");
format = "%#-012p";
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n");
......
......@@ -309,6 +309,9 @@ static inline int pf_output_format_W( pf_output *out, LPCWSTR str,
if( len < 0 )
len = strlenW( str );
if (flags->Precision && flags->Precision < len)
len = flags->Precision;
r = pf_fill( out, len, flags, 1 );
if( r>=0 )
......@@ -328,6 +331,9 @@ static inline int pf_output_format_A( pf_output *out, LPCSTR str,
if( len < 0 )
len = strlen( str );
if (flags->Precision && flags->Precision < len)
len = flags->Precision;
r = pf_fill( out, len, flags, 1 );
if( r>=0 )
......@@ -461,7 +467,10 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
{
p++;
if( *p == '*' )
{
flags.Precision = va_arg( valist, int );
p++;
}
else while( isdigit(*p) )
{
flags.Precision *= 10;
......
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