]> git.sur5r.net Git - openldap/commitdiff
Make ldap_utf8_bytes() act like strlen() not sizeof()
authorKurt Zeilenga <kurt@openldap.org>
Sun, 23 Jan 2000 23:33:01 +0000 (23:33 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 23 Jan 2000 23:33:01 +0000 (23:33 +0000)
include/ldap_pvt.h
libraries/libldap/init.c
libraries/libldap/utf-8.c

index bbfff50d4fa6f7231f69380063aa754db8c9f916..5b799d324c8b3abcfc7e75f84602b97041a33a14 100644 (file)
@@ -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 * );
index 5628eea1e7cb04b24f6331d7b77f139509de8e45..0373d3226039eafe49ed78094472442209bafb0c 100644 (file)
@@ -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;
 
index 2c0cf19082c92cfc2835a1d5b1c3306f9efeabe5..8538b7304a4efbd01377675beedc9e6a0199528b 100644 (file)
 
 /*
  * 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 */ ;
        }