ReactOS 0.4.16-dev-927-g467dec4
stricoll.cpp File Reference
#include <corecrt_internal.h>
#include <ctype.h>
#include <locale.h>
#include <string.h>
Include dependency graph for stricoll.cpp:

Go to the source code of this file.

Functions

int __cdecl _stricoll_l (const char *_string1, const char *_string2, _locale_t plocinfo)
 
int __cdecl _stricoll (const char *_string1, const char *_string2)
 

Function Documentation

◆ _stricoll()

int __cdecl _stricoll ( const char _string1,
const char _string2 
)

Definition at line 72 of file stricoll.cpp.

76{
77 if (!__acrt_locale_changed())
78 {
79 return _stricmp(_string1, _string2);
80 }
81 else
82 {
83 return _stricoll_l(_string1, _string2, nullptr);
84 }
85
86}
#define _stricmp
Definition: cat.c:22
int __cdecl _stricoll_l(const char *_string1, const char *_string2, _locale_t plocinfo)
Definition: stricoll.cpp:37

◆ _stricoll_l()

int __cdecl _stricoll_l ( const char _string1,
const char _string2,
_locale_t  plocinfo 
)

Definition at line 37 of file stricoll.cpp.

42{
43 int ret;
44 _LocaleUpdate _loc_update(plocinfo);
45
46 /* validation section */
47 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR);
48 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR);
49
50 if ( _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE] == nullptr )
51 {
52 return _stricmp(_string1, _string2);
53 }
54
55 if ( 0 == (ret = __acrt_CompareStringA(_loc_update.GetLocaleT(),
56 _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE],
58 _string1,
59 -1,
60 _string2,
61 -1,
62 _loc_update.GetLocaleT()->locinfo->lc_collate_cp)) )
63 {
64 errno = EINVAL;
65 return _NLSCMPERROR;
66 }
67
68 return (ret - 2);
69
70}
#define EINVAL
Definition: acclib.h:90
int __cdecl __acrt_CompareStringA(_In_opt_ _locale_t _Plocinfo, _In_ LPCWSTR _LocaleName, _In_ DWORD _DwCmpFlags, _In_CRT_NLS_string_(_CchCount1) PCCH _LpString1, _In_ int _CchCount1, _In_CRT_NLS_string_(_CchCount2) PCCH _LpString2, _In_ int _CchCount2, _In_ int _CodePage)
#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
#define _NLSCMPERROR
Definition: string.h:19
int ret
#define NORM_IGNORECASE
Definition: winnls.h:178
#define SORT_STRINGSORT
Definition: winnls.h:185

Referenced by _stricoll().