]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/utf-8-conv.c
Remove extrananous space in DN (in comment)
[openldap] / libraries / libldap / utf-8-conv.c
index 29809deca6c70ce83585882c62433d687ef6b115..d764bbad38ba7826034f31e2f5d4e7ff59945ec9 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -129,8 +129,12 @@ ldap_x_utf8s_to_wcs ( wchar_t *wcstr, const char *utf8str, size_t count )
        wchar_t ch;
 
 
-       /* If input ptr is NULL, treat it as empty string. */
-       if (utf8str == NULL) utf8str = "";
+       /* If input ptr is NULL or empty... */
+       if (utf8str == NULL || !*utf8str) {
+               if ( wcstr )
+                       *wcstr = 0;
+               return 0;
+       }
 
        /* Examine next UTF-8 character.  If output buffer is NULL, ignore count */
        while ( *utf8str && (wcstr==NULL || wclen<count) ) {