Commit 9a9319b0 authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

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

parent 18f076d3
......@@ -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) {
......
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