[ros-diffs] [jmorlan] 35078: - 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.

jmorlan at svn.reactos.org jmorlan at svn.reactos.org
Sun Aug 3 20:35:55 CEST 2008


Author: jmorlan
Date: Sun Aug  3 13:35:54 2008
New Revision: 35078

URL: http://svn.reactos.org/svn/reactos?rev=35078&view=rev
Log:
- 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.

Modified:
    trunk/reactos/lib/sdk/crt/string/atoi.c
    trunk/reactos/lib/sdk/crt/string/atoi64.c
    trunk/reactos/lib/sdk/crt/string/atol.c
    trunk/reactos/lib/sdk/crt/string/wtoi64.c
    trunk/reactos/lib/sdk/crt/string/wtol.c

Modified: trunk/reactos/lib/sdk/crt/string/atoi.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/atoi.c?rev=35078&r1=35077&r2=35078&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/atoi.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/atoi.c [iso-8859-1] Sun Aug  3 13:35:54 2008
@@ -8,5 +8,5 @@
 int
 _ttoi(const _TCHAR *str)
 {
-  return (int)_tcstol(str, 0, 10);
+  return (int)_ttoi64(str);
 }

Modified: trunk/reactos/lib/sdk/crt/string/atoi64.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/atoi64.c?rev=35078&r1=35077&r2=35078&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/atoi64.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/atoi64.c [iso-8859-1] Sun Aug  3 13:35:54 2008
@@ -20,6 +20,9 @@
   __int64 acc = 0;
   int neg = 0;
 
+  if (nptr == NULL)
+    return 0;
+
   while(isspace((int)*s))
     s++;
   if (*s == '-')

Modified: trunk/reactos/lib/sdk/crt/string/atol.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/atol.c?rev=35078&r1=35077&r2=35078&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/atol.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/atol.c [iso-8859-1] Sun Aug  3 13:35:54 2008
@@ -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)

Modified: trunk/reactos/lib/sdk/crt/string/wtoi64.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wtoi64.c?rev=35078&r1=35077&r2=35078&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/wtoi64.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/wtoi64.c [iso-8859-1] Sun Aug  3 13:35:54 2008
@@ -19,6 +19,9 @@
    int c;
    __int64 value;
    int sign;
+
+   if (nptr == NULL)
+       return 0;
 
    while (iswctype((int)*nptr, _SPACE))
         ++nptr;

Modified: trunk/reactos/lib/sdk/crt/string/wtol.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/string/wtol.c?rev=35078&r1=35077&r2=35078&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/string/wtol.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/string/wtol.c [iso-8859-1] Sun Aug  3 13:35:54 2008
@@ -12,6 +12,9 @@
 {
     unsigned long RunningTotal = 0;
     char bMinus = 0;
+
+    if (str == NULL)
+        return 0;
 
     while (iswctype(*str, _SPACE) ) {
         str++;



More information about the Ros-diffs mailing list