From e04ec8626e19b897081b6b50cc84da1f2c29909b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Aug 2006 22:20:18 +0000 Subject: [PATCH] * UTF8ToCharCode() only skipped 3 bytes for a 4 byte character. * Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18702 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/interface/utf8_functions.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/headers/private/interface/utf8_functions.h b/headers/private/interface/utf8_functions.h index c7d740e894..4b13beb75c 100644 --- a/headers/private/interface/utf8_functions.h +++ b/headers/private/interface/utf8_functions.h @@ -12,7 +12,7 @@ static inline bool IsInsideGlyph(uchar ch) { - return (ch & 0xC0) == 0x80; + return (ch & 0xc0) == 0x80; } static inline uint32 @@ -104,12 +104,13 @@ UTF8CountChars(const char *text, int32 numBytes) } -/* UTF8ToCharCode converts the input that includes potential multibyte chars +/*! UTF8ToCharCode converts the input that includes potential multibyte chars to UTF-32 char codes that can be used by FreeType. The string pointer is then advanced to the next character in the string. In case the terminating 0 is reached, the string pointer is not advanced anymore and spaces are returned. This makes it safe to overruns and enables streamed processing - of UTF8 strings. */ + of UTF8 strings. +*/ static inline uint32 UTF8ToCharCode(const char **bytes) { @@ -135,7 +136,7 @@ UTF8ToCharCode(const char **bytes) result += (*bytes)[2] & 0x3f; result <<= 6; result += (*bytes)[3] & 0x3f; - (*bytes) += 3; + (*bytes) += 4; return result; } @@ -175,8 +176,9 @@ UTF8ToCharCode(const char **bytes) } -/* UTF8ToLength works like strlen() but takes UTF8 encoded multibyte chars - into account. It's a quicker version of UTF8CountChars above. */ +/*! UTF8ToLength works like strlen() but takes UTF8 encoded multibyte chars + into account. It's a quicker version of UTF8CountChars above. +*/ static inline int32 UTF8ToLength(const char *bytes) {