summaryrefslogtreecommitdiff
path: root/libs/utils/Unicode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/utils/Unicode.cpp')
-rw-r--r--libs/utils/Unicode.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/libs/utils/Unicode.cpp b/libs/utils/Unicode.cpp
index 41cbf035e5ae..78c61b4fc632 100644
--- a/libs/utils/Unicode.cpp
+++ b/libs/utils/Unicode.cpp
@@ -542,7 +542,11 @@ ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len)
return u16measuredLen;
}
-char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, char16_t* u16str)
+/**
+ * Convert a UTF-8 string to UTF-16. The destination UTF-16 buffer must have
+ * space for NULL at the end.
+ */
+void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str)
{
const uint8_t* const u8end = u8str + u8len;
const uint8_t* u8cur = u8str;
@@ -565,12 +569,7 @@ char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, c
u8cur += u8len;
}
- return u16cur;
-}
-
-void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) {
- char16_t* end = utf8_to_utf16_no_null_terminator(u8str, u8len, u16str);
- *end = 0;
+ *u16cur = 0;
}
}