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

Go to the source code of this file.

Functions

int __cdecl _mbsncmp_l (const unsigned char *s1, const unsigned char *s2, size_t n, _locale_t plocinfo)
 
 int (__cdecl _mbsncmp)(const unsigned char *s1
 

Variables

const unsigned chars2
 
const unsigned char size_t n
 

Function Documentation

◆ _mbsncmp_l()

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

Definition at line 45 of file mbsncmp.cpp.

51{
52 unsigned short c1, c2;
53 _LocaleUpdate _loc_update(plocinfo);
54
55 if (n==0)
56 return(0);
57
58 if (_loc_update.GetLocaleT()->mbcinfo->ismbcodepage == 0)
59 return strncmp((const char *)s1, (const char *)s2, n);
60
61 /* validation section */
64
65 while (n--) {
66
67 c1 = *s1++;
68 if ( _ismbblead_l(c1, _loc_update.GetLocaleT()) )
69 c1 = ( (*s1 == '\0') ? 0 : ((c1<<8) | *s1++) );
70
71 c2 = *s2++;
72 if ( _ismbblead_l(c2, _loc_update.GetLocaleT()) )
73 c2 = ( (*s2 == '\0') ? 0 : ((c2<<8) | *s2++) );
74
75 if (c1 != c2)
76 return( (c1 > c2) ? 1 : -1);
77
78 if (c1 == 0)
79 return(0);
80 }
81
82 return(0);
83}
#define EINVAL
Definition: acclib.h:90
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
#define _ismbblead_l(_c, p)
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
GLdouble n
Definition: glext.h:7729
_locale_t plocinfo
Definition: ismbbyte.cpp:75
const unsigned char * s2
Definition: mbsncmp.cpp:87
struct S1 s1
#define _NLSCMPERROR
Definition: string.h:19

◆ int()

int ( __cdecl  _mbsncmp) const

Variable Documentation

◆ n

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

Definition at line 88 of file mbsncmp.cpp.

◆ s2

Definition at line 87 of file mbsncmp.cpp.

Referenced by _mbsncmp_l().