From f65cee77a8dac4499002737c01a940d79bfbe386 Mon Sep 17 00:00:00 2001 From: hniksic Date: Wed, 6 Jul 2005 16:25:26 -0700 Subject: [PATCH] [svn] Use strtoll on Windows if available (as with DMC). --- src/ChangeLog | 4 ++++ src/mswindows.c | 15 +-------------- src/mswindows.h | 12 ++++++++---- windows/config-compiler.h | 5 +++++ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ab03397b..075f055b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2005-07-06 Hrvoje Niksic + + * mswindows.h: Use strtoll where available. + 2005-07-06 Hrvoje Niksic * sysdep.h: Add a full declaration of fnmatch.h. diff --git a/src/mswindows.c b/src/mswindows.c index 4c77ab1c..17d14a73 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -72,7 +72,7 @@ xsleep (double seconds) #endif /* not HAVE_USLEEP */ } -#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER < 1300) +#if !defined(HAVE_STRTOLL) && !defined(HAVE__STRTOI64) static inline int char_value (char c, int base) @@ -180,20 +180,7 @@ str_to_int64 (const char *nptr, char **endptr, int base) *endptr = (char *) nptr; return result; } - -#else /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */ - -__int64 -str_to_int64 (const char *nptr, char **endptr, int base) -{ -#ifdef _MSC_VER - return _strtoi64 (nptr, endptr, base); -#else - return strtoll (nptr, endptr, base); #endif -} - -#endif /* !defined(__BORLANDC__) && (!defined(_MSC_VER) || _MSC_VER >= 1300) */ void windows_main (int *argc, char **argv, char **exec_name) diff --git a/src/mswindows.h b/src/mswindows.h index 948d9839..612dd949 100644 --- a/src/mswindows.h +++ b/src/mswindows.h @@ -84,11 +84,15 @@ typedef __int64 wgint; #define WGINT_MAX LL (9223372036854775807) /* str_to_wgint is a function with the semantics of strtol, but which - works on wgint. Since wgint is unconditionally 64-bit on Windows, - we #define it to str_to_int64, which either calls _strtoi64 or - implements the conversion manually. */ -#define str_to_wgint str_to_int64 + works on wgint. */ +#if defined HAVE_STRTOLL +# define str_to_wgint strtoll +#elif defined HAVE__STRTOI64 +# define str_to_wgint _strtoi64 +#else __int64 str_to_int64 (const char *, char **, int); +# define str_to_wgint str_to_int64 +#endif /* Windows has no symlink, therefore no lstat. Without symlinks lstat is equivalent to stat anyway. */ diff --git a/windows/config-compiler.h b/windows/config-compiler.h index 5ce1c9b8..08bfa499 100644 --- a/windows/config-compiler.h +++ b/windows/config-compiler.h @@ -95,6 +95,10 @@ so, delete this exception statement from your version. */ #define struct_fstat struct _stati64 #define isatty _isatty + +#if _MSC_VER >= 1300 +# define HAVE__STRTOI64 +#endif /* ------------------ */ /* Borland C section. */ @@ -126,6 +130,7 @@ so, delete this exception statement from your version. */ #define HAVE__BOOL 1 #undef SIZEOF_LONG_LONG #define SIZEOF_LONG_LONG 8 +#define HAVE_STRTOLL #else # error Your compiler is not supported. -- 2.39.2