rpms/hfsplusutils/devel hfsplusutils-1.0.4-gcc4.patch, NONE, 1.1 hfsplusutils.spec, 1.5, 1.6

David Woodhouse (dwmw2) fedora-extras-commits at redhat.com
Sat Apr 30 11:58:18 UTC 2005


Author: dwmw2

Update of /cvs/extras/rpms/hfsplusutils/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17403

Modified Files:
	hfsplusutils.spec 
Added Files:
	hfsplusutils-1.0.4-gcc4.patch 
Log Message:
gcc4 fixes

hfsplusutils-1.0.4-gcc4.patch:

--- NEW FILE hfsplusutils-1.0.4-gcc4.patch ---
--- hfsplus-1.0.4/libhfsp/src/btree.c~	2002-03-05 19:50:28.000000000 +0000
+++ hfsplus-1.0.4/libhfsp/src/btree.c	2005-04-30 12:48:48.000000000 +0100
@@ -393,7 +393,7 @@ static int btree_init(btree* bt, volume*
 	{
 	    p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
 		 HFSP_EXTENT_DATA, bt->cnid);
-	    ((char*) p) += HEADER_RESERVEDOFFSET; // skip header
+	    p += HEADER_RESERVEDOFFSET; // skip header
 	}
 	
 	bt->alloc_bits = malloc(alloc_size);
--- hfsplus-1.0.4/libhfsp/src/swab.h~	2002-03-05 19:50:29.000000000 +0000
+++ hfsplus-1.0.4/libhfsp/src/swab.h	2005-04-30 12:48:05.000000000 +0100
@@ -36,28 +36,28 @@
 
 #define bswabU16(val) bswap_16(val)
 
-#define bswabU16_inc(ptr) bswap_16(*((UInt16*) (ptr))++)
-#define bswabU32_inc(ptr) bswap_32(*((UInt32*) (ptr))++)
-#define bswabU64_inc(ptr) bswap_64(*((UInt64*) (ptr))++)
-
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = bswap_16(val)
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = bswap_32(val)
-#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = bswap_64(val)
+#define bswabU16_inc(ptr) bswap_16(*(*((UInt16**) (void *)(&ptr)))++)
+#define bswabU32_inc(ptr) bswap_32(*(*((UInt32**) (void *)(&ptr)))++)
+#define bswabU64_inc(ptr) bswap_64(*(*((UInt64**) (void *)(&ptr)))++)
+
+#define bstoreU16_inc(ptr, val) (*(*((UInt16**) (void *)(&ptr)))++) = bswap_16(val)
+#define bstoreU32_inc(ptr, val) (*(*((UInt32**) (void *)(&ptr)))++) = bswap_32(val)
+#define bstoreU64_inc(ptr, val) (*(*((UInt64**) (void *)(&ptr)))++) = bswap_64(val)
 
 #else // BYTE_ORDER == BIG_ENDIAN
 
 #define bswabU16(val) val
 
-#define bswabU16_inc(ptr) (*((UInt16*) (ptr))++)
-#define bswabU32_inc(ptr) (*((UInt32*) (ptr))++)
-#define bswabU64_inc(ptr) (*((UInt64*) (ptr))++)
-
-#define bstoreU16_inc(ptr, val) (*((UInt16*) (ptr))++) = val
-#define bstoreU32_inc(ptr, val) (*((UInt32*) (ptr))++) = val
-#define bstoreU64_inc(ptr, val) (*((UInt64*) (ptr))++) = val
+#define bswabU16_inc(ptr) (*(*((UInt16**) (void *)(&ptr)))++)
+#define bswabU32_inc(ptr) (*(*((UInt32**) (void *)(&ptr)))++)
+#define bswabU64_inc(ptr) (*(*((UInt64**) (void *)(&ptr)))++)
+
+#define bstoreU16_inc(ptr, val) (*(*((UInt16**) (void *)(&ptr)))++) = val
+#define bstoreU32_inc(ptr, val) (*(*((UInt32**) (void *)(&ptr)))++) = val
+#define bstoreU64_inc(ptr, val) (*(*((UInt64**) (void *)(&ptr)))++) = val
 
 #endif
 
 /* for the sake of compleetness and readability */
