summaryrefslogtreecommitdiff
path: root/include/charset.h
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-10-18 19:13:06 +0300
committerAlexander Graf <agraf@suse.de>2017-12-01 15:22:55 +0300
commitf58c5ecb87e0ab170dfa92cd0c1052dd18fffc2c (patch)
treefd4eb80cdc17f2874685215a79bb4b9ef93d9f93 /include/charset.h
parent30a0045a54e96e799b0694451a977dba572675fb (diff)
downloadu-boot-f58c5ecb87e0ab170dfa92cd0c1052dd18fffc2c.tar.xz
efi_loader: new function utf8_to_utf16
Provide a conversion function from utf8 to utf16. Add missing #include <linux/types.h> in include/charset.h. Remove superfluous #include <common.h> in lib/charset.c. 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.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/charset.h b/include/charset.h
index 37a3278499..2662c2f7c9 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -9,6 +9,8 @@
#ifndef __CHARSET_H_
#define __CHARSET_H_
+#include <linux/types.h>
+
#define MAX_UTF8_PER_UTF16 3
/**
@@ -62,4 +64,17 @@ uint16_t *utf16_strdup(const uint16_t *s);
*/
uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
+/**
+ * utf8_to_utf16() - Convert an utf8 string to utf16
+ *
+ * Converts up to 'size' characters of the utf16 string 'src' to utf8
+ * written to the 'dest' buffer. Stops at 0x00.
+ *
+ * @dest the destination buffer to write the utf8 characters
+ * @src the source utf16 string
+ * @size maximum number of utf16 characters to convert
+ * @return the pointer to the first unwritten byte in 'dest'
+ */
+uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size);
+
#endif /* __CHARSET_H_ */