Handle slash in HFS label.

* grub-core/fs/hfs.c (macroman_to_utf8): New argument slash_translate.
	(grub_hfs_dir): Tanslate slash.
	(grub_hfs_label): Don't translate slash.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-26 14:53:35 +02:00
parent 54853fd72e
commit 9f3fc8835f
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,11 @@
2012-06-26 Vladimir Serbinenko <phcoder@gmail.com>
Handle slash in HFS label.
* grub-core/fs/hfs.c (macroman_to_utf8): New argument slash_translate.
(grub_hfs_dir): Tanslate slash.
(grub_hfs_label): Don't translate slash.
2012-06-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/ls.c (grub_ls_list_devices): Disable

View file

@ -999,7 +999,8 @@ static const char macroman[0x80][MAX_UTF8_PER_MAC_ROMAN + 1] =
};
static void
macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len)
macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len,
int translate_slash)
{
char *optr = to;
const grub_uint8_t *iptr;
@ -1007,7 +1008,7 @@ macroman_to_utf8 (char *to, const grub_uint8_t *from, grub_size_t len)
for (iptr = from; iptr < from + len && *iptr; iptr++)
{
/* Translate '/' to ':' as per HFS spec. */
if (*iptr == '/')
if (*iptr == '/' && translate_slash)
{
*optr++ = ':';
continue;
@ -1174,7 +1175,7 @@ grub_hfs_dir (grub_device_t device, const char *path,
len = ckey->strlen;
if (len > sizeof (ckey->str))
len = sizeof (ckey->str);
macroman_to_utf8 (fname, ckey->str, len);
macroman_to_utf8 (fname, ckey->str, len, 1);
info.case_insensitive = 1;
@ -1299,7 +1300,7 @@ grub_hfs_label (grub_device_t device, char **label)
*label = grub_malloc (len * MAX_UTF8_PER_MAC_ROMAN + 1);
if (*label)
macroman_to_utf8 (*label, data->sblock.volname + 1,
len + 1);
len + 1, 0);
}
else
*label = 0;