OSDN Git Service

Silenced warnings by gcc >= 4.8 about aliasing
authorJean-Pierre André <jpandre@users.sourceforge.net>
Mon, 9 Sep 2013 13:34:14 +0000 (15:34 +0200)
committerJean-Pierre André <jpandre@users.sourceforge.net>
Mon, 9 Sep 2013 13:34:14 +0000 (15:34 +0200)
Added intermediate variables to avoid warnings by gcc >= 4.8

ntfsprogs/ntfsinfo.c
src/secaudit.c

index 9acebd6..32f82e7 100644 (file)
@@ -1979,6 +1979,7 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol)
 {
        EA_ATTR *ea;
        u8 *buf = NULL;
+       le32 *pval;
        s64 data_size;
 
        if (attr->non_resident) {
@@ -2036,10 +2037,10 @@ static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol)
                printf("\tValue:\t\t ");
                if (ea->name_length == 11 &&
                                !strncmp((const char*)"SETFILEBITS",
-                               (const char*)ea->name, 11))
-                       printf("0%o\n", (unsigned)le32_to_cpu(*(le32*)
-                                       (ea->value + ea->name_length + 1)));
-               else
+                               (const char*)ea->name, 11)) {
+                       pval = (le32*)(ea->value + ea->name_length + 1);
+                       printf("0%lo\n", (unsigned long)le32_to_cpu(*pval));
+               else
                        printf("'%s'\n", ea->value + ea->name_length + 1);
                if (ea->next_entry_offset)
                        ea = (EA_ATTR*)((u8*)ea +
index 8c66ae3..ca2264f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *              Display and audit security attributes in an NTFS volume
  *
- * Copyright (c) 2007-2012 Jean-Pierre Andre
+ * Copyright (c) 2007-2013 Jean-Pierre Andre
  * 
  *     Options :
  *             -a auditing security data
  *
  *  Aug 2012, version 1.4.0
  *     - added an option for user mapping proposal
+ *
+ *  Sep 2013, version 1.4.1
+ *     - silenced an aliasing warning by gcc >= 4.8
  */
 
 /*
  *             General parameters which may have to be adapted to needs
  */
 
-#define AUDT_VERSION "1.4.0"
+#define AUDT_VERSION "1.4.1"
 
 #define GET_FILE_SECURITY "ntfs_get_file_security"
 #define SET_FILE_SECURITY "ntfs_set_file_security"
@@ -2480,6 +2483,7 @@ void showhex(FILE *fd)
        int mode;
        unsigned int off;
        int i;
+       le32 *pattr;
        BOOL isdump;
        BOOL done;
 
@@ -2539,8 +2543,9 @@ void showhex(FILE *fd)
                        /* decode it into attribute */
                if (isdump && (off == pos)) {
                        for (i=first+8; i<lth; i+=9) {
+                               pattr = (le32*)&attr[pos];
                                v = getlsbhex(&line[i]);
-                               *(le32*)&attr[pos] = cpu_to_le32(v);
+                               *pattr = cpu_to_le32(v);
                                pos += 4;
                        }
                }
@@ -2718,6 +2723,7 @@ BOOL restore(FILE *fd)
        int i;
        int count;
        int attrib;
+       le32 *pattr;
        BOOL withattr;
        BOOL done;
 
@@ -2774,8 +2780,9 @@ BOOL restore(FILE *fd)
                        /* decode it into attribute */
                if (isdump && (off == pos)) {
                        for (i=first+8; i<lth; i+=9) {
+                               pattr = (le32*)&attr[pos];
                                v = getlsbhex(&line[i]);
-                               *(le32*)&attr[pos] = cpu_to_le32(v);
+                               *pattr = cpu_to_le32(v);
                                pos += 4;
                        }
                }