ReactOS 0.4.16-dev-329-g9223134
mbsicoll.c File Reference
#include <mbstring.h>
#include <mbctype.h>
#include <ctype.h>
Include dependency graph for mbsicoll.c:

Go to the source code of this file.

Functions

int colldif (unsigned short c1, unsigned short c2)
 
int _mbsicoll (const unsigned char *str1, const unsigned char *str2)
 

Function Documentation

◆ _mbsicoll()

int _mbsicoll ( const unsigned char str1,
const unsigned char str2 
)

Definition at line 18 of file mbsicoll.c.

19{
20 unsigned char *s1 = (unsigned char *)str1;
21 unsigned char *s2 = (unsigned char *)str2;
22
23 unsigned short *short_s1, *short_s2;
24
25 int l1, l2;
26
27 while ( *s1 != 0 ) {
28
29 if (*s1 == 0)
30 break;
31
32 l1 = _ismbblead(*s1);
33 l2 = _ismbblead(*s2);
34 if ( !l1 && !l2 ) {
35
36 if (toupper(*s1) != toupper(*s2))
37 return colldif(*s1, *s2);
38 else {
39 s1 += 1;
40 s2 += 1;
41 }
42 }
43 else if ( l1 && l2 ){
44 short_s1 = (unsigned short *)s1;
45 short_s2 = (unsigned short *)s2;
46 if ( _mbctoupper(*short_s1) != _mbctoupper(*short_s2 ))
47 return colldif(*short_s1, *short_s2);
48 else {
49 s1 += 2;
50 s2 += 2;
51
52 }
53 }
54 else
55 return colldif(*s1, *s2);
56 } ;
57 return 0;
58}
int toupper(int c)
Definition: utclib.c:881
_Check_return_ _CRTIMP unsigned int __cdecl _mbctoupper(_In_ unsigned int _Ch)
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

◆ 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 _mbsicoll(), _mbsnbcoll(), and _mbsncoll().