diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-09-07 21:05:45 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-09-09 15:21:08 +0200 |
commit | 87c4840610e037018b9df30b1a31896b0bd284a9 (patch) | |
tree | d7e112606eb5f99afac3b277bc0c125335b79f20 /lib/efi_loader/efi_device_path_to_text.c | |
parent | b0f1c728c82c25291895d66e591fa2a6851ba374 (diff) |
efi_loader: eliminate inline function ascii2unicode()
ascii2unicode() can only convert characters 0x00-0x7f from UTF-8 to UTF-16.
Use utf8_utf16_strcpy() instead.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib/efi_loader/efi_device_path_to_text.c')
-rw-r--r-- | lib/efi_loader/efi_device_path_to_text.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index b20b7c097c..0f3796b373 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -29,15 +29,15 @@ const efi_guid_t efi_guid_device_path_to_text_protocol = static u16 *efi_str_to_u16(char *str) { efi_uintn_t len; - u16 *out; + u16 *out, *dst; efi_status_t ret; - len = strlen(str) + 1; - ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len * sizeof(u16), - (void **)&out); + len = sizeof(u16) * (utf8_utf16_strlen(str) + 1); + ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out); if (ret != EFI_SUCCESS) return NULL; - ascii2unicode(out, str); + dst = out; + utf8_utf16_strcpy(&dst, str); return out; } |