ReactOS 0.4.16-dev-300-g2aadf2e
mbsncoll.c File Reference
#include <mbstring.h>
Include dependency graph for mbsncoll.c:

Go to the source code of this file.

Functions

int colldif (unsigned short c1, unsigned short c2)
 
int _mbsncoll (const unsigned char *str1, const unsigned char *str2, size_t n)
 
int _mbsnbcoll (const unsigned char *str1, const unsigned char *str2, size_t n)
 

Function Documentation

◆ _mbsnbcoll()

int _mbsnbcoll ( const unsigned char str1,
const unsigned char str2,
size_t  n 
)

Definition at line 70 of file mbsncoll.c.

71{
72 unsigned char *s1 = (unsigned char *)str1;
73 unsigned char *s2 = (unsigned char *)str2;
74
75 unsigned short *short_s1, *short_s2;
76
77 int l1, l2;
78
79 if (n == 0)
80 return 0;
81 do {
82
83 if (*s1 == 0)
84 break;
85
86 l1 = _ismbblead(*s1);
87 l2 = _ismbblead(*s2);
88 if ( !l1 && !l2 ) {
89
90 if (*s1 != *s2)
91 return colldif(*s1, *s2);
92 else {
93 s1 += 1;
94 s2 += 1;
95 n--;
96 }
97 }
98 else if ( l1 && l2 ){
99 short_s1 = (unsigned short *)s1;
100 short_s2 = (unsigned short *)s2;
101 if ( *short_s1 != *short_s2 )
102 return colldif(*short_s1, *short_s2);
103 else {
104 s1 += 2;
105 s2 += 2;
106 n-=2;
107
108 }
109 }
110 else
111 return colldif(*s1, *s2);
112 } while (n > 0);
113 return 0;
114}
GLdouble n
Definition: glext.h:7729
int colldif(unsigned short c1, unsigned short c2)
Definition: mbsncoll.c:13
struct S1 s1
struct S2 s2
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20

◆ _mbsncoll()

int _mbsncoll ( const unsigned char str1,
const unsigned char str2,
size_t  n 
)

Definition at line 21 of file mbsncoll.c.

22{
23 unsigned char *s1 = (unsigned char *)str1;
24 unsigned char *s2 = (unsigned char *)str2;
25
26 unsigned short *short_s1, *short_s2;
27
28 int l1, l2;
29
30 if (n == 0)
31 return 0;
32 do {
33
34 if (*s1 == 0)
35 break;
36
37 l1 = _ismbblead(*s1);
38 l2 = _ismbblead(*s2);
39 if ( !l1 && !l2 ) {
40
41 if (*s1 != *s2)
42 return colldif(*s1, *s2);
43 else {
44 s1 += 1;
45 s2 += 1;
46 n--;
47 }
48 }
49 else if ( l1 && l2 ){
50 short_s1 = (unsigned short *)s1;
51 short_s2 = (unsigned short *)s2;
52 if ( *short_s1 != *short_s2 )
53 return colldif(*short_s1, *short_s2);
54 else {
55 s1 += 2;
56 s2 += 2;
57 n--;
58
59 }
60 }
61 else
62 return colldif(*s1, *s2);
63 } while (n > 0);
64 return 0;
65}

◆ colldif()

int colldif ( unsigned short  c1,
unsigned short  c2 
)

Definition at line 13 of file mbsncoll.c.

14{
15 return c1 - c2;
16}

Referenced by _mbscoll(), _mbsicoll(), _mbsnbcoll(), and _mbsncoll().