| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #include <corecrt_internal.h>
|
| #include <ctype.h>
|
| #include <locale.h>
|
| #include <string.h>
|
|
|
| #pragma warning(disable:__WARNING_POTENTIAL_BUFFER_OVERFLOW_NULLTERMINATED)
|
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| extern "C" int __cdecl _wcsicoll_l (
|
| const wchar_t *_string1,
|
| const wchar_t *_string2,
|
| _locale_t plocinfo
|
| )
|
| {
|
| int ret;
|
| _LocaleUpdate _loc_update(plocinfo);
|
|
|
|
|
| _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR );
|
| _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR );
|
|
|
| if ( _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE] == nullptr )
|
| {
|
| return __ascii_wcsicmp(_string1, _string2);
|
| }
|
|
|
| if ( 0 == (ret = __acrt_CompareStringW(
|
| _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE],
|
| SORT_STRINGSORT | NORM_IGNORECASE,
|
| _string1,
|
| -1,
|
| _string2,
|
| -1)) )
|
| {
|
| errno = EINVAL;
|
| return _NLSCMPERROR;
|
| }
|
|
|
| return (ret - 2);
|
| }
|
|
|
| extern "C" int __cdecl _wcsicoll (
|
| const wchar_t *_string1,
|
| const wchar_t *_string2
|
| )
|
| {
|
| if (!__acrt_locale_changed())
|
| {
|
|
|
| _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR );
|
| _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR );
|
|
|
| return __ascii_wcsicmp(_string1, _string2);
|
| }
|
| else
|
| {
|
| return _wcsicoll_l(_string1, _string2, nullptr);
|
| }
|
|
|
| }
|
|
|