msvcrt: Format strings according to specified locale in pf_vsnprintf.
This commit is contained in:
parent
d8504e0550
commit
419f902546
|
@ -554,12 +554,15 @@ static void pf_fixup_exponent( char *buf )
|
|||
*
|
||||
* implements both A and W vsnprintf functions
|
||||
*/
|
||||
static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valist )
|
||||
static int pf_vsnprintf( pf_output *out, const WCHAR *format, MSVCRT__locale_t locale, __ms_va_list valist )
|
||||
{
|
||||
int r;
|
||||
LPCWSTR q, p = format;
|
||||
pf_flags flags;
|
||||
|
||||
if(!locale)
|
||||
locale = get_locale();
|
||||
|
||||
TRACE("format is %s\n",debugstr_w(format));
|
||||
while (*p)
|
||||
{
|
||||
|
@ -751,7 +754,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
|
|||
/* deal with integers and floats using libc's printf */
|
||||
else if( pf_is_valid_format( flags.Format ) )
|
||||
{
|
||||
char fmt[20], number[40], *x = number;
|
||||
char fmt[20], number[40], *x = number, *decimal_point;
|
||||
|
||||
/* Estimate largest possible required buffer size:
|
||||
* Chooses the larger of the field or precision
|
||||
|
@ -775,6 +778,10 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valis
|
|||
else
|
||||
sprintf( x, fmt, va_arg(valist, int) );
|
||||
|
||||
decimal_point = strchr(x, '.');
|
||||
if(decimal_point)
|
||||
*decimal_point = *locale->locinfo->lconv->decimal_point;
|
||||
|
||||
r = pf_output_stringA( out, x, -1 );
|
||||
if( x != number )
|
||||
HeapFree( GetProcessHeap(), 0, x );
|
||||
|
@ -814,7 +821,7 @@ int CDECL MSVCRT_vsnprintf( char *str, unsigned int len,
|
|||
formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
|
||||
MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
|
||||
|
||||
r = pf_vsnprintf( &out, formatW, valist );
|
||||
r = pf_vsnprintf( &out, formatW, NULL, valist );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, formatW );
|
||||
|
||||
|
@ -871,7 +878,7 @@ int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
|
|||
out.used = 0;
|
||||
out.len = len;
|
||||
|
||||
return pf_vsnprintf( &out, format, valist );
|
||||
return pf_vsnprintf( &out, format, NULL, valist );
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
|
|
Loading…
Reference in New Issue