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

Go to the source code of this file.

Functions

int __cdecl _strnicoll_l (const char *_string1, const char *_string2, size_t count, _locale_t plocinfo)
 
int __cdecl _strnicoll (const char *_string1, const char *_string2, size_t count)
 

Function Documentation

◆ _strnicoll()

int __cdecl _strnicoll ( const char _string1,
const char _string2,
size_t  count 
)

Definition at line 79 of file strnicol.cpp.

84{
85 if (!__acrt_locale_changed())
86 {
87 return _strnicmp(_string1, _string2, count);
88 }
89 else
90 {
91 return _strnicoll_l(_string1, _string2, count, nullptr);
92 }
93}
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
GLuint GLuint GLsizei count
Definition: gl.h:1545
int __cdecl _strnicoll_l(const char *_string1, const char *_string2, size_t count, _locale_t plocinfo)
Definition: strnicol.cpp:41

◆ _strnicoll_l()

int __cdecl _strnicoll_l ( const char _string1,
const char _string2,
size_t  count,
_locale_t  plocinfo 
)

Definition at line 41 of file strnicol.cpp.

47{
48 int ret;
49 _LocaleUpdate _loc_update(plocinfo);
50
51 if (!count)
52 return 0;
53
54 /* validation section */
55 _VALIDATE_RETURN(_string1 != nullptr, EINVAL, _NLSCMPERROR);
56 _VALIDATE_RETURN(_string2 != nullptr, EINVAL, _NLSCMPERROR);
58
59 if ( _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE] == nullptr )
60 return _strnicmp_l(_string1, _string2, count, _loc_update.GetLocaleT());
61
62 if ( 0 == (ret = __acrt_CompareStringA(
63 _loc_update.GetLocaleT(),
64 _loc_update.GetLocaleT()->locinfo->locale_name[LC_COLLATE],
66 _string1,
67 (int)count,
68 _string2,
69 (int)count,
70 _loc_update.GetLocaleT()->locinfo->lc_collate_cp)) )
71 {
72 errno = EINVAL;
73 return _NLSCMPERROR;
74 }
75
76 return (ret - 2);
77}
#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)
_Check_return_ _CRTIMP int __cdecl _strnicmp_l(_In_reads_or_z_(maxcount) const char *str1, _In_reads_or_z_(maxcount) const char *str2, _In_ size_t maxcount, _In_opt_ _locale_t locale)
Definition: stubs.c:550
#define LC_COLLATE
Definition: locale.h:18
#define INT_MAX
Definition: intsafe.h:150
_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 _strnicoll().