]> mj.ucw.cz Git - libucw.git/commitdiff
UTF-8 strings: Converted to size_t.
authorPavel Charvat <pchar@ucw.cz>
Mon, 2 Jun 2014 17:44:25 +0000 (19:44 +0200)
committerPavel Charvat <pchar@ucw.cz>
Mon, 2 Jun 2014 17:44:25 +0000 (19:44 +0200)
ucw/unicode.c
ucw/unicode.h

index 1dc29e1204a6d2947eb2a24ec36c7cdd128219f2..32b664e83702381b37bfcddf05d995cee720e185 100644 (file)
 #include <ucw/lib.h>
 #include <ucw/unicode.h>
 
-uns
+size_t
 utf8_strlen(const byte *str)
 {
-  uns len = 0;
+  size_t len = 0;
   while (*str)
     {
       UTF8_SKIP(str);
@@ -23,10 +23,10 @@ utf8_strlen(const byte *str)
   return len;
 }
 
-uns
-utf8_strnlen(const byte *str, uns n)
+size_t
+utf8_strnlen(const byte *str, size_t n)
 {
-  uns len = 0;
+  size_t len = 0;
   const byte *end = str + n;
   while (str < end)
     {
index e29bc3662d64b79e5f6552d13e53c258340a0b47..c9d6a0c1cde12477e1e88b0f0601272d179d1122 100644 (file)
@@ -357,11 +357,11 @@ static inline uns unicode_sanitize_char(uns u)
  * Count the number of Unicode characters in a zero-terminated UTF-8 string.
  * Returned value for corrupted encoding is undefined, but is never greater than strlen().
  **/
-uns utf8_strlen(const byte *str);
+size_t utf8_strlen(const byte *str);
 
 /**
  * Same as @utf8_strlen(), but returns at most @n characters.
  **/
-uns utf8_strnlen(const byte *str, uns n);
+size_t utf8_strnlen(const byte *str, size_t n);
 
 #endif