Evas encoding: Improved evas_common_encoding_utf8_get_len to be more consistent with...
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 8 Feb 2011 13:22:10 +0000 (13:22 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 8 Feb 2011 13:22:10 +0000 (13:22 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@56806 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/engines/common/evas_encoding.c

index 2d2a842..96a2690 100644 (file)
@@ -236,14 +236,11 @@ EAPI int
 evas_common_encoding_utf8_get_len(const char *buf)
 {
    /* returns the number of utf8 characters (not bytes) in the string */
-   int index = 0, len = 0;
+   int i = 0, len = 0;
+
+   while (evas_common_encoding_utf8_get_next(buf, &i))
+        len++;
 
-   while (buf[index])
-     {
-       if ((buf[index] & 0xc0) != 0x80)
-         len++;
-       index++;
-     }
    return len;
 }