Commit 990e537a authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Missing and zero precision specifiers are different.

parent 3c2bda8f
...@@ -194,7 +194,7 @@ typedef struct pf_output_t ...@@ -194,7 +194,7 @@ typedef struct pf_output_t
typedef struct pf_flags_t typedef struct pf_flags_t
{ {
char Sign, LeftAlign, Alternate, PadZero; char Sign, LeftAlign, Alternate, PadZero;
char FieldLength, Precision; int FieldLength, Precision;
char IntegerLength, IntegerDouble; char IntegerLength, IntegerDouble;
char WideString; char WideString;
char Format; char Format;
...@@ -309,8 +309,8 @@ static inline int pf_output_format_W( pf_output *out, LPCWSTR str, ...@@ -309,8 +309,8 @@ static inline int pf_output_format_W( pf_output *out, LPCWSTR str,
if( len < 0 ) if( len < 0 )
len = strlenW( str ); len = strlenW( str );
if (flags->Precision && flags->Precision < len) if (flags->Precision >= 0 && flags->Precision < len)
len = flags->Precision; len = flags->Precision;
r = pf_fill( out, len, flags, 1 ); r = pf_fill( out, len, flags, 1 );
...@@ -331,8 +331,8 @@ static inline int pf_output_format_A( pf_output *out, LPCSTR str, ...@@ -331,8 +331,8 @@ static inline int pf_output_format_A( pf_output *out, LPCSTR str,
if( len < 0 ) if( len < 0 )
len = strlen( str ); len = strlen( str );
if (flags->Precision && flags->Precision < len) if (flags->Precision >= 0 && flags->Precision < len)
len = flags->Precision; len = flags->Precision;
r = pf_fill( out, len, flags, 1 ); r = pf_fill( out, len, flags, 1 );
...@@ -379,7 +379,7 @@ static void pf_rebuild_format_string( char *p, pf_flags *flags ) ...@@ -379,7 +379,7 @@ static void pf_rebuild_format_string( char *p, pf_flags *flags )
sprintf(p, "%d", flags->FieldLength); sprintf(p, "%d", flags->FieldLength);
p += strlen(p); p += strlen(p);
} }
if( flags->Precision ) if( flags->Precision >= 0 )
{ {
sprintf(p, ".%d", flags->Precision); sprintf(p, ".%d", flags->Precision);
p += strlen(p); p += strlen(p);
...@@ -467,8 +467,10 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist ) ...@@ -467,8 +467,10 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
} }
/* deal with precision */ /* deal with precision */
flags.Precision = -1;
if( *p == '.' ) if( *p == '.' )
{ {
flags.Precision = 0;
p++; p++;
if( *p == '*' ) if( *p == '*' )
{ {
......
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