From: Kurt Zeilenga Date: Sun, 23 Jan 2000 23:33:01 +0000 (+0000) Subject: Make ldap_utf8_bytes() act like strlen() not sizeof() X-Git-Tag: UCDATA_2_4~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ed9969b1c4b99d7b742c6d88101bd95f72f205e4;p=openldap Make ldap_utf8_bytes() act like strlen() not sizeof() --- diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h index bbfff50d4f..5b799d324c 100644 --- a/include/ldap_pvt.h +++ b/include/ldap_pvt.h @@ -147,8 +147,7 @@ LIBLDAP_F (int) ldap_pvt_tls_start LDAP_P(( Sockbuf *sb, void *ctx_arg )); * UTF-8 (in utf-8.c) */ -/* returns the number of bytes in the UTF-8 string - (counting the NULL) */ +/* returns the number of bytes in the UTF-8 string */ LIBLDAP_F (ber_len_t) ldap_utf8_bytes( const char * ); /* returns the number of UTF-8 characters in the string */ LIBLDAP_F (ber_len_t) ldap_utf8_chars( const char * ); diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 5628eea1e7..0373d32260 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -133,7 +133,7 @@ static void openldap_ldap_init_w_conf( *start++ = '\0'; - /* we must have some non-whitespace to skip */ + /* we must have some whitespace to skip */ while(isspace((unsigned char)*start)) start++; opt = start; diff --git a/libraries/libldap/utf-8.c b/libraries/libldap/utf-8.c index 2c0cf19082..8538b7304a 100644 --- a/libraries/libldap/utf-8.c +++ b/libraries/libldap/utf-8.c @@ -39,16 +39,14 @@ /* * return the number of bytes required to hold the - * NULL-terminated UTF-8 string INCLUDING the + * NULL-terminated UTF-8 string NOT INCLUDING the * termination. */ ber_len_t ldap_utf8_bytes( const char * p ) { - ber_len_t bytes = 0; + ber_len_t bytes; - if( p == NULL ) return bytes; - - while( p[bytes++] ) { + for( bytes=0; p[bytes]; bytes++ ) { /* EMPTY */ ; }