Piotr Caban : msvcrt: Call MSVCRT_strtoi64_l in strtol implementation.
Alexandre Julliard
julliard at winehq.org
Wed Sep 25 14:18:01 CDT 2013
Module: wine
Branch: master
Commit: c3c44544ff0e2446979117daebddb70124a0afe1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c3c44544ff0e2446979117daebddb70124a0afe1
Author: Piotr Caban <piotr at codeweavers.com>
Date: Wed Sep 25 14:41:40 2013 +0200
msvcrt: Call MSVCRT_strtoi64_l in strtol implementation.
---
dlls/msvcrt/string.c | 52 +++++++++++++++++--------------------------------
1 files changed, 18 insertions(+), 34 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c
index d3bde66..cdce4a2 100644
--- a/dlls/msvcrt/string.c
+++ b/dlls/msvcrt/string.c
@@ -727,40 +727,6 @@ int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str,
}
/******************************************************************
- * strtol (MSVCRT.@)
- */
-MSVCRT_long CDECL MSVCRT_strtol(const char* nptr, char** end, int base)
-{
- /* wrapper to forward libc error code to msvcrt's error codes */
- long ret;
-
- errno = 0;
- ret = strtol(nptr, end, base);
- switch (errno)
- {
- case ERANGE: *MSVCRT__errno() = MSVCRT_ERANGE; break;
- case EINVAL: *MSVCRT__errno() = MSVCRT_EINVAL; break;
- default:
- /* cope with the fact that we may use 64bit long integers on libc
- * while msvcrt always uses 32bit long integers
- */
- if (ret > MSVCRT_LONG_MAX)
- {
- ret = MSVCRT_LONG_MAX;
- *MSVCRT__errno() = MSVCRT_ERANGE;
- }
- else if (ret < -MSVCRT_LONG_MAX - 1)
- {
- ret = -MSVCRT_LONG_MAX - 1;
- *MSVCRT__errno() = MSVCRT_ERANGE;
- }
- break;
- }
-
- return ret;
-}
-
-/******************************************************************
* strtoul (MSVCRT.@)
*/
MSVCRT_ulong CDECL MSVCRT_strtoul(const char* nptr, char** end, int base)
@@ -934,6 +900,24 @@ int __cdecl MSVCRT_atoi(const char *str)
return minus ? -ret : ret;
}
+/******************************************************************
+ * strtol (MSVCRT.@)
+ */
+MSVCRT_long CDECL MSVCRT_strtol(const char* nptr, char** end, int base)
+{
+ __int64 ret = MSVCRT_strtoi64_l(nptr, end, base, NULL);
+
+ 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;
+}
+
/*********************************************************************
* _strtoui64_l (MSVCRT.@)
*
More information about the wine-cvs
mailing list