aboutsummaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2019-02-13 07:12:29 -0500
committerTom Rini <trini@konsulko.com>2019-02-13 07:12:29 -0500
commit63f7e3fca391a50a499fed828fe16325fdee45f3 (patch)
tree6214d5fe9a24d21b9a729a1bda3fdd22e442d298 /lib/vsprintf.c
parentb1b1bab7f92b838a252ab977f56d9c3584c14fb7 (diff)
parent823c233b7ab95169ea4428b2821b72b8887b47b0 (diff)
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2019-02-13 Goodness this time around: - HII protocol, finally allows us to run the UEFI Shell! (experimantal, disabled by default) - efi selftest now available on Cortex-M - NVMe support for distro boot - Lots of code cleanup
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 4213441fbf..de5db1aa5c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -279,13 +279,17 @@ static char *string(char *buf, char *end, char *s, int field_width,
static char *string16(char *buf, char *end, u16 *s, int field_width,
int precision, int flags)
{
- u16 *str = s ? s : L"<NULL>";
- ssize_t len = utf16_strnlen(str, precision);
+ const u16 *str = s ? s : L"<NULL>";
+ ssize_t i, len = utf16_strnlen(str, precision);
if (!(flags & LEFT))
for (; len < field_width; --field_width)
ADDCH(buf, ' ');
- utf16_utf8_strncpy(&buf, str, len);
+ for (i = 0; i < len && buf + utf16_utf8_strnlen(str, 1) <= end; ++i) {
+ s32 s = utf16_get(&str);
+
+ utf8_put(s, &buf);
+ }
for (; len < field_width; --field_width)
ADDCH(buf, ' ');
return buf;