summaryrefslogtreecommitdiff
path: root/include/charset.h
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2018-08-31 21:31:26 +0200
committerAlexander Graf <agraf@suse.de>2018-09-23 21:55:29 +0200
commit1dde0d57a5d1281aaa949e9bf7b5c476345a56ee (patch)
treed3d429da4ee0d2fc08a040ef4ca556d247907a07 /include/charset.h
parentfbb3ea806f62b7e27bbae86c42d8f73f05de4bd7 (diff)
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>
Diffstat (limited to 'include/charset.h')
-rw-r--r--include/charset.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/include/charset.h b/include/charset.h
index 11832cbd12..2c6deb8034 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -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()