On Mon, Aug 31, 2009 at 12:03:11PM +0200, Alexandre Julliard wrote:
Eric Pouech eric.pouech@orange.fr writes:
@@ -250,3 +250,25 @@ int CDECL __STRINGTOLD( MSVCRT__LDOUBLE *value, char **endptr, const char *str, #endif return 0; }
+/******************************************************************
strtol (MSVCRT.@)
- */
+long int MSVCRT_strtol(const char* nptr, char** end, int base) +{
- /* wrapper to forward libc error code to msvcrt's error codes */
- long ret = strtol(nptr, end, base);
- msvcrt_set_unix_errno();
- return ret;
+}
You can't simply use long here, you need to handle the difference in the size of long between Win32 and Unix.
You also need to an 'errno = 0' before the strtol() call. strtol() will only change errno if there is a numeric overflow.
In the overflow cases the return value will be LONG_MIN or LONG_MAX and errno is set to ERANGE. No other errno values should appear.
I thought that the only 'size' difference is that 64bit windows has a 32bit long ? So values outside 32bits need truncating and ERANGE set ??
David