msvcrt: Set errno in strtod.

Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2020-07-16 13:10:31 +02:00 committed by Alexandre Julliard
parent 3f8b0891e7
commit 0945ba00fb
2 changed files with 5 additions and 2 deletions

View File

@ -696,6 +696,11 @@ double parse_double(MSVCRT_wchar_t (*get)(void *ctx), void (*unget)(void *ctx),
nch = get(ctx);
}
if(!err) err = MSVCRT__errno();
#if _MSVCR_VER == 0
*err = 0;
#endif
if(!found_digit) {
if(nch != MSVCRT_WEOF) unget(ctx);
if(found_dp) unget(ctx);
@ -759,7 +764,6 @@ double parse_double(MSVCRT_wchar_t (*get)(void *ctx), void (*unget)(void *ctx),
if(off < 0) off += LIMB_DIGITS;
if(off) bnum_mult(&b, p10s[off]);
if(!err) err = MSVCRT__errno();
if(dp-1 > MSVCRT_DBL_MAX_10_EXP)
return make_double(sign, INT_MAX, 1, ROUND_ZERO, err);
/* Count part of exponent stored in denormalized mantissa. */

View File

@ -1976,7 +1976,6 @@ static void test__strtod(void)
ok(d == tests[i].ret, "%d) d = %.16e\n", i, d);
ok(end == tests[i].str + tests[i].len, "%d) len = %d\n",
i, (int)(end - tests[i].str));
todo_wine_if(!tests[i].err)
ok(errno == tests[i].err, "%d) errno = %d\n", i, errno);
}