Daniel Lehman : msvcrt: Set errno in strtod.
Alexandre Julliard
julliard at winehq.org
Thu Jul 16 19:01:21 CDT 2020
Module: wine
Branch: master
Commit: 0945ba00fb813668ba94223851450eca439fbae9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0945ba00fb813668ba94223851450eca439fbae9
Author: Daniel Lehman <dlehman25 at gmail.com>
Date: Thu Jul 16 13:10:31 2020 +0200
msvcrt: Set errno in strtod.
Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/string.c | 6 +++++-
dlls/msvcrt/tests/string.c | 1 -
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index 62ec54607e..49cc8e40ae 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -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. */
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index ccbd049c4c..8a2d678b63 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -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);
}
More information about the wine-cvs
mailing list