Missing and zero precision specifiers are different.

This commit is contained in:
Mike McCormack 2005-10-27 10:20:08 +00:00 committed by Alexandre Julliard
parent 3c2bda8f83
commit 990e537ac5
1 changed files with 8 additions and 6 deletions

View File

@ -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,7 +309,7 @@ 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,7 +331,7 @@ 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 )
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 )
} }
/* deal with precision */ /* deal with precision */
flags.Precision = -1;
if( *p == '.' ) if( *p == '.' )
{ {
flags.Precision = 0;
p++; p++;
if( *p == '*' ) if( *p == '*' )
{ {