vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / wchar / wcscasecmp.c
blob4ba8d0ed3e61250336c5c903e6ae15bf66f221d9
1 /*
2 ** Copyright 2011, Oliver Tappe, zooey@hirschkaefer.de. All rights reserved.
3 ** Distributed under the terms of the Haiku License.
4 */
6 #include <wctype.h>
8 #include <wchar_private.h>
11 int
12 __wcscasecmp(const wchar_t* wcs1, const wchar_t* wcs2)
14 int cmp;
16 for (;;) {
17 cmp = towlower(*wcs1) - towlower(*wcs2++);
18 /* note: won't overflow, since our wchar_t is guaranteed to never
19 have the highest bit set */
21 if (cmp != 0 || *wcs1++ == L'\0')
22 break;
25 return cmp;
29 B_DEFINE_WEAK_ALIAS(__wcscasecmp, wcscasecmp);