]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/hfs.c (macroman_to_utf8): Convert / to :.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 14 Jan 2012 22:34:33 +0000 (23:34 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 14 Jan 2012 22:34:33 +0000 (23:34 +0100)
(utf8_to_macroman): Do the opposite.
* grub-core/fs/hfsplus.c (grub_hfsplus_iterate_dir): Convert / to :.

ChangeLog
grub-core/fs/hfs.c
grub-core/fs/hfsplus.c

index 03fd8b8080b96100339aab40ea78d5536f2a07ce..3918905873482c742009dc43df2ec380adc509bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-14  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/hfs.c (macroman_to_utf8): Convert / to :.
+       (utf8_to_macroman): Do the opposite.
+       * grub-core/fs/hfsplus.c (grub_hfsplus_iterate_dir): Convert / to :.
+
 2012-01-14  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * configure.ac: Refise build qemu_mips w/o unifont.
index 6a86e2e7d1d72d1846be0574185ea6d94e5bbdcc..c14a884ccfbad9e0fc6abdb5b16e4b6b338286f4 100644 (file)
@@ -1004,6 +1004,12 @@ 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 == '/')
+       {
+         *optr++ = ':';
+         continue;
+       }       
       if (!(*iptr & 0x80))
        {
          *optr++ = *iptr;
@@ -1024,6 +1030,13 @@ utf8_to_macroman (grub_uint8_t *to, const char *from)
   while (*iptr && optr < end)
     {
       int i, clen;
+      /* Translate ':' to '/' as per HFS spec.  */
+      if (*iptr == ':')
+       {
+         *optr++ = '/';
+         iptr++;
+         continue;
+       }       
       if (!(*iptr & 0x80))
        {
          *optr++ = *iptr++;
index d1fa15e9f242db9671640fe489451349259ec6a3..b20f9f3bb283c864d3f4544319066b02fd5720a7 100644 (file)
@@ -789,6 +789,9 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir,
        {
          catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]);
 
+         if (catkey->name[i] == '/')
+           catkey->name[i] = ':';
+
          /* If the name is obviously invalid, skip this node.  */
          if (catkey->name[i] == 0)
            return 0;
@@ -799,7 +802,11 @@ grub_hfsplus_iterate_dir (grub_fshelp_node_t dir,
 
       /* Restore the byte order to what it was previously.  */
       for (i = 0; i < grub_be_to_cpu16 (catkey->namelen); i++)
-       catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]);
+       {
+         if (catkey->name[i] == ':')
+           catkey->name[i] = '/';
+         catkey->name[i] = grub_be_to_cpu16 (catkey->name[i]);
+       }
 
       /* hfs+ is case insensitive.  */
       if (! dir->data->case_sensitive)