ReactOS 0.4.16-dev-959-g2ec3a19
wcsicoll.cpp File Reference
#include <corecrt_internal.h>
#include <ctype.h>
#include <locale.h>
#include <string.h>
Include dependency graph for wcsicoll.cpp:

Go to the source code of this file.

Functions

int __cdecl _wcsicoll_l (const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo)
 
int __cdecl _wcsicoll (const wchar_t *_string1, const wchar_t *_string2)
 

Function Documentation

◆ _wcsicoll()

int __cdecl _wcsicoll ( const wchar_t _string1,
const wchar_t _string2 
)

Definition at line 75 of file wcsicoll.cpp.

79{
80 if (!__acrt_locale_changed())
81 {
82 /* validation section */
83 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR );
84 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR );
85
86 return __ascii_wcsicmp(_string1, _string2);
87 }
88 else
89 {
90 return _wcsicoll_l(_string1, _string2, nullptr);
91 }
92
93}
#define EINVAL
Definition: acclib.h:90
_Check_return_ int __cdecl __ascii_wcsicmp(_In_z_ const wchar_t *lhs, _In_z_ const wchar_t *rhs)
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
#define _NLSCMPERROR
Definition: string.h:19
int __cdecl _wcsicoll_l(const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo)
Definition: wcsicoll.cpp:42

◆ _wcsicoll_l()

int __cdecl _wcsicoll_l ( const wchar_t _string1,
const wchar_t _string2,
_locale_t  plocinfo 
)

Definition at line 42 of file wcsicoll.cpp.

47{
48 int ret;
49 _LocaleUpdate _loc_update(plocinfo);
50
51 /* validation section */
52 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR );
53 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR );
54
55 if ( _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE] == nullptr )
56 {
57 return __ascii_wcsicmp(_string1, _string2);
58 }
59
60 if ( 0 == (ret = __acrt_CompareStringW(
61 _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE],
63 _string1,
64 -1,
65 _string2,
66 -1)) )
67 {
68 errno = EINVAL;
69 return _NLSCMPERROR;
70 }
71
72 return (ret - 2);
73}
int __cdecl __acrt_CompareStringW(_In_ LPCWSTR _LocaleName, _In_ DWORD _DwCmpFlags, _In_CRT_NLS_string_(_CchCount1) PCWCH _LpString1, _In_ int _CchCount1, _In_CRT_NLS_string_(_CchCount2) PCWCH _LpString2, _In_ int _CchCount2)
#define LC_COLLATE
Definition: locale.h:18
_locale_t plocinfo
Definition: ismbbyte.cpp:75
#define errno
Definition: errno.h:18
int ret
#define NORM_IGNORECASE
Definition: winnls.h:178
#define SORT_STRINGSORT
Definition: winnls.h:185

Referenced by _wcsicoll().