Piotr Caban : msvcrt: Added _wtol_l implementation.
Alexandre Julliard
julliard at winehq.org
Wed Mar 27 15:40:06 CDT 2013
Module: wine
Branch: master
Commit: 06c677384402d30c2868feca59d0708bdcf635cc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=06c677384402d30c2868feca59d0708bdcf635cc
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Mar 27 16:11:32 2013 +0100
msvcrt: Added _wtol_l implementation.
---
dlls/msvcrt/msvcrt.h | 1 +
dlls/msvcrt/msvcrt.spec | 4 ++--
dlls/msvcrt/wcs.c | 25 +++++++++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 07e2984..69ad7a7 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -42,6 +42,7 @@
#include "winbase.h"
#define MSVCRT_LONG_MAX 0x7fffffffL
+#define MSVCRT_LONG_MIN (-MSVCRT_LONG_MAX-1)
#define MSVCRT_ULONG_MAX 0xffffffffUL
#define MSVCRT_I64_MAX (((__int64)0x7fffffff << 32) | 0xffffffff)
#define MSVCRT_I64_MIN (-MSVCRT_I64_MAX-1)
diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec
index ef5823c..36e1510 100644
--- a/dlls/msvcrt/msvcrt.spec
+++ b/dlls/msvcrt/msvcrt.spec
@@ -1226,8 +1226,8 @@
@ cdecl -ret64 _wtoi64(wstr) ntdll._wtoi64
# stub -ret64 _wtoi64_l(wstr ptr)
@ cdecl _wtoi_l(wstr ptr) MSVCRT__wtoi_l
-@ cdecl _wtol(wstr) ntdll._wtol
-# stub _wtol_l(wstr ptr)
+@ cdecl _wtol(wstr) MSVCRT__wtol
+@ cdecl _wtol_l(wstr ptr) MSVCRT__wtol_l
@ cdecl _wunlink(wstr) MSVCRT__wunlink
@ cdecl _wutime(wstr ptr)
@ cdecl _wutime32(wstr ptr)
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index e00cb83..b0a52d7 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -1472,6 +1472,31 @@ int __cdecl MSVCRT__wtoi(const MSVCRT_wchar_t *str)
}
/*********************************************************************
+ * _wtol_l (MSVCRT.@)
+ */
+MSVCRT_long __cdecl MSVCRT__wtol_l(const MSVCRT_wchar_t *str, MSVCRT__locale_t locale)
+{
+ __int64 ret = MSVCRT__wcstoi64_l(str, NULL, 10, locale);
+
+ if(ret > MSVCRT_LONG_MAX) {
+ ret = MSVCRT_LONG_MAX;
+ *MSVCRT__errno() = MSVCRT_ERANGE;
+ } else if(ret < MSVCRT_LONG_MIN) {
+ ret = MSVCRT_LONG_MIN;
+ *MSVCRT__errno() = MSVCRT_ERANGE;
+ }
+ return ret;
+}
+
+/*********************************************************************
+ * _wtol (MSVCRT.@)
+ */
+MSVCRT_long __cdecl MSVCRT__wtol(const MSVCRT_wchar_t *str)
+{
+ return MSVCRT__wtol_l(str, NULL);
+}
+
+/*********************************************************************
* _wcstoui64_l (MSVCRT.@)
*
* FIXME: locale parameter is ignored
More information about the wine-cvs
mailing list