-#define bswabU8_inc(ptr)	(*((UInt8*) (ptr))++)
-#define bstoreU8_inc(ptr,val)	(*((UInt8*) (ptr))++) = val
+#define bswabU8_inc(ptr)	(*(*((UInt8**) (void *)(&ptr)))++)
+#define bstoreU8_inc(ptr,val)	(*(*((UInt8**) (void *)(&ptr)))++) = val
--- hfsplus-1.0.4/libhfsp/src/btreecheck.c~	2002-03-05 19:50:29.000000000 +0000
+++ hfsplus-1.0.4/libhfsp/src/btreecheck.c	2005-04-30 12:49:22.000000000 +0100
@@ -264,7 +264,7 @@ static int fscheck_btree_init(btree* bt,
 	{
 	    p = volume_readfromfork(vol, nodebuf, fork, 0, bt->blkpernode,
 		 HFSP_EXTENT_DATA, bt->cnid);
-	    ((char*) p) += HEADER_RESERVEDOFFSET; // skip header
+	    p += HEADER_RESERVEDOFFSET; // skip header
 	}
 	
 	bt->alloc_bits = malloc(alloc_size);
--- hfsplus-1.0.4/libhfsp/src/fscheck.c~	2002-03-25 15:48:37.000000000 +0000
+++ hfsplus-1.0.4/libhfsp/src/fscheck.c	2005-04-30 12:50:26.000000000 +0100
@@ -230,7 +230,7 @@ static int fscheck_volume_readbuf(volume
     vh->write_count	= bswabU32_inc(p);
     vh->encodings_bmp	= bswabU64_inc(p);
     memcpy(vh->finder_info, p, 32); 
-    ((char*) p) += 32; // So finderinfo must be swapped later, ***
+    p += 32; // So finderinfo must be swapped later, ***
     p = volume_readfork(p, &vh->alloc_file );
     p = volume_readfork(p, &vh->ext_file   );
     p = volume_readfork(p, &vh->cat_file   );
@@ -277,12 +277,12 @@ static int fscheck_read_wrapper(volume *
 	    printf("Volume is wrapped in HFS volume "
 		   " (use hfsck to check this)\n");
 
-	((char*) p) += 0x12;		/* skip unneded HFS vol fields */
+	p += 0x12;		/* skip unneded HFS vol fields */
 	drAlBlkSiz = bswabU32_inc(p);	/* offset 0x14 */
-	((char*) p) += 0x4;		/* skip unneded HFS vol fields */
+	p += 0x4;		/* skip unneded HFS vol fields */
 	drAlBlSt    = bswabU16_inc(p);	/* offset 0x1C */
 	
-	((char*) p) += 0x5E;		/* skip unneded HFS vol fields */
+	p += 0x5E;		/* skip unneded HFS vol fields */
 	signature = bswabU16_inc(p);	/* offset 0x7C, drEmbedSigWord */
 	if (signature != HFSP_VOLHEAD_SIG)
 	    HFSP_ERROR(-1, "This looks like a normal HFS volume");
--- hfsplus-1.0.4/libhfsp/src/volume.c~	2002-03-26 18:00:29.000000000 +0000
+++ hfsplus-1.0.4/libhfsp/src/volume.c	2005-04-30 12:51:41.000000000 +0100
@@ -345,7 +345,7 @@ static int volume_readbuf(hfsp_vh* vh, v
     vh->write_count	= bswabU32_inc(p);
     vh->encodings_bmp	= bswabU64_inc(p);
     memcpy(vh->finder_info, p, 32); 
-    ((char*) p) += 32; // finderinfo is not used by now
+    p += 32; // finderinfo is not used by now
     p = volume_readfork(p, &vh->alloc_file );
     p = volume_readfork(p, &vh->ext_file   );
     p = volume_readfork(p, &vh->cat_file   );
@@ -381,7 +381,7 @@ static int volume_writebuf(hfsp_vh* vh, 
     bstoreU32_inc(p, vh->write_count	);
     bstoreU64_inc(p, vh->encodings_bmp	);
     memcpy(p, vh->finder_info, 32); 
-    ((char*) p) += 32; // finderinfo is not used by now
+    p += 32; // finderinfo is not used by now
     p = volume_writefork(p, &vh->alloc_file );
     p = volume_writefork(p, &vh->ext_file   );
     p = volume_writefork(p, &vh->cat_file   );
@@ -417,12 +417,12 @@ static int volume_read_wrapper(volume * 
   
 	UInt16	embeds, embedl;		/* Start/lenght of embedded area in blocks */
 	
-	((char*) p) += 0x12;		/* skip unneeded HFS vol fields */
+	p += 0x12;		/* skip unneeded HFS vol fields */
 	drAlBlkSiz = bswabU32_inc(p);	/* offset 0x14 */
-	((char*) p) += 0x4;		/* skip unneeded HFS vol fields */
+	p += 0x4;		/* skip unneeded HFS vol fields */
 	drAlBlSt    = bswabU16_inc(p);	/* offset 0x1C */
 	
-	((char*) p) += 0x5E;		/* skip unneeded HFS vol fields */
+	p += 0x5E;		/* skip unneeded HFS vol fields */
 	signature = bswabU16_inc(p);	/* offset 0x7C, drEmbedSigWord */
 	if (signature != HFSP_VOLHEAD_SIG)
 	    HFSP_ERROR(-1, "This looks like a normal HFS volume");


Index: hfsplusutils.spec
===================================================================
RCS file: /cvs/extras/rpms/hfsplusutils/devel/hfsplusutils.spec,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- hfsplusutils.spec	6 Apr 2005 22:12:01 -0000	1.5
+++ hfsplusutils.spec	30 Apr 2005 11:58:16 -0000	1.6
@@ -1,7 +1,7 @@
 Summary: Tools for reading Macintosh HFS+ volumes
 Name: hfsplusutils
 Version: 1.0.4
-Release: 4
+Release: 5
 
 License: GPL
 Group: Applications/File
@@ -10,6 +10,7 @@
 Patch0: hfsplusutils-1.0.4-nullisnotachar.patch
 Patch1: hfsplusutils-1.0.4-errno.patch
 Patch2: hfsplusutils-1.0.4-includes.patch
+Patch3: hfsplusutils-1.0.4-gcc4.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: automake14, autoconf, libtool
 %description
@@ -23,6 +24,7 @@
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 aclocal-1.4
@@ -66,6 +68,11 @@
 
 
 %changelog
+* Sat Apr 30 2005 David Woodhouse <dwmw2 at infradead.org> 1.0.4-5
+- Fix pointer abuse which GCC 4 doesn't like. Yes, the workaround
+  is ugly as sin, but it is at least valid C. Apart from the bit 
+  about arithmetic on void *, but GCC is happy with that :)
+
 * Fri Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
 - rebuilt
 




More information about the fedora-extras-commits mailing list