[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Jim Meyering meyering at alioth.debian.org
Sun Feb 8 10:46:26 UTC 2009


 libparted/fs/fat/fat.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit f8d27e413ac9c92061a27c7c488426d913a249c1
Author: Jim Meyering <meyering at redhat.com>
Date:   Sun Feb 8 10:53:01 2009 +0100

    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"

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*



More information about the Parted-commits mailing list