Piotr Caban : msvcrt: Format strings according to specified locale in pf_vsnprintf.
Alexandre Julliard
julliard at winehq.org
Mon Apr 19 11:51:16 CDT 2010
Module: wine
Branch: master
Commit: 419f902546bf741d30bce47548550a96bfa54de0
URL: http://source.winehq.org/git/wine.git/?a=commit;h=419f902546bf741d30bce47548550a96bfa54de0
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Apr 19 10:57:14 2010 +0200
msvcrt: Format strings according to specified locale in pf_vsnprintf.
---
dlls/msvcrt/wcs.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index e453e9c..182af01 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -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 );
}
/*********************************************************************
More information about the wine-cvs
mailing list