mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:02:56 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 deletions
100
lib/sdk/crt/mbstring/mbscoll.c
Normal file
100
lib/sdk/crt/mbstring/mbscoll.c
Normal file
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
* FILE: lib/msvcrt/mbstring/mbscoll.c
|
||||
* PURPOSE:
|
||||
* PROGRAMER: Ariadne
|
||||
* UPDATE HISTORY:
|
||||
* 12/04/99: Created
|
||||
*/
|
||||
|
||||
#include <mbstring.h>
|
||||
|
||||
int colldif(unsigned short c1, unsigned short c2);
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int _mbscoll(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
while ( *s1 != 0 ) {
|
||||
|
||||
if (*s1 == 0)
|
||||
break;
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int _mbsbcoll(const unsigned char *str1, const unsigned char *str2)
|
||||
{
|
||||
unsigned char *s1 = (unsigned char *)str1;
|
||||
unsigned char *s2 = (unsigned char *)str2;
|
||||
|
||||
unsigned short *short_s1, *short_s2;
|
||||
|
||||
int l1, l2;
|
||||
|
||||
|
||||
while ( *s1 != 0 ) {
|
||||
|
||||
|
||||
l1 = _ismbblead(*s1);
|
||||
l2 = _ismbblead(*s2);
|
||||
if ( !l1 && !l2 ) {
|
||||
|
||||
if (*s1 != *s2)
|
||||
return colldif(*s1, *s2);
|
||||
else {
|
||||
s1 += 1;
|
||||
s2 += 1;
|
||||
}
|
||||
}
|
||||
else if ( l1 && l2 ){
|
||||
short_s1 = (unsigned short *)s1;
|
||||
short_s2 = (unsigned short *)s2;
|
||||
if ( *short_s1 != *short_s2 )
|
||||
return colldif(*short_s1, *short_s2);
|
||||
else {
|
||||
s1 += 2;
|
||||
s2 += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
return colldif(*s1, *s2);
|
||||
} ;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue