#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);
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)
{
* 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