mirror of https://github.com/encounter/SDL.git
Added SDL_wcscasecmp() and SDL_wcsncasecmp()
This commit is contained in:
parent
e4b7d9a221
commit
46a844786b
|
@ -17072,7 +17072,7 @@ fi
|
||||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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 poll _Exit
|
for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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 poll _Exit
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
|
|
@ -346,7 +346,7 @@ if test x$enable_libc = xyes; then
|
||||||
AC_DEFINE(HAVE_MPROTECT, 1, [ ])
|
AC_DEFINE(HAVE_MPROTECT, 1, [ ])
|
||||||
]),
|
]),
|
||||||
)
|
)
|
||||||
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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 poll _Exit)
|
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcslcpy wcslcat wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr strtok_r 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 poll _Exit)
|
||||||
|
|
||||||
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
||||||
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
|
AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
|
||||||
|
|
|
@ -103,6 +103,10 @@
|
||||||
#undef HAVE_WCSSTR
|
#undef HAVE_WCSSTR
|
||||||
#undef HAVE_WCSCMP
|
#undef HAVE_WCSCMP
|
||||||
#undef HAVE_WCSNCMP
|
#undef HAVE_WCSNCMP
|
||||||
|
#undef HAVE_WCSCASECMP
|
||||||
|
#undef HAVE__WCSICMP
|
||||||
|
#undef HAVE_WCSNCASECMP
|
||||||
|
#undef HAVE__WCSNICMP
|
||||||
#undef HAVE_STRLEN
|
#undef HAVE_STRLEN
|
||||||
#undef HAVE_STRLCPY
|
#undef HAVE_STRLCPY
|
||||||
#undef HAVE_STRLCAT
|
#undef HAVE_STRLCAT
|
||||||
|
|
|
@ -134,6 +134,8 @@ typedef unsigned int uintptr_t;
|
||||||
#define HAVE_STRNCMP 1
|
#define HAVE_STRNCMP 1
|
||||||
#define HAVE__STRICMP 1
|
#define HAVE__STRICMP 1
|
||||||
#define HAVE__STRNICMP 1
|
#define HAVE__STRNICMP 1
|
||||||
|
#define HAVE__WCSICMP 1
|
||||||
|
#define HAVE__WCSNICMP 1
|
||||||
#define HAVE_ACOS 1
|
#define HAVE_ACOS 1
|
||||||
#define HAVE_ACOSF 1
|
#define HAVE_ACOSF 1
|
||||||
#define HAVE_ASIN 1
|
#define HAVE_ASIN 1
|
||||||
|
|
|
@ -469,6 +469,8 @@ extern DECLSPEC wchar_t *SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar
|
||||||
|
|
||||||
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2);
|
||||||
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
extern DECLSPEC int SDLCALL SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
|
||||||
|
extern DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t len);
|
||||||
|
|
||||||
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str);
|
||||||
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen);
|
||||||
|
|
|
@ -786,3 +786,5 @@
|
||||||
#define SDL_GameControllerSetSensorEnabled SDL_GameControllerSetSensorEnabled_REAL
|
#define SDL_GameControllerSetSensorEnabled SDL_GameControllerSetSensorEnabled_REAL
|
||||||
#define SDL_GameControllerIsSensorEnabled SDL_GameControllerIsSensorEnabled_REAL
|
#define SDL_GameControllerIsSensorEnabled SDL_GameControllerIsSensorEnabled_REAL
|
||||||
#define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_REAL
|
#define SDL_GameControllerGetSensorData SDL_GameControllerGetSensorData_REAL
|
||||||
|
#define SDL_wcscasecmp SDL_wcscasecmp_REAL
|
||||||
|
#define SDL_wcsncasecmp SDL_wcsncasecmp_REAL
|
||||||
|
|
|
@ -847,3 +847,5 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerHasSensor,(SDL_GameController *a, SDL
|
||||||
SDL_DYNAPI_PROC(int,SDL_GameControllerSetSensorEnabled,(SDL_GameController *a, SDL_SensorType b, SDL_bool c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GameControllerSetSensorEnabled,(SDL_GameController *a, SDL_SensorType b, SDL_bool c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerIsSensorEnabled,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_GameControllerIsSensorEnabled,(SDL_GameController *a, SDL_SensorType b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorData,(SDL_GameController *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_GameControllerGetSensorData,(SDL_GameController *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return)
|
||||||
|
SDL_DYNAPI_PROC(int,SDL_wcscasecmp,(const wchar_t *a, const wchar_t *b),(a,b),return)
|
||||||
|
SDL_DYNAPI_PROC(int,SDL_wcsncasecmp,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
|
||||||
|
|
|
@ -531,6 +531,85 @@ SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
|
||||||
#endif /* HAVE_WCSNCMP */
|
#endif /* HAVE_WCSNCMP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_WCSCASECMP)
|
||||||
|
return wcscasecmp(str1, str2);
|
||||||
|
#elif defined(HAVE__WCSICMP)
|
||||||
|
return _wcsicmp(str1, str2);
|
||||||
|
#else
|
||||||
|
wchar_t a = 0;
|
||||||
|
wchar_t b = 0;
|
||||||
|
while (*str1 && *str2) {
|
||||||
|
/* FIXME: This doesn't actually support wide characters */
|
||||||
|
if (*str1 >= 0x80 || *str2 >= 0x80) {
|
||||||
|
a = *str1;
|
||||||
|
b = *str2;
|
||||||
|
} else {
|
||||||
|
a = SDL_toupper((unsigned char) *str1);
|
||||||
|
b = SDL_toupper((unsigned char) *str2);
|
||||||
|
}
|
||||||
|
if (a != b)
|
||||||
|
break;
|
||||||
|
++str1;
|
||||||
|
++str2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: This doesn't actually support wide characters */
|
||||||
|
if (*str1 >= 0x80 || *str2 >= 0x80) {
|
||||||
|
a = *str1;
|
||||||
|
b = *str2;
|
||||||
|
} else {
|
||||||
|
a = SDL_toupper((unsigned char) *str1);
|
||||||
|
b = SDL_toupper((unsigned char) *str2);
|
||||||
|
}
|
||||||
|
return (int) ((unsigned int) a - (unsigned int) b);
|
||||||
|
#endif /* HAVE__WCSICMP */
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_WCSNCASECMP)
|
||||||
|
return wcsncasecmp(str1, str2, maxlen);
|
||||||
|
#elif defined(HAVE__WCSNICMP)
|
||||||
|
return _wcsnicmp(str1, str2, maxlen);
|
||||||
|
#else
|
||||||
|
wchar_t a = 0;
|
||||||
|
wchar_t b = 0;
|
||||||
|
while (*str1 && *str2 && maxlen) {
|
||||||
|
/* FIXME: This doesn't actually support wide characters */
|
||||||
|
if (*str1 >= 0x80 || *str2 >= 0x80) {
|
||||||
|
a = *str1;
|
||||||
|
b = *str2;
|
||||||
|
} else {
|
||||||
|
a = SDL_toupper((unsigned char) *str1);
|
||||||
|
b = SDL_toupper((unsigned char) *str2);
|
||||||
|
}
|
||||||
|
if (a != b)
|
||||||
|
break;
|
||||||
|
++str1;
|
||||||
|
++str2;
|
||||||
|
--maxlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxlen == 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
/* FIXME: This doesn't actually support wide characters */
|
||||||
|
if (*str1 >= 0x80 || *str2 >= 0x80) {
|
||||||
|
a = *str1;
|
||||||
|
b = *str2;
|
||||||
|
} else {
|
||||||
|
a = SDL_toupper((unsigned char) *str1);
|
||||||
|
b = SDL_toupper((unsigned char) *str2);
|
||||||
|
}
|
||||||
|
return (int) ((unsigned int) a - (unsigned int) b);
|
||||||
|
}
|
||||||
|
#endif /* HAVE__WCSNICMP */
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
|
SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue