mirror of
https://github.com/reactos/reactos.git
synced 2025-05-31 23:18:39 +00:00
- Add NULL checks to _atoi64, _wtol, and _wtoi64.
- Since atoi, atol, and _wtoi should check for NULL (_tcstol doesn't) but should not check for overflow (_tcstol does), make them call _ttoi64 instead of _tcstol. svn path=/trunk/; revision=35078
This commit is contained in:
parent
ec62b2846e
commit
4129e7e645
5 changed files with 11 additions and 2 deletions
|
@ -8,5 +8,5 @@
|
|||
int
|
||||
_ttoi(const _TCHAR *str)
|
||||
{
|
||||
return (int)_tcstol(str, 0, 10);
|
||||
return (int)_ttoi64(str);
|
||||
}
|
||||
|
|
|
@ -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 == '-')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -20,6 +20,9 @@ _wtoi64 (const wchar_t *nptr)
|
|||
__int64 value;
|
||||
int sign;
|
||||
|
||||
if (nptr == NULL)
|
||||
return 0;
|
||||
|
||||
while (iswctype((int)*nptr, _SPACE))
|
||||
++nptr;
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue