mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-26 09:39:45 -05:00
Using UTF8normcmp() from lunicode, removing our own UTF8casecmp()
This commit is contained in:
parent
7a3c92f2a7
commit
ac95c255a8
1 changed files with 3 additions and 55 deletions
|
|
@ -496,60 +496,6 @@ booleanMatch(
|
|||
}
|
||||
|
||||
#if UTF8MATCH
|
||||
static int
|
||||
UTF8casecmp(
|
||||
struct berval *right,
|
||||
struct berval *left )
|
||||
{
|
||||
ber_len_t r, l;
|
||||
int rlen, llen;
|
||||
ldap_unicode_t ru, lu;
|
||||
ldap_unicode_t ruu, luu;
|
||||
|
||||
for( r=0, l=0;
|
||||
r < right->bv_len && l < left->bv_len;
|
||||
r+=rlen, l+=llen )
|
||||
{
|
||||
/*
|
||||
* XXYYZ: we convert to ucs4 even though -llunicode
|
||||
* expects ucs2 in an unsigned long
|
||||
*/
|
||||
ru = ldap_utf8_to_ucs4( &right->bv_val[r] );
|
||||
if( ru == LDAP_UCS4_INVALID ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
lu = ldap_utf8_to_ucs4( &left->bv_val[l] );
|
||||
if( lu == LDAP_UCS4_INVALID ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
ruu = uctoupper( ru );
|
||||
luu = uctoupper( lu );
|
||||
|
||||
if( ruu > luu ) {
|
||||
return 1;
|
||||
} else if( luu > ruu ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rlen = LDAP_UTF8_CHARLEN( &right->bv_val[r] );
|
||||
llen = LDAP_UTF8_CHARLEN( &left->bv_val[l] );
|
||||
}
|
||||
|
||||
if( r < right->bv_len ) {
|
||||
/* less left */
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( l < left->bv_len ) {
|
||||
/* less right */
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* case insensitive UTF8 strncmp with offset for second string */
|
||||
static int
|
||||
UTF8oncasecmp(
|
||||
|
|
@ -1664,7 +1610,9 @@ caseIgnoreMatch(
|
|||
void *assertedValue )
|
||||
{
|
||||
#if UTF8MATCH
|
||||
*matchp = UTF8casecmp( value, (struct berval *) assertedValue );
|
||||
*matchp = UTF8normcmp( value->bv_val,
|
||||
((struct berval *) assertedValue)->bv_val,
|
||||
UTF8_CASEFOLD );
|
||||
#else
|
||||
int match = value->bv_len - ((struct berval *) assertedValue)->bv_len;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue