PATCH: wrc/newstruct lvalue patch

Marcus Meissner marcus at jet.franken.de
Sun Jul 4 14:05:06 CDT 2004


Hi,

Second try to get rid of the lvalue cast in here.

Ciao, Marcus

Changelog:
	Generic SKIP_TAG to skip a number of bytes, use it where applicable.

Index: tools/wrc/newstruc.c
===================================================================
RCS file: /home/wine/wine/tools/wrc/newstruc.c,v
retrieving revision 1.21
diff -u -r1.21 newstruc.c
--- tools/wrc/newstruc.c	1 Jun 2004 19:43:21 -0000	1.21
+++ tools/wrc/newstruc.c	4 Jul 2004 19:00:54 -0000
@@ -702,7 +702,9 @@
 static const char rate[4] = "rate";
 static const char seq[4]  = "seq ";
 
-#define NEXT_TAG(p)	((riff_tag_t *)(((char *)p) + (isswapped ? BYTESWAP_DWORD(p->size) : p->size) + sizeof(*p)))
+#define SKIP_TAG(p,size) 	((riff_tag_t *)(((char *)p) + (size)))
+
+#define NEXT_TAG(p)	SKIP_TAG(p,(isswapped ? BYTESWAP_DWORD(p->size) : p->size) + sizeof(*p))
 
 static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped)
 {
@@ -768,7 +770,7 @@
 	{
 		if(!memcmp(rtp->tag, info, sizeof(info)))
 		{
-			rtp = (riff_tag_t *)(((char *)rtp) + 4);
+			rtp = SKIP_TAG(rtp,4);
 		}
 		else if(!memcmp(rtp->tag, inam, sizeof(inam)))
 		{
@@ -786,7 +788,7 @@
 			 * simply ignore this because it is pure
 			 * non-information.
 			 */
-			rtp = (riff_tag_t *)(((char *)rtp) + 4);
+			rtp = SKIP_TAG(rtp,4);
 		}
 		else if(!memcmp(rtp->tag, icon, sizeof(icon)))
 		{
@@ -802,7 +804,7 @@
 
 		/* FIXME: This relies in sizeof(DWORD) == sizeof(pointer_type) */
 		if((DWORD)rtp & 1)
-			((char *)rtp)++;
+			rtp = SKIP_TAG(rtp,1);
 	}
 }
 
@@ -865,7 +867,7 @@
 		{
 			if(!memcmp(rtp->tag, acon, sizeof(acon)))
 			{
-				rtp = (riff_tag_t *)(((char *)rtp) + 4);
+				rtp = SKIP_TAG(rtp,4);
 			}
 			else if(!memcmp(rtp->tag, list, sizeof(list)))
 			{
@@ -913,7 +915,7 @@
 
 			/* FIXME: This relies in sizeof(DWORD) == sizeof(pointer_type) */
 			if((DWORD)rtp & 1)
-				((char *)rtp)++;
+				rtp = SKIP_TAG(rtp,1);
 		}
 
 		/* We must end correctly here */
-- 



More information about the wine-patches mailing list