# Fix OS X build error

Fixes #414 (wcscasecmp does not exist on OS X), based on patch from
wacko

This was SVN commit r7217.
This commit is contained in:
Ykkrosh 2009-12-03 22:55:33 +00:00
parent 9709e80936
commit 72ce122146
2 changed files with 26 additions and 0 deletions

View file

@ -101,3 +101,24 @@ wchar_t* wcsdup(const wchar_t* str)
return dst;
}
#endif
#if EMULATE_WCSCASECMP
int wcscasecmp (const wchar_t* s1, const wchar_t* s2)
{
wint_t a1, a2;
if (s1 == s2)
return 0;
do
{
a1 = towlower(*s1++);
a2 = towlower(*s2++);
if (a1 == L'\0')
break;
}
while (a1 == a2);
return a1 - a2;
}
#endif

View file

@ -96,14 +96,19 @@ need only be renamed (e.g. _open, _stat).
#if OS_MACOSX
# define EMULATE_WCSDUP 1
# define EMULATE_WCSCASECMP 1
#else
# define EMULATE_WCSDUP 0
# define EMULATE_WCSCASECMP 0
#endif
#if EMULATE_WCSDUP
extern wchar_t* wcsdup(const wchar_t* str);
#endif
#if EMULATE_WCSCASECMP
extern int wcscasecmp(const wchar_t* s1, const wchar_t* s2);
#endif
// rint*, fminf, fpclassify (too few/diverse to make separate HAVE_ for each)
#if HAVE_C99 || ICC_VERSION || GCC_VERSION