aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Grunau <j@jannau.net>2024-02-10 13:46:39 +0100
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2024-02-12 17:35:34 +0100
commit1a72acba38262850bcb146cd950e08518ea33d78 (patch)
tree0c9314395cac525d46b6a63d7e4b36c393edd51d
parent50457f547de8f719566476436321b51a33b792a0 (diff)
downloadu-boot-1a72acba38262850bcb146cd950e08518ea33d78.zip
u-boot-1a72acba38262850bcb146cd950e08518ea33d78.tar.gz
u-boot-1a72acba38262850bcb146cd950e08518ea33d78.tar.bz2
lib: charset: Fix and extend utf8_to_utf32_stream() documentation
Clarify usage of buffer argument. Signed-off-by: Janne Grunau <j@jannau.net> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
-rw-r--r--include/charset.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/charset.h b/include/charset.h
index 44034c7..f1050c9 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -324,11 +324,21 @@ int utf_to_cp(s32 *c, const u16 *codepage);
int utf8_to_cp437_stream(u8 c, char *buffer);
/**
- * utf8_to_utf32_stream() - convert UTF-8 stream to UTF-32
+ * utf8_to_utf32_stream() - convert UTF-8 byte stream to Unicode code points
+ *
+ * The function is called for each byte @c in a UTF-8 stream. The byte is
+ * appended to the temporary storage @buffer until the UTF-8 stream in
+ * @buffer describes a Unicode code point.
+ *
+ * When a new code point has been decoded it is returned and buffer[0] is
+ * set to '\0', otherwise the return value is 0.
+ *
+ * The buffer must be at least 5 characters long. Before the first function
+ * invocation buffer[0] must be set to '\0'."
*
* @c: next UTF-8 character to convert
* @buffer: buffer, at least 5 characters
- * Return: next codepage 437 character or 0
+ * Return: Unicode code point or 0
*/
int utf8_to_utf32_stream(u8 c, char *buffer);