
On 11.08.18 17:28, Heinrich Schuchardt wrote:
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
include/charset.h | 28 +++++++++++----------------- lib/charset.c | 10 +++++++--- lib/efi_loader/efi_bootmgr.c | 2 +- lib/efi_loader/efi_console.c | 2 +- lib/efi_loader/efi_file.c | 2 +- lib/efi_loader/efi_variable.c | 2 +- lib/vsprintf.c | 2 +- 7 files changed, 23 insertions(+), 25 deletions(-)
diff --git a/include/charset.h b/include/charset.h index 11832cbd12..2307559890 100644 --- a/include/charset.h +++ b/include/charset.h @@ -13,29 +13,23 @@ #define MAX_UTF8_PER_UTF16 3
/**
- utf16_strlen() - Get the length of an utf16 string
- u16_strlen - count non-zero words
This really just implements wcslen() now, right?
- Returns the number of 16 bit characters in an utf16 string, not
- including the terminating NULL character.
- @in the string to measure
- @return the string length
- @in: utf-16 string
Is "in" really a utf-16 string? Probably rather a null-terminated string of words.
- 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.
- 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.
- u16_strlen - count non-zero words
This really just implements wcsnlen() now, right?
- @in the string to measure
- @count the maximum number of characters to count
- @return the string length, up to a maximum of 'count'
- @in: utf-16 string
Same comment here.
Alex