From: Pavel Charvat Date: Mon, 2 Jun 2014 17:44:25 +0000 (+0200) Subject: UTF-8 strings: Converted to size_t. X-Git-Tag: v6.0~18 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=04b38ab2035d9d6c93ed2802cf0dc940710b502f;p=libucw.git UTF-8 strings: Converted to size_t. --- diff --git a/ucw/unicode.c b/ucw/unicode.c index 1dc29e12..32b664e8 100644 --- a/ucw/unicode.c +++ b/ucw/unicode.c @@ -11,10 +11,10 @@ #include #include -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) { diff --git a/ucw/unicode.h b/ucw/unicode.h index e29bc366..c9d6a0c1 100644 --- a/ucw/unicode.h +++ b/ucw/unicode.h @@ -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