Util/WStringAPI: non-Windows implementation of _wcs*cmp()

This commit is contained in:
Max Kellermann 2018-09-06 19:49:45 +02:00
parent c2e2e5543e
commit 2d6f9f9a9c

View File

@ -149,13 +149,15 @@ StringIsEqual(const wchar_t *a, const wchar_t *b, size_t length) noexcept
return wcsncmp(a, b, length) == 0; return wcsncmp(a, b, length) == 0;
} }
#ifdef _WIN32
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static inline bool static inline bool
StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b) noexcept StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b) noexcept
{ {
#ifdef _WIN32
return _wcsicmp(a, b) == 0; return _wcsicmp(a, b) == 0;
#else
return wcscasecmp(a, b) == 0;
#endif
} }
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
@ -163,10 +165,12 @@ static inline bool
StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b, StringIsEqualIgnoreCase(const wchar_t *a, const wchar_t *b,
size_t size) noexcept size_t size) noexcept
{ {
#ifdef _WIN32
return _wcsnicmp(a, b, size) == 0; return _wcsnicmp(a, b, size) == 0;
} #else
return wcsncasecmp(a, b, size) == 0;
#endif #endif
}
gcc_pure gcc_nonnull_all gcc_pure gcc_nonnull_all
static inline int static inline int