Added SDL_wcscmp()
authorSam Lantinga <slouken@libsdl.org>
Sun, 13 Aug 2017 20:37:49 -0700
changeset 112659152aa462a82
parent 11264 d631b3dac8be
child 11266 dbed7609745d
Added SDL_wcscmp()
CMakeLists.txt
configure
configure.in
include/SDL_config.h.cmake
include/SDL_config.h.in
include/SDL_stdinc.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/stdlib/SDL_string.c
     1.1 --- a/CMakeLists.txt	Sun Aug 13 20:13:11 2017 -0700
     1.2 +++ b/CMakeLists.txt	Sun Aug 13 20:37:49 2017 -0700
     1.3 @@ -623,6 +623,7 @@
     1.4      set(HAVE_SIGNAL_H 1)
     1.5      foreach(_FN
     1.6              malloc calloc realloc free qsort abs memset memcpy memmove memcmp
     1.7 +            wcslen wcslcpy wcslcat wcscmp
     1.8              strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
     1.9              _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
    1.10              _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
     2.1 --- a/configure	Sun Aug 13 20:13:11 2017 -0700
     2.2 +++ b/configure	Sun Aug 13 20:37:49 2017 -0700
     2.3 @@ -16631,7 +16631,7 @@
     2.4  rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
     2.5  fi
     2.6  
     2.7 -    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval
     2.8 +    for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcscmp strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval
     2.9  do :
    2.10    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    2.11  ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
     3.1 --- a/configure.in	Sun Aug 13 20:13:11 2017 -0700
     3.2 +++ b/configure.in	Sun Aug 13 20:37:49 2017 -0700
     3.3 @@ -268,7 +268,7 @@
     3.4          AC_DEFINE(HAVE_MPROTECT, 1, [ ])
     3.5          ]),
     3.6      )
     3.7 -    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval)
     3.8 +    AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcscmp strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval)
     3.9  
    3.10      AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
    3.11      AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf)
     4.1 --- a/include/SDL_config.h.cmake	Sun Aug 13 20:13:11 2017 -0700
     4.2 +++ b/include/SDL_config.h.cmake	Sun Aug 13 20:37:49 2017 -0700
     4.3 @@ -106,6 +106,10 @@
     4.4  #cmakedefine HAVE_MEMCPY 1
     4.5  #cmakedefine HAVE_MEMMOVE 1
     4.6  #cmakedefine HAVE_MEMCMP 1
     4.7 +#cmakedefine HAVE_WCSLEN 1
     4.8 +#cmakedefine HAVE_WCSLCPY 1
     4.9 +#cmakedefine HAVE_WCSLCAT 1
    4.10 +#cmakedefine HAVE_WCSCMP 1
    4.11  #cmakedefine HAVE_STRLEN 1
    4.12  #cmakedefine HAVE_STRLCPY 1
    4.13  #cmakedefine HAVE_STRLCAT 1
     5.1 --- a/include/SDL_config.h.in	Sun Aug 13 20:13:11 2017 -0700
     5.2 +++ b/include/SDL_config.h.in	Sun Aug 13 20:37:49 2017 -0700
     5.3 @@ -106,6 +106,10 @@
     5.4  #undef HAVE_MEMCPY
     5.5  #undef HAVE_MEMMOVE
     5.6  #undef HAVE_MEMCMP
     5.7 +#undef HAVE_WCSLEN
     5.8 +#undef HAVE_WCSLCPY
     5.9 +#undef HAVE_WCSLCAT
    5.10 +#undef HAVE_WCSCMP
    5.11  #undef HAVE_STRLEN
    5.12  #undef HAVE_STRLCPY
    5.13  #undef HAVE_STRLCAT
     6.1 --- a/include/SDL_stdinc.h	Sun Aug 13 20:13:11 2017 -0700
     6.2 +++ b/include/SDL_stdinc.h	Sun Aug 13 20:37:49 2017 -0700
     6.3 @@ -404,6 +404,7 @@
     6.4  extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr);
     6.5  extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
     6.6  extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen);
     6.7 +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
     6.8  
     6.9  extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
    6.10  extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
     7.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Sun Aug 13 20:13:11 2017 -0700
     7.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Sun Aug 13 20:37:49 2017 -0700
     7.3 @@ -626,3 +626,4 @@
     7.4  #define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL
     7.5  #define SDL_utf8strlen SDL_utf8strlen_REAL
     7.6  #define SDL_LoadFile_RW SDL_LoadFile_RW_REAL
     7.7 +#define SDL_wcscmp SDL_wcscmp_REAL
     8.1 --- a/src/dynapi/SDL_dynapi_procs.h	Sun Aug 13 20:13:11 2017 -0700
     8.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Sun Aug 13 20:37:49 2017 -0700
     8.3 @@ -658,3 +658,4 @@
     8.4  SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return)
     8.5  SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return)
     8.6  SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
     8.7 +SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
     9.1 --- a/src/stdlib/SDL_string.c	Sun Aug 13 20:13:11 2017 -0700
     9.2 +++ b/src/stdlib/SDL_string.c	Sun Aug 13 20:37:49 2017 -0700
     9.3 @@ -461,6 +461,22 @@
     9.4  #endif /* HAVE_WCSLCAT */
     9.5  }
     9.6  
     9.7 +int
     9.8 +SDL_wcscmp(const wchar_t *str1, const wchar_t *str2)
     9.9 +{
    9.10 +#if defined(HAVE_WCSCMP)
    9.11 +    return wcscmp(str1, str2);
    9.12 +#else
    9.13 +    while (*str1 && *str2) {
    9.14 +        if (*str1 != *str2)
    9.15 +            break;
    9.16 +        ++str1;
    9.17 +        ++str2;
    9.18 +    }
    9.19 +    return (int)(*str1 - *str2);
    9.20 +#endif /* HAVE_WCSCMP */
    9.21 +}
    9.22 +
    9.23  size_t
    9.24  SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
    9.25  {
    9.26 @@ -925,7 +941,7 @@
    9.27          ++str1;
    9.28          ++str2;
    9.29      }
    9.30 -    return (int) ((unsigned char) *str1 - (unsigned char) *str2);
    9.31 +    return (int)((unsigned char) *str1 - (unsigned char) *str2);
    9.32  #endif /* HAVE_STRCMP */
    9.33  }
    9.34