diff --git a/reactos/lib/sdk/crt/string/atoi.c b/reactos/lib/sdk/crt/string/atoi.c index 74f3175565e..2fc1364dc83 100644 --- a/reactos/lib/sdk/crt/string/atoi.c +++ b/reactos/lib/sdk/crt/string/atoi.c @@ -8,5 +8,5 @@ int _ttoi(const _TCHAR *str) { - return (int)_tcstol(str, 0, 10); + return (int)_ttoi64(str); } diff --git a/reactos/lib/sdk/crt/string/atoi64.c b/reactos/lib/sdk/crt/string/atoi64.c index d97d359ee6f..c820dbaba42 100644 --- a/reactos/lib/sdk/crt/string/atoi64.c +++ b/reactos/lib/sdk/crt/string/atoi64.c @@ -20,6 +20,9 @@ _atoi64(const char *nptr) __int64 acc = 0; int neg = 0; + if (nptr == NULL) + return 0; + while(isspace((int)*s)) s++; if (*s == '-') diff --git a/reactos/lib/sdk/crt/string/atol.c b/reactos/lib/sdk/crt/string/atol.c index cc3fe76cd0e..9aa3af57d87 100644 --- a/reactos/lib/sdk/crt/string/atol.c +++ b/reactos/lib/sdk/crt/string/atol.c @@ -8,7 +8,7 @@ long _ttol(const _TCHAR *str) { - return _tcstol(str, 0, 10); + return (long)_ttoi64(str); } int _atoldbl(long double *value, const char *str) diff --git a/reactos/lib/sdk/crt/string/wtoi64.c b/reactos/lib/sdk/crt/string/wtoi64.c index 6e0f9dbdd64..b729f493a56 100644 --- a/reactos/lib/sdk/crt/string/wtoi64.c +++ b/reactos/lib/sdk/crt/string/wtoi64.c @@ -20,6 +20,9 @@ _wtoi64 (const wchar_t *nptr) __int64 value; int sign; + if (nptr == NULL) + return 0; + while (iswctype((int)*nptr, _SPACE)) ++nptr; diff --git a/reactos/lib/sdk/crt/string/wtol.c b/reactos/lib/sdk/crt/string/wtol.c index 9944956384b..a57015e9f7b 100644 --- a/reactos/lib/sdk/crt/string/wtol.c +++ b/reactos/lib/sdk/crt/string/wtol.c @@ -13,6 +13,9 @@ _wtol(const wchar_t *str) unsigned long RunningTotal = 0; char bMinus = 0; + if (str == NULL) + return 0; + while (iswctype(*str, _SPACE) ) { str++; } /* while */