From 4ee316a997542459119c054989419066897702f4 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 18 Feb 2016 16:10:06 +0100 Subject: [PATCH] msvcr120: Add wcstof implementation. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- .../api-ms-win-crt-convert-l1-1-0.spec | 4 +-- dlls/msvcr120/msvcr120.spec | 4 +-- dlls/msvcr120/tests/msvcr120.c | 25 +++++++++++++++++++ dlls/msvcr120_app/msvcr120_app.spec | 4 +-- dlls/msvcrt/wcs.c | 16 ++++++++++++ dlls/ucrtbase/ucrtbase.spec | 4 +-- 6 files changed, 49 insertions(+), 8 deletions(-) diff --git a/dlls/api-ms-win-crt-convert-l1-1-0/api-ms-win-crt-convert-l1-1-0.spec b/dlls/api-ms-win-crt-convert-l1-1-0/api-ms-win-crt-convert-l1-1-0.spec index 6d3e4f617c2..b38905b134d 100644 --- a/dlls/api-ms-win-crt-convert-l1-1-0/api-ms-win-crt-convert-l1-1-0.spec +++ b/dlls/api-ms-win-crt-convert-l1-1-0/api-ms-win-crt-convert-l1-1-0.spec @@ -51,7 +51,7 @@ @ cdecl _ultow(long ptr long) ucrtbase._ultow @ cdecl _ultow_s(long ptr long long) ucrtbase._ultow_s @ cdecl _wcstod_l(wstr ptr) ucrtbase._wcstod_l -@ stub _wcstof_l +@ cdecl _wcstof_l(wstr ptr ptr) ucrtbase._wcstof_l @ cdecl -ret64 _wcstoi64(wstr ptr long) ucrtbase._wcstoi64 @ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) ucrtbase._wcstoi64_l @ stub _wcstoimax_l @@ -106,7 +106,7 @@ @ cdecl wcsrtombs(ptr ptr long ptr) ucrtbase.wcsrtombs @ cdecl wcsrtombs_s(ptr ptr long ptr long ptr) ucrtbase.wcsrtombs_s @ cdecl wcstod(wstr ptr) ucrtbase.wcstod -@ stub wcstof +@ cdecl wcstof(ptr ptr) ucrtbase.wcstof @ stub wcstoimax @ cdecl wcstol(wstr ptr long) ucrtbase.wcstol @ stub wcstold diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 2305026a4e5..00efc6c0fe3 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1888,7 +1888,7 @@ @ cdecl _wcsset(wstr long) MSVCRT__wcsset @ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s @ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l -@ stub _wcstof_l +@ cdecl _wcstof_l(wstr ptr ptr) MSVCRT__wcstof_l @ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64 @ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l @ stub _wcstoimax_l @@ -2470,7 +2470,7 @@ @ cdecl wcsspn(wstr wstr) ntdll.wcsspn @ cdecl wcsstr(wstr wstr) MSVCRT_wcsstr @ cdecl wcstod(wstr ptr) MSVCRT_wcstod -@ stub wcstof +@ cdecl wcstof(ptr ptr) MSVCRT_wcstof @ stub wcstoimax @ cdecl wcstok(wstr wstr) MSVCRT_wcstok @ cdecl wcstok_s(ptr wstr ptr) MSVCRT_wcstok_s diff --git a/dlls/msvcr120/tests/msvcr120.c b/dlls/msvcr120/tests/msvcr120.c index c37d8f73db5..341aec4914c 100644 --- a/dlls/msvcr120/tests/msvcr120.c +++ b/dlls/msvcr120/tests/msvcr120.c @@ -87,6 +87,7 @@ static void* (CDECL *p__W_Gettnames)(void); static void (CDECL *p_free)(void*); static float (CDECL *p_strtof)(const char *, char **); static int (CDECL *p__finite)(double); +static float (CDECL *p_wcstof)(const wchar_t*, wchar_t**); static BOOL init(void) { @@ -111,6 +112,7 @@ static BOOL init(void) p_free = (void*)GetProcAddress(module, "free"); p_strtof = (void*)GetProcAddress(module, "strtof"); p__finite = (void*)GetProcAddress(module, "_finite"); + p_wcstof = (void*)GetProcAddress(module, "wcstof"); return TRUE; } @@ -334,6 +336,9 @@ static void test__strtof(void) const char float3[] = "-3.402823466e+38"; const char float4[] = "1.7976931348623158e+308"; /* DBL_MAX */ + const WCHAR twelve[] = {'1','2','.','0',0}; + const WCHAR arabic23[] = { 0x662, 0x663, 0}; + char *end; float f; @@ -367,11 +372,31 @@ static void test__strtof(void) f = p_strtof("0x12", NULL); ok(f == 0, "f = %lf\n", f); + + f = p_wcstof(twelve, NULL); + ok(f == 12.0, "f = %lf\n", f); + + f = p_wcstof(arabic23, NULL); + ok(f == 0, "f = %lf\n", f); + + if(!p_setlocale(LC_ALL, "Arabic")) { + win_skip("Arabic locale not available\n"); + return; + } + + f = p_wcstof(twelve, NULL); + ok(f == 12.0, "f = %lf\n", f); + + f = p_wcstof(arabic23, NULL); + ok(f == 0, "f = %lf\n", f); + + p_setlocale(LC_ALL, "C"); } START_TEST(msvcr120) { if (!init()) return; + test__strtof(); test_lconv(); test__dsign(); test__dpcomp(); diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 682f2c716b9..87bf9dc8f22 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1581,7 +1581,7 @@ @ cdecl _wcsset(wstr long) msvcr120._wcsset @ cdecl _wcsset_s(wstr long long) msvcr120._wcsset_s @ cdecl _wcstod_l(wstr ptr) msvcr120._wcstod_l -@ stub _wcstof_l +@ cdecl _wcstof_l(wstr ptr ptr) msvcr120._wcstof_l @ cdecl -ret64 _wcstoi64(wstr ptr long) msvcr120._wcstoi64 @ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) msvcr120._wcstoi64_l @ stub _wcstoimax_l @@ -2132,7 +2132,7 @@ @ cdecl wcsspn(wstr wstr) msvcr120.wcsspn @ cdecl wcsstr(wstr wstr) msvcr120.wcsstr @ cdecl wcstod(wstr ptr) msvcr120.wcstod -@ stub wcstof +@ cdecl wcstof(ptr ptr) msvcr120.wcstof @ stub wcstoimax @ cdecl wcstok(wstr wstr) msvcr120.wcstok @ cdecl wcstok_s(ptr wstr ptr) msvcr120.wcstok_s diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 0f80d3bea4f..c6091a82b94 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -646,6 +646,22 @@ double CDECL MSVCRT__wtof_l(const MSVCRT_wchar_t *str, MSVCRT__locale_t locale) return MSVCRT__wcstod_l(str, NULL, locale); } +/********************************************************************* + * _wcstof_l (MSVCR120.@) + */ +float CDECL MSVCRT__wcstof_l( const MSVCRT_wchar_t *str, MSVCRT_wchar_t **end, MSVCRT__locale_t locale ) +{ + return MSVCRT__wcstod_l(str, end, locale); +} + +/********************************************************************* + * wcstof (MSVCR120.@) + */ +float CDECL MSVCRT_wcstof( const MSVCRT_wchar_t *str, MSVCRT_wchar_t **end ) +{ + return MSVCRT__wcstof_l(str, end, NULL); +} + /********************************************************************* * arg_clbk_valist (INTERNAL) */ diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index 2a6906fa3a8..15f3781c2aa 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -2037,7 +2037,7 @@ @ cdecl _wcsset(wstr long) MSVCRT__wcsset @ cdecl _wcsset_s(wstr long long) MSVCRT__wcsset_s @ cdecl _wcstod_l(wstr ptr) MSVCRT__wcstod_l -@ stub _wcstof_l +@ cdecl _wcstof_l(wstr ptr ptr) MSVCRT__wcstof_l @ cdecl -ret64 _wcstoi64(wstr ptr long) MSVCRT__wcstoi64 @ cdecl -ret64 _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l @ stub _wcstoimax_l @@ -2576,7 +2576,7 @@ @ cdecl wcsspn(wstr wstr) ntdll.wcsspn @ cdecl wcsstr(wstr wstr) MSVCRT_wcsstr @ cdecl wcstod(wstr ptr) MSVCRT_wcstod -@ stub wcstof +@ cdecl wcstof(ptr ptr) MSVCRT_wcstof @ stub wcstoimax @ cdecl wcstok(wstr wstr) MSVCRT_wcstok @ cdecl wcstok_s(ptr wstr ptr) MSVCRT_wcstok_s