Fabian Maurer : msvcrt/math: In _fcvt/_fcvt_s handle locale decimal separator properly.

Alexandre Julliard julliard at winehq.org
Tue Aug 25 16:16:57 CDT 2020


Module: wine
Branch: master
Commit: 9a9319b0589065edbc60a1ff7735cad0dbe481af
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9a9319b0589065edbc60a1ff7735cad0dbe481af

Author: Fabian Maurer <dark.shadow4 at web.de>
Date:   Mon Aug 24 22:01:30 2020 +0200

msvcrt/math: In _fcvt/_fcvt_s handle locale decimal separator properly.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49730
Signed-off-by: Fabian Maurer <dark.shadow4 at web.de>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/math.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c
index a75b551210..15d8fa4be7 100644
--- a/dlls/msvcrt/math.c
+++ b/dlls/msvcrt/math.c
@@ -2518,6 +2518,7 @@ char * CDECL MSVCRT__fcvt( double number, int ndigits, int *decpt, int *sign )
     int stop, dec1, dec2;
     char *ptr1, *ptr2, *first;
     char buf[80]; /* ought to be enough */
+    char decimal_separator = get_locinfo()->lconv->decimal_point[0];
 
     if (!data->efcvt_buffer)
         data->efcvt_buffer = MSVCRT_malloc( 80 ); /* ought to be enough */
@@ -2549,7 +2550,7 @@ char * CDECL MSVCRT__fcvt( double number, int ndigits, int *decpt, int *sign )
     }
 
     while (*ptr1 == '0') ptr1++; /* Skip leading zeroes */
-    while (*ptr1 != '\0' && *ptr1 != '.') {
+    while (*ptr1 != '\0' && *ptr1 != decimal_separator) {
 	if (!first) first = ptr2;
 	if ((ptr1 - buf) < stop) {
 	    *ptr2++ = *ptr1++;
@@ -2598,6 +2599,7 @@ int CDECL MSVCRT__fcvt_s(char* outbuffer, MSVCRT_size_t size, double number, int
     int stop, dec1, dec2;
     char *ptr1, *ptr2, *first;
     char buf[80]; /* ought to be enough */
+    char decimal_separator = get_locinfo()->lconv->decimal_point[0];
 
     if (!outbuffer || !decpt || !sign || size == 0)
     {
@@ -2632,7 +2634,7 @@ int CDECL MSVCRT__fcvt_s(char* outbuffer, MSVCRT_size_t size, double number, int
     }
 
     while (*ptr1 == '0') ptr1++; /* Skip leading zeroes */
-    while (*ptr1 != '\0' && *ptr1 != '.') {
+    while (*ptr1 != '\0' && *ptr1 != decimal_separator) {
 	if (!first) first = ptr2;
 	if ((ptr1 - buf) < stop) {
 	    if (size > 1) {




More information about the wine-cvs mailing list