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

Go to the source code of this file.

Functions

int __cdecl _wcscoll_l (const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo)
 
int __cdecl wcscoll (const wchar_t *_string1, const wchar_t *_string2)
 

Function Documentation

◆ _wcscoll_l()

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

Definition at line 39 of file wcscoll.cpp.

44{
45 int ret;
46 _LocaleUpdate _loc_update(plocinfo);
47
48 /* validation section */
49 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR);
50 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR);
51
52 if ( _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE] == nullptr )
53 return (wcscmp(_string1, _string2));
54
55 if ( 0 == (ret = __acrt_CompareStringW(
56 _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE],
58 _string1,
59 -1,
60 _string2,
61 -1)) )
62 {
63 errno = EINVAL;
64 return _NLSCMPERROR;
65 }
66
67 return (ret - 2);
68
69}
#define EINVAL
Definition: acclib.h:90
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 _VALIDATE_RETURN(expr, errorcode, retexpr)
#define LC_COLLATE
Definition: locale.h:18
_locale_t plocinfo
Definition: ismbbyte.cpp:75
#define errno
Definition: errno.h:18
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define _NLSCMPERROR
Definition: string.h:19
int ret
#define SORT_STRINGSORT
Definition: winnls.h:185

Referenced by wcscoll().

◆ wcscoll()

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

Definition at line 71 of file wcscoll.cpp.

75{
76 if (!__acrt_locale_changed())
77 {
78 /* validation section */
79 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR);
80 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR);
81
82 return (wcscmp(_string1, _string2));
83 }
84 else
85 {
86 return _wcscoll_l(_string1, _string2, nullptr);
87 }
88}
int __cdecl _wcscoll_l(const wchar_t *_string1, const wchar_t *_string2, _locale_t plocinfo)
Definition: wcscoll.cpp:39