extern "C" int __cdecl _wcscoll_l ( const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo ) { int ret; _LocaleUpdate _loc_update(plocinfo); /* validation section */ _VALIDATE_RETURN(_string1 != NULL, EINVAL, _NLSCMPERROR); _VALIDATE_RETURN(_string2 != NULL, EINVAL, _NLSCMPERROR); if ( _loc_update.GetLocaleT()->locinfo->lc_handle[LC_COLLATE] == _CLOCALEHANDLE ) return (wcscmp(_string1, _string2)); if ( 0 == (ret = __crtCompareStringW( _loc_update.GetLocaleT(), _loc_update.GetLocaleT()->locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT, _string1, -1, _string2, -1, _loc_update.GetLocaleT()->locinfo->lc_collate_cp)) ) { errno = EINVAL; return _NLSCMPERROR; } return (ret - 2); }
_CRTIMP2_PURE int __CLRCALL_PURE_OR_CDECL _Wcscoll ( const wchar_t *_string1, const wchar_t *_end1, const wchar_t *_string2, const wchar_t *_end2, const _Collvec *ploc ) { int n1 = (int)(_end1 - _string1); int n2 = (int)(_end2 - _string2); int ret=0; //const wchar_t *locale_name; LCID _Locale; if (ploc == 0) { //locale_name = ___lc_locale_name_func()[LC_COLLATE]; _Locale = ___lc_handle_func()[LC_COLLATE]; } else { //locale_name = ploc->_LocaleName; _Locale = ploc->_Hand; } if (/*locale_name == NULL*/_Locale==0) { int ans; ans = _Wmemcmp(_string1, _string2, n1 < n2 ? n1 : n2); ret=(ans != 0 || n1 == n2 ? ans : n1 < n2 ? -1 : +1); } else { if (0 == (ret = __crtCompareStringW(_Locale, SORT_STRINGSORT, _string1, n1, _string2, n2))) { errno = EINVAL; ret=_NLSCMPERROR; } else { ret-=2; } } return ret; }
int __cdecl _Wcscoll ( const wchar_t *_string1, const wchar_t *_end1, const wchar_t *_string2, const wchar_t *_end2, const _Collvec *ploc ) { size_t n1 = _end1 - _string1; size_t n2 = _end2 - _string2; int ret; LCID handle; #ifdef _MT int local_lock_flag; _lock_locale( local_lock_flag ) #endif if (ploc == 0) handle = __lc_handle[LC_COLLATE]; else handle = ploc->_Hand; if (handle == _CLOCALEHANDLE) { int ans; _unlock_locale( local_lock_flag ) ans = _Wmemcmp(_string1, _string2, n1 < n2 ? n1 : n2); return ans != 0 || n1 == n2 ? ans : n1 < n2 ? -1 : +1; } if (0 == (ret = __crtCompareStringW(handle, 0, _string1, n1, _string2, n2, __lc_collate_cp))) { _unlock_locale( local_lock_flag ) errno = EINVAL; return _NLSCMPERROR; } _unlock_locale( local_lock_flag ) return (ret - 2); }
_MRTIMP2_NCEEPURE int __CLRCALL_PURE_OR_CDECL _Wcscoll ( const wchar_t *_string1, const wchar_t *_end1, const wchar_t *_string2, const wchar_t *_end2, const _Collvec *ploc ) { int n1 = (int)(_end1 - _string1); int n2 = (int)(_end2 - _string2); int ret=0; LCID handle; if (ploc == 0) handle = ___lc_handle_func()[LC_COLLATE]; else handle = ploc->_Hand; if (handle == _CLOCALEHANDLE) { int ans; ans = _Wmemcmp(_string1, _string2, n1 < n2 ? n1 : n2); ret=(ans != 0 || n1 == n2 ? ans : n1 < n2 ? -1 : +1); } else { if (0 == (ret = __crtCompareStringW(NULL, handle, SORT_STRINGSORT, _string1, n1, _string2, n2, ___lc_collate_cp_func()))) { errno = EINVAL; ret=_NLSCMPERROR; } else { ret-=2; } } return ret; }
extern "C" int __cdecl _wcsicoll_l ( const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo ) { int ret; wchar_t f, l; _LocaleUpdate _loc_update(plocinfo); /* validation section */ _VALIDATE_RETURN(_string1 != NULL, EINVAL, _NLSCMPERROR ); _VALIDATE_RETURN(_string2 != NULL, EINVAL, _NLSCMPERROR ); if ( _loc_update.GetLocaleT()->locinfo->lc_handle[LC_COLLATE] == _CLOCALEHANDLE ) { do { f = __ascii_towlower(*_string1); l = __ascii_towlower(*_string2); _string1++; _string2++; } while ( (f) && (f == l) ); return (int)(f - l); } if ( 0 == (ret = __crtCompareStringW( _loc_update.GetLocaleT(), _loc_update.GetLocaleT()->locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT | NORM_IGNORECASE, _string1, -1, _string2, -1, _loc_update.GetLocaleT()->locinfo->lc_codepage)) ) { errno = EINVAL; return _NLSCMPERROR; } return (ret - 2); }