ReactOS  0.4.14-dev-358-gbef841c
mbsnicmp.c
Go to the documentation of this file.
1 #include <mbstring.h>
2 
3 
4 size_t _mbclen2(const unsigned int s);
5 unsigned int _mbbtoupper(unsigned int c);
6 
7 
8 /*
9  * @implemented
10  */
11 int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
12 {
13  if (n == 0)
14  return 0;
15  do {
16  if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
17  return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
18  s1 += _mbclen2(*s1);
19  s2 += _mbclen2(*s2);
20 
21  if (*s1 == 0)
22  break;
23  if (!_ismbblead(*s1))
24  n--;
25  } while (n > 0);
26  return 0;
27 }
28 
29 /*
30  * @implemented
31  */
32 int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
33 {
34  if (n == 0)
35  return 0;
36  do {
37  if (_mbbtoupper(*s1) != _mbbtoupper(*s2))
38  return _mbbtoupper(*(unsigned const char *)s1) - _mbbtoupper(*(unsigned const char *)s2);
39  s1 += _mbclen2(*s1);
40  s2 += _mbclen2(*s2);
41 
42  if (*s1 == 0)
43  break;
44  n--;
45  } while (n > 0);
46  return 0;
47 }
struct S2 s2
GLdouble n
Definition: glext.h:7729
unsigned int _mbbtoupper(unsigned int c)
Definition: mbsupr.c:15
int _mbsnicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
Definition: mbsnicmp.c:11
struct S1 s1
const GLubyte * c
Definition: glext.h:8905
GLdouble s
Definition: gl.h:2039
size_t _mbclen2(const unsigned int s)
Definition: mbclen.c:23
int _mbsnbicmp(const unsigned char *s1, const unsigned char *s2, size_t n)
Definition: mbsnicmp.c:32
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20