]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Handle slash in HFS label.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 26 Jun 2012 12:53:35 +0000 (14:53 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Tue, 26 Jun 2012 12:53:35 +0000 (14:53 +0200)
* grub-core/fs/hfs.c (macroman_to_utf8): New argument slash_translate.
(grub_hfs_dir): Tanslate slash.
(grub_hfs_label): Don't translate slash.

ChangeLog
grub-core/fs/hfs.c

index 65c88ba92a2c2b8f278c053735ea17786c7540c8..61d686e07b7ea2807b4ad1c859abe10a0a793f5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 2b4272ef5ec8424e080b939b56983b1002ded25d..0a249ccb8cbfd21dfb68e64869e328d89a9b4917 100644 (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;