[2274] 2009-06-08 Pavel Roskin <[email protected]>

Pavel Roskin <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2274
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2274
Author:   proski
Date:     2009-06-08 13:25:54 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
2009-06-08  Pavel Roskin  <[email protected]>

	* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning
	about aliasing.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/fs/hfs.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-08 13:11:58 UTC (rev 2273)
+++ trunk/grub2/ChangeLog	2009-06-08 13:25:54 UTC (rev 2274)
@@ -1,3 +1,8 @@
+2009-06-08  Pavel Roskin  <[email protected]>
+
+	* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning
+	about aliasing.
+
 2009-06-08  Felix Zielcke  <[email protected]>
 
 	* Makefile.in (uninstall): Remove all $lib_DATA files.

Modified: trunk/grub2/fs/hfs.c
===================================================================
--- trunk/grub2/fs/hfs.c	2009-06-08 13:11:58 UTC (rev 2273)
+++ trunk/grub2/fs/hfs.c	2009-06-08 13:25:54 UTC (rev 2274)
@@ -872,9 +872,12 @@
   int inode = data->rootdir;
   char *next;
   char *origpath;
-  struct grub_hfs_filerec frec;
-  struct grub_hfs_dirrec *dir = (struct grub_hfs_dirrec *) &frec;
-  frec.type = GRUB_HFS_FILETYPE_DIR;
+  union {
+    struct grub_hfs_filerec frec;
+    struct grub_hfs_dirrec dir;
+  } fdrec;
+
+  fdrec.frec.type = GRUB_HFS_FILETYPE_DIR;
   
   if (path[0] != '/')
     {
@@ -892,7 +895,7 @@
   
   while (path && grub_strlen (path))
     {
-      if (frec.type != GRUB_HFS_FILETYPE_DIR)
+      if (fdrec.frec.type != GRUB_HFS_FILETYPE_DIR)
 	{
 	  grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
 	  goto fail;
@@ -914,7 +917,7 @@
       
       /* Lookup this node.  */
       if (! grub_hfs_find_node (data, (char *) &key, data->cat_root,
-				0, (char *) &frec, sizeof (frec)))
+				0, (char *) &fdrec.frec, sizeof (fdrec.frec)))
 	{
 	  grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
 	  goto fail;
@@ -923,12 +926,12 @@
       if (grub_errno)
 	goto fail;
       
-      inode = grub_be_to_cpu32 (dir->dirid);
+      inode = grub_be_to_cpu32 (fdrec.dir.dirid);
       path = next;
     }
 
   if (retdata)
-    grub_memcpy (retdata, &frec, sizeof (frec));
+    grub_memcpy (retdata, &fdrec.frec, sizeof (fdrec.frec));
   
   if (retinode)
     *retinode = inode;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.