- Cleanup the /lib directory, by putting more 3rd-party libs in /3rdparty, and by...
[reactos.git] / reactos / lib / sdk / crt / stdlib / strtoul.c
similarity index 89%
rename from reactos/lib/string/strtoul.c
rename to reactos/lib/sdk/crt/stdlib/strtoul.c
index 3ff15e6..2e530f5 100644 (file)
@@ -1,5 +1,5 @@
-#include <string.h>
-#include <limits.h>
+/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#include <precomp.h>
 #include <ctype.h>
 
 /*
@@ -64,10 +64,11 @@ strtoul(const char *nptr, char **endptr, int base)
   if (any < 0)
   {
     acc = ULONG_MAX;
+    __set_errno(ERANGE);
   }
   else if (neg)
     acc = -acc;
   if (endptr != 0)
-    *endptr = any ? (char *)((size_t)(s - 1)) : (char *)((size_t)nptr);
+    *endptr = any ? (char *)s - 1 : (char *)nptr;
   return acc;
 }