From 2f9dd7f6cbedd58ec551b73acdb873402666d74e Mon Sep 17 00:00:00 2001 From: Hua Meng <161220092@smail.nju.edu.cn> Date: Mon, 26 Mar 2018 21:20:22 +0200 Subject: [PATCH] msvcrt: Implement _atol_l. Signed-off-by: Hua Meng <161220092@smail.nju.edu.cn> Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- .../api-ms-win-crt-convert-l1-1-0.spec | 2 +- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr120_app/msvcr120_app.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/string.c | 17 +++++++++++++++++ dlls/ucrtbase/ucrtbase.spec | 2 +- 10 files changed, 26 insertions(+), 9 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 bb9a67751de..aa2f513ee2d 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 @@ -7,7 +7,7 @@ @ cdecl -ret64 _atoi64(str) ucrtbase._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) ucrtbase._atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) ucrtbase._atol_l @ cdecl _atoldbl(ptr str) ucrtbase._atoldbl @ stub _atoldbl_l @ cdecl -ret64 _atoll_l(str ptr) ucrtbase._atoll_l diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 11d2351bd37..150f235ed25 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -699,7 +699,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl _beep(long long) MSVCRT__beep diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 7c4e5475ae4..d151480fb5b 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1047,7 +1047,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl _beep(long long) MSVCRT__beep diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 9e3deb25793..5b136003d41 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1037,7 +1037,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl -ret64 _atoll_l(str ptr) MSVCRT__atoll_l diff --git a/dlls/msvcr120_app/msvcr120_app.spec b/dlls/msvcr120_app/msvcr120_app.spec index 6a6da4bf22b..c60160dd15f 100644 --- a/dlls/msvcr120_app/msvcr120_app.spec +++ b/dlls/msvcr120_app/msvcr120_app.spec @@ -1008,7 +1008,7 @@ @ cdecl -ret64 _atoi64(str) msvcr120._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) msvcr120._atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) msvcr120._atol_l @ cdecl _atoldbl(ptr str) msvcr120._atoldbl @ stub _atoldbl_l @ cdecl -ret64 _atoll_l(str ptr) msvcr120._atoll_l diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 0913fc99af3..4c7177ce78c 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -363,7 +363,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl _beep(long long) MSVCRT__beep diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 828786426a0..da9e0aec3ee 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -347,7 +347,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl _beep(long long) MSVCRT__beep diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 15d9ffc91c8..5fe99770b14 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -334,7 +334,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 # stub -ret64 _atoi64_l(str ptr) @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -# stub _atol_l(str ptr) +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl # stub _atoldbl_l(ptr str ptr) @ cdecl _beep(long long) MSVCRT__beep diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index d70f235bc62..50c146f4ea0 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -1068,6 +1068,23 @@ int CDECL MSVCRT_atoi(const char *str) } #endif +/****************************************************************** + * _atol_l (MSVCRT.@) + */ +MSVCRT_long CDECL MSVCRT__atol_l(const char *str, MSVCRT__locale_t locale) +{ + __int64 ret = MSVCRT_strtoi64_l(str, NULL, 10, locale); + + if(ret > LONG_MAX) { + ret = LONG_MAX; + *MSVCRT__errno() = MSVCRT_ERANGE; + } else if(ret < LONG_MIN) { + ret = LONG_MIN; + *MSVCRT__errno() = MSVCRT_ERANGE; + } + return ret; +} + #if _MSVCR_VER>=120 /****************************************************************** diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec index ff33d86a502..63d040fe6fb 100644 --- a/dlls/ucrtbase/ucrtbase.spec +++ b/dlls/ucrtbase/ucrtbase.spec @@ -198,7 +198,7 @@ @ cdecl -ret64 _atoi64(str) ntdll._atoi64 @ stub _atoi64_l @ cdecl _atoi_l(str ptr) MSVCRT__atoi_l -@ stub _atol_l +@ cdecl _atol_l(str ptr) MSVCRT__atol_l @ cdecl _atoldbl(ptr str) MSVCRT__atoldbl @ stub _atoldbl_l @ cdecl -ret64 _atoll_l(str ptr) MSVCRT__atoll_l