Added SDL_wcscmp()

This commit is contained in:
Sam Lantinga 2017-08-13 20:37:49 -07:00
parent f315ab8ebc
commit bb037eaa61
9 changed files with 31 additions and 3 deletions

View file

@ -626,3 +626,4 @@
#define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL
#define SDL_utf8strlen SDL_utf8strlen_REAL
#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL
#define SDL_wcscmp SDL_wcscmp_REAL

View file

@ -658,3 +658,4 @@ SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),)
SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return)
SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return)

View file

@ -461,6 +461,22 @@ SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t max
#endif /* HAVE_WCSLCAT */
}
int
SDL_wcscmp(const wchar_t *str1, const wchar_t *str2)
{
#if defined(HAVE_WCSCMP)
return wcscmp(str1, str2);
#else
while (*str1 && *str2) {
if (*str1 != *str2)
break;
++str1;
++str2;
}
return (int)(*str1 - *str2);
#endif /* HAVE_WCSCMP */
}
size_t
SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen)
{
@ -925,7 +941,7 @@ SDL_strcmp(const char *str1, const char *str2)
++str1;
++str2;
}
return (int) ((unsigned char) *str1 - (unsigned char) *str2);
return (int)((unsigned char) *str1 - (unsigned char) *str2);
#endif /* HAVE_STRCMP */
}