ReactOS 0.4.16-dev-959-g2ec3a19
mbsncoll.cpp File Reference
#include <corecrt_internal_mbstring.h>
#include <limits.h>
#include <locale.h>
#include <string.h>
Include dependency graph for mbsncoll.cpp:

Go to the source code of this file.

Functions

int __cdecl _mbsncoll_l (const unsigned char *s1, const unsigned char *s2, size_t n, _locale_t plocinfo)
 
 int (__cdecl _mbsncoll)(const unsigned char *s1
 

Variables

const unsigned chars2
 
const unsigned char size_t n
 

Function Documentation

◆ _mbsncoll_l()

int __cdecl _mbsncoll_l ( const unsigned char s1,
const unsigned char s2,
size_t  n,
_locale_t  plocinfo 
)

Definition at line 41 of file mbsncoll.cpp.

47{
48 int ret;
49 size_t bcnt1, bcnt2;
50 _LocaleUpdate _loc_update(plocinfo);
51
52 if (n == 0)
53 return 0;
54
55 /* validation section */
59
60 if (_loc_update.GetLocaleT()->mbcinfo->ismbcodepage == 0)
61 return _strncoll_l((const char *)s1, (const char *)s2, n, plocinfo);
62
63 bcnt1 = _mbsnbcnt_l(s1, n, _loc_update.GetLocaleT());
64 bcnt2 = _mbsnbcnt_l(s2, n, _loc_update.GetLocaleT());
65
66 if ( 0 == (ret = __acrt_CompareStringA(
67 _loc_update.GetLocaleT(),
68 _loc_update.GetLocaleT()->mbcinfo->mblocalename,
70 (const char *)s1,
71 (int)bcnt1,
72 (char *)s2,
73 (int)bcnt2,
74 _loc_update.GetLocaleT()->mbcinfo->mbcodepage )) )
75 {
76 errno = EINVAL;
77 return _NLSCMPERROR;
78 }
79
80 return ret - 2;
81
82}
#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 _strncoll_l(_In_z_ const char *str1, _In_z_ const char *str2, _In_ size_t maxcount, _In_opt_ _locale_t locale)
Definition: stubs.c:536
GLdouble n
Definition: glext.h:7729
_Check_return_ _CRTIMP size_t __cdecl _mbsnbcnt_l(_In_reads_bytes_(_MaxCount) _Pre_z_ const unsigned char *_Str, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale)
#define INT_MAX
Definition: intsafe.h:150
_locale_t plocinfo
Definition: ismbbyte.cpp:75
const unsigned char * s2
Definition: mbsncoll.cpp:86
struct S1 s1
#define errno
Definition: errno.h:18
#define _NLSCMPERROR
Definition: string.h:19
int ret
#define SORT_STRINGSORT
Definition: winnls.h:185

◆ int()

int ( __cdecl  _mbsncoll) const

Variable Documentation

◆ n

Initial value:
{
return _mbsncoll_l(s1, s2, n, nullptr)
int __cdecl _mbsncoll_l(const unsigned char *s1, const unsigned char *s2, size_t n, _locale_t plocinfo)
Definition: mbsncoll.cpp:41

Definition at line 87 of file mbsncoll.cpp.

◆ s2

Definition at line 86 of file mbsncoll.cpp.

Referenced by _mbsncoll_l().