mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-03 07:29:37 +01:00
stdlib: Corrected implementation of SDL_wcsncmp.
It was a copy/paste of SDL_strcmp, apparently, not SDL_strncmp, so it ignored the maxlen parameter. Thanks to Jack Powell for pointing this out!
This commit is contained in:
parent
c7eb557d89
commit
e410b34f92
@ -516,13 +516,18 @@ SDL_wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen)
|
|||||||
#if defined(HAVE_WCSNCMP)
|
#if defined(HAVE_WCSNCMP)
|
||||||
return wcsncmp(str1, str2, maxlen);
|
return wcsncmp(str1, str2, maxlen);
|
||||||
#else
|
#else
|
||||||
while (*str1 && *str2) {
|
while (*str1 && *str2 && maxlen) {
|
||||||
if (*str1 != *str2)
|
if (*str1 != *str2)
|
||||||
break;
|
break;
|
||||||
++str1;
|
++str1;
|
||||||
++str2;
|
++str2;
|
||||||
|
--maxlen;
|
||||||
}
|
}
|
||||||
return (int)(*str1 - *str2);
|
if (!maxlen) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return (int) (*str1 - *str2);
|
||||||
|
|
||||||
#endif /* HAVE_WCSNCMP */
|
#endif /* HAVE_WCSNCMP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user