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@web.de> Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
18f076d368
commit
9a9319b058
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue