Ticket #414: wcscasecmpOSX-2.patch

File wcscasecmpOSX-2.patch, 646 bytes (added by Andrew, 14 years ago)
  • posix.h

     
    9696
    9797#if OS_MACOSX
    9898# define EMULATE_WCSDUP 1
     99
     100#include <wctype.h>
     101#include <wchar.h>
     102
     103inline int wcscasecmp (const wchar_t* s1, const wchar_t* s2) {
     104  wint_t a1, a2;
     105
     106  if (s1 == s2)
     107    return 0;
     108
     109  do
     110  {
     111    a1 = towlower(*s1++);
     112    a2 = towlower(*s2++);
     113    if (a1 == L'\0')
     114      break;
     115  }
     116  while (a1 == a2);
     117
     118  return a1 - a2;
     119}
    99120#else
    100121# define EMULATE_WCSDUP 0
    101122#endif
     
    153174#endif  // HAVE_C99_MATH
    154175
    155176#endif  // #ifndef INCLUDED_POSIX
     177