win32, stdlib: use _strtoi64() and _strtoui64() when available SDL-1.2
authorOzkan Sezer <sezeroz@gmail.com>
Sat, 24 Mar 2018 23:04:03 +0300
branchSDL-1.2
changeset 11975addd798b16a0
parent 11974 b8aca1c1ad6e
child 11976 42535a774733
win32, stdlib: use _strtoi64() and _strtoui64() when available
configure.in
include/SDL_config.h.in
include/SDL_config_win32.h
include/SDL_stdinc.h
src/stdlib/SDL_string.c
     1.1 --- a/configure.in	Sat Mar 24 22:54:16 2018 +0300
     1.2 +++ b/configure.in	Sat Mar 24 23:04:03 2018 +0300
     1.3 @@ -2123,6 +2123,16 @@
     1.4         ])
     1.5      fi
     1.6  
     1.7 +    save_CFLAGS="$CFLAGS"
     1.8 +    CFLAGS="$save_CFLAGS -Werror-implicit-function-declaration"
     1.9 +    AC_TRY_LINK([#include <stdlib.h>],
    1.10 +                [return (int) _strtoi64 (NULL,NULL,0);],
    1.11 +                AC_DEFINE(HAVE__STRTOI64))
    1.12 +    AC_TRY_LINK([#include <stdlib.h>],
    1.13 +                [return (int) _strtoui64(NULL,NULL,0);],
    1.14 +                AC_DEFINE(HAVE__STRTOUI64))
    1.15 +    CFLAGS="$save_CFLAGS"
    1.16 +
    1.17      dnl See if the user wants to redirect standard output to files
    1.18      AC_ARG_ENABLE(stdio-redirect,
    1.19  AC_HELP_STRING([--enable-stdio-redirect], [Redirect STDIO to files on Win32 [[default=yes]]]),
     2.1 --- a/include/SDL_config.h.in	Sat Mar 24 22:54:16 2018 +0300
     2.2 +++ b/include/SDL_config.h.in	Sat Mar 24 23:04:03 2018 +0300
     2.3 @@ -117,6 +117,8 @@
     2.4  #undef HAVE__UI64TOA
     2.5  #undef HAVE_STRTOLL
     2.6  #undef HAVE_STRTOULL
     2.7 +#undef HAVE__STRTOI64
     2.8 +#undef HAVE__STRTOUI64
     2.9  #undef HAVE_STRTOD
    2.10  #undef HAVE_ATOI
    2.11  #undef HAVE_ATOF
     3.1 --- a/include/SDL_config_win32.h	Sat Mar 24 22:54:16 2018 +0300
     3.2 +++ b/include/SDL_config_win32.h	Sat Mar 24 23:04:03 2018 +0300
     3.3 @@ -114,6 +114,10 @@
     3.4  #define HAVE_STRTOLL 1
     3.5  #define HAVE_STRTOULL 1
     3.6  #endif
     3.7 +#if defined(__WATCOMC__) || (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(_WIN64)
     3.8 +#define HAVE__STRTOI64 1
     3.9 +#define HAVE__STRTOUI64 1
    3.10 +#endif
    3.11  #define HAVE_STRTOD 1
    3.12  #define HAVE_ATOI 1
    3.13  #define HAVE_ATOF 1
     4.1 --- a/include/SDL_stdinc.h	Sat Mar 24 22:54:16 2018 +0300
     4.2 +++ b/include/SDL_stdinc.h	Sat Mar 24 23:04:03 2018 +0300
     4.3 @@ -505,13 +505,17 @@
     4.4  extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
     4.5  #endif
     4.6  
     4.7 -#ifdef HAVE_STRTOLL
     4.8 +#ifdef HAVE__STRTOI64
     4.9 +#define SDL_strtoll    _strtoi64
    4.10 +#elif defined(HAVE_STRTOLL)
    4.11  #define SDL_strtoll     strtoll
    4.12  #else
    4.13  extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
    4.14  #endif
    4.15  
    4.16 -#ifdef HAVE_STRTOULL
    4.17 +#ifdef HAVE__STRTOUI64
    4.18 +#define SDL_strtoull    _strtoui64
    4.19 +#elif defined(HAVE_STRTOULL)
    4.20  #define SDL_strtoull     strtoull
    4.21  #else
    4.22  extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
    4.23 @@ -549,18 +553,18 @@
    4.24  extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
    4.25  #endif
    4.26  
    4.27 -#ifdef HAVE_STRCASECMP
    4.28 +#if defined(HAVE__STRICMP)
    4.29 +#define SDL_strcasecmp  _stricmp
    4.30 +#elif defined(HAVE_STRCASECMP)
    4.31  #define SDL_strcasecmp  strcasecmp
    4.32 -#elif defined(HAVE__STRICMP)
    4.33 -#define SDL_strcasecmp  _stricmp
    4.34  #else
    4.35  extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
    4.36  #endif
    4.37  
    4.38 -#ifdef HAVE_STRNCASECMP
    4.39 +#if defined(HAVE__STRNICMP)
    4.40 +#define SDL_strncasecmp _strnicmp
    4.41 +#elif defined(HAVE_STRNCASECMP)
    4.42  #define SDL_strncasecmp strncasecmp
    4.43 -#elif defined(HAVE__STRNICMP)
    4.44 -#define SDL_strncasecmp _strnicmp
    4.45  #else
    4.46  extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
    4.47  #endif
     5.1 --- a/src/stdlib/SDL_string.c	Sat Mar 24 22:54:16 2018 +0300
     5.2 +++ b/src/stdlib/SDL_string.c	Sat Mar 24 23:04:03 2018 +0300
     5.3 @@ -603,7 +603,7 @@
     5.4  }
     5.5  #endif
     5.6  
     5.7 -#ifndef HAVE_STRTOLL
     5.8 +#if !defined(HAVE_STRTOLL) && !defined(HAVE__STRTOI64)
     5.9  Sint64 SDL_strtoll(const char *string, char **endp, int base)
    5.10  {
    5.11      size_t len;
    5.12 @@ -625,7 +625,7 @@
    5.13  }
    5.14  #endif
    5.15  
    5.16 -#ifndef HAVE_STRTOULL
    5.17 +#if !defined(HAVE_STRTOULL) && !defined(HAVE__STRTOUI64)
    5.18  Uint64 SDL_strtoull(const char *string, char **endp, int base)
    5.19  {
    5.20      size_t len;