1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 08:42:12 +02:00

efi_loader: rename utf16_strlen, utf16_strnlen

The function names utf16_strlen() and utf16_strnlen() are misnomers.
The functions do not count utf-16 characters but non-zero words.
So let's rename them to u16_strlen and u16_strnlen().

In utf16_dup() avoid assignment in if clause.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Heinrich Schuchardt
2018-08-31 21:31:26 +02:00
committed by Alexander Graf
parent fbb3ea806f
commit 1dde0d57a5
7 changed files with 27 additions and 23 deletions

View File

@@ -13,29 +13,29 @@
#define MAX_UTF8_PER_UTF16 3
/**
* utf16_strlen() - Get the length of an utf16 string
* u16_strlen - count non-zero words
*
* Returns the number of 16 bit characters in an utf16 string, not
* including the terminating NULL character.
* This function matches wsclen() if the -fshort-wchar compiler flag is set.
* In the EFI context we explicitly need a function handling u16 strings.
*
* @in the string to measure
* @return the string length
* @in: null terminated u16 string
* ReturnValue: number of non-zero words.
* This is not the number of utf-16 letters!
*/
size_t utf16_strlen(const uint16_t *in);
size_t u16_strlen(const u16 *in);
/**
* utf16_strnlen() - Get the length of a fixed-size utf16 string.
* u16_strlen - count non-zero words
*
* Returns the number of 16 bit characters in an utf16 string,
* not including the terminating NULL character, but at most
* 'count' number of characters. In doing this, utf16_strnlen()
* looks at only the first 'count' characters.
* This function matches wscnlen_s() if the -fshort-wchar compiler flag is set.
* In the EFI context we explicitly need a function handling u16 strings.
*
* @in the string to measure
* @count the maximum number of characters to count
* @return the string length, up to a maximum of 'count'
* @in: null terminated u16 string
* @count: maximum number of words to count
* ReturnValue: number of non-zero words.
* This is not the number of utf-16 letters!
*/
size_t utf16_strnlen(const uint16_t *in, size_t count);
size_t u16_strnlen(const u16 *in, size_t count);
/**
* utf16_strcpy() - UTF16 equivalent of strcpy()