FYI, just pushed to master:

>From f8d27e413ac9c92061a27c7c488426d913a249c1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Sun, 8 Feb 2009 10:53:01 +0100
Subject: [PATCH] compile warning-free also with upcoming gcc-4.4

* libparted/fs/fat/fat.c (_gen_new_serial_number): Use a union
rather than a warning-provoking cast.  Avoids this gcc warning:
"dereferencing type-punned pointer will break strict-aliasing rules"
---
 libparted/fs/fat/fat.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/libparted/fs/fat/fat.c b/libparted/fs/fat/fat.c
index c5fe967..242162f 100644
--- a/libparted/fs/fat/fat.c
+++ b/libparted/fs/fat/fat.c
@@ -1,6 +1,6 @@
 /*
     libparted
-    Copyright (C) 1998, 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
+    Copyright (C) 1998-2001, 2007-2009 Free Software Foundation, Inc.

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -265,12 +265,15 @@ fat_root_dir_clear (PedFileSystem* fs)
  * with /dev/random) number.  Unfortunately, we can only use 4 bytes of it
  */
 static uint32_t
-_gen_new_serial_number ()
+_gen_new_serial_number (void)
 {
-       uuid_t          uuid;
+       union {
+               uuid_t uuid;
+               uint32_t i;
+       } uu32;

-       uuid_generate (uuid);
-       return * (uint32_t*) &uuid [0];
+       uuid_generate (uu32.uuid);
+       return uu32.i;
 }

 PedFileSystem*
--
1.6.1.2.549.g547ef

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to