[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 15/16] fs/iso9660: Simplify to use grub_utf16_to_utf8_alloc()
From: |
Vitaly Kuzmichev |
Subject: |
[PATCH v5 15/16] fs/iso9660: Simplify to use grub_utf16_to_utf8_alloc() |
Date: |
Tue, 22 Aug 2023 23:39:23 +0200 |
Transform grub_iso9660_convert_string() function to use
grub_utf16_to_utf8_alloc() helper function to convert file names and
volume name from UTF-16 to UTF-8.
Signed-off-by: Vitaly Kuzmichev <vitaly.kuzmichev@rtsoft.de>
---
grub-core/fs/iso9660.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
index 5eb6c1a0a..d2ea397ee 100644
--- a/grub-core/fs/iso9660.c
+++ b/grub-core/fs/iso9660.c
@@ -376,20 +376,7 @@ grub_iso9660_susp_iterate (grub_fshelp_node_t node,
grub_off_t off,
static char *
grub_iso9660_convert_string (grub_uint8_t *us, int len)
{
- char *p;
- int i;
- grub_uint16_t t[MAX_NAMELEN / 2 + 1];
-
- p = grub_calloc (len, GRUB_MAX_UTF8_PER_UTF16 + 1);
- if (! p)
- return NULL;
-
- for (i=0; i<len; i++)
- t[i] = grub_be_to_cpu16 (grub_get_unaligned16 (us + 2 * i));
-
- *grub_utf16_to_utf8 ((grub_uint8_t *) p, t, len, UTF16_CPU) = '\0';
-
- return p;
+ return (char *) grub_utf16_to_utf8_alloc (us, len, UTF16_BE);
}
static grub_err_t
--
2.34.1
- Re: [PATCH v5 13/16] fs/f2fs: Simplify to use grub_utf16_to_utf8_alloc(), (continued)
- [PATCH v5 07/16] include/grub/charset.h: Add grub_utf16_{strlen, strnlen}(), Vitaly Kuzmichev, 2023/08/22
- [PATCH v5 06/16] include/grub/charset.h: Enhance grub_utf16_to_utf8(), Vitaly Kuzmichev, 2023/08/22
- [PATCH v5 14/16] fs/fat: Simplify to use grub_utf16_to_utf8_alloc(), Vitaly Kuzmichev, 2023/08/22
- [PATCH v5 08/16] include/grub/charset.h: Add grub_utf16_to_utf8_alloc(), Vitaly Kuzmichev, 2023/08/22
- [PATCH v5 15/16] fs/iso9660: Simplify to use grub_utf16_to_utf8_alloc(),
Vitaly Kuzmichev <=
- [PATCH v5 09/16] partmap/gpt: Add grub_gpt_partition_get_label(), Vitaly Kuzmichev, 2023/08/22
- [PATCH v5 16/16] fs/ntfs: Simplify to use grub_utf16_to_utf8_alloc(), Vitaly Kuzmichev, 2023/08/22
Re: [PATCH v5 00/16] Support searching by PARTUUID and PARTLABEL, Daniel Kiper, 2023/08/30