From: Stig Venaas Date: Sun, 22 Jul 2001 00:31:04 +0000 (+0000) Subject: We shouldn't need UTF8oncasecmp() and UTF8casechr() anymore, removing X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1216 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d326f96c32f8ac0a19af78cc5b4dcb0cc4e93368;p=openldap We shouldn't need UTF8oncasecmp() and UTF8casechr() anymore, removing them. --- diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 4c742291f9..308d46fb6e 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -500,97 +500,6 @@ booleanMatch( return LDAP_SUCCESS; } -/* case insensitive UTF8 strncmp with offset for second string */ -static int -UTF8oncasecmp( - struct berval *right, - struct berval *left, - ber_len_t len, - ber_len_t offset ) -{ - ber_len_t r, l; - ber_len_t rlen, llen; - ber_len_t rslen, lslen; - ldap_unicode_t ru, lu; - ldap_unicode_t ruu, luu; - - rslen = len < right->bv_len ? len : right->bv_len; - lslen = len + offset < left->bv_len ? len : left->bv_len; - - for( r = 0, l = offset; - r < rslen && l < lslen; - r+=rlen, l+=llen ) - { - /* - * XXYYZ: we convert to ucs4 even though -llunicode - * expects ucs2 in an unsigned long - */ - ru = ldap_x_utf8_to_ucs4( &right->bv_val[r] ); - if( ru == LDAP_UCS4_INVALID ) { - return 1; - } - - lu = ldap_x_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 < rslen ) { - /* less left */ - return -1; - } - - if( l < lslen ) { - /* less right */ - return 1; - } - - return 0; -} - -static char *UTF8casechr( const char *str, const char *c ) -{ - char *p, *lower, *upper; - ldap_ucs4_t tch, ch = ldap_x_utf8_to_ucs4(c); - - tch = uctolower ( ch ); - for( p = (char *) str; *p != '\0'; LDAP_UTF8_INCR(p) ) { - if( ldap_x_utf8_to_ucs4( p ) == tch ) { - break; - } - } - lower = *p != '\0' ? p : NULL; - - tch = uctoupper ( ch ); - for( p = (char *) str; *p != '\0'; LDAP_UTF8_INCR(p) ) { - if( ldap_x_utf8_to_ucs4( p ) == tch ) { - break; - } - } - upper = *p != '\0' ? p : NULL; - - if( lower && upper ) { - return lower < upper ? lower : upper; - } else if ( lower ) { - return lower; - } else { - return upper; - } -} - static int UTF8StringValidate( Syntax *syntax,