[PATCH RFC 1/6] lib: charset: Fix utf8_to_utf32_stream() return value doc string

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Jan 18 18:59:31 CET 2024


On 1/17/24 23:24, Janne Grunau via B4 Relay wrote:
> From: Janne Grunau <j at jannau.net>
>
> The comment appears to be copied from utf8_to_cp437_stream() but was not
> updated.
>

Fixes: e91789e2f661 ("lib/charset: UTF-8 stream conversion")

> Signed-off-by: Janne Grunau <j at jannau.net>
> ---
>   include/charset.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/charset.h b/include/charset.h
> index 44034c71d3..714382e1c1 100644
> --- a/include/charset.h
> +++ b/include/charset.h
> @@ -328,7 +328,7 @@ int utf8_to_cp437_stream(u8 c, char *buffer);

Without a further description it is unclear what this function is
intended to do. How about:

"This function can be used to convert a 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:	next Unicode code point or 0

%s/next//g

>    */
>   int utf8_to_utf32_stream(u8 c, char *buffer);

Best regards

Heinrich


More information about the U-Boot mailing list