PATCH: fix illegal lhs cast

Marcus Meissner marcus at jet.franken.de
Wed Jun 16 01:13:32 CDT 2004


Hi,

This fixes some of the illegal increment of casted lvalue warnings (3.4) / errors (3.5).

Ciao, Marcus

Changelog:
	Fixed some illegal lvalue casts / increments.

Index: dlls/kernel/ne_module.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/ne_module.c,v
retrieving revision 1.23
diff -u -r1.23 ne_module.c
--- dlls/kernel/ne_module.c	19 May 2004 03:22:56 -0000	1.23
+++ dlls/kernel/ne_module.c	16 Jun 2004 06:04:07 -0000
@@ -868,7 +868,7 @@
                     bundle->first = bundle->last =
                         oldbundle->last + nr_entries;
                     bundle->next = 0;
-                    (BYTE *)entry += sizeof(ET_BUNDLE);
+		    entry = (ET_ENTRY*)(((BYTE*)entry)+sizeof(ET_BUNDLE));
                 }
             }
         }
Index: dlls/kernel/ne_segment.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/ne_segment.c,v
retrieving revision 1.11
diff -u -r1.11 ne_segment.c
--- dlls/kernel/ne_segment.c	28 May 2004 19:29:20 -0000	1.11
+++ dlls/kernel/ne_segment.c	16 Jun 2004 06:04:07 -0000
@@ -211,8 +211,10 @@
 
       ReadFile(hf, buff, size, &res, NULL);
       while(curr < buff + size) {
-	unsigned int rept = *((short*) curr)++;
-	unsigned int len = *((short*) curr)++;
+	unsigned int rept = ((short*)curr)[0];
+	unsigned int len =  ((short*)curr)[1];
+
+	curr += 2*sizeof(short);
 	for(; rept > 0; rept--) {
 	  char* bytes = curr;
 	  unsigned int byte;
Index: dlls/kernel/thunk.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/thunk.c,v
retrieving revision 1.49
diff -u -r1.49 thunk.c
--- dlls/kernel/thunk.c	20 Feb 2004 20:19:23 -0000	1.49
+++ dlls/kernel/thunk.c	16 Jun 2004 06:04:10 -0000
@@ -1456,6 +1456,8 @@
     LPBYTE stub = MapSL(context->Eax), x = stub;
     WORD cs = wine_get_cs();
     WORD ds = wine_get_ds();
+    LPWORD xw;
+    LPDWORD xd;
 
     /* We produce the following code:
      *
@@ -1470,18 +1472,19 @@
      *   call __FLATCS:__wine_call_from_16_thunk
      */
 
-    *x++ = 0xB8; *((WORD *)x)++ = ds;
+    *x++ = 0xB8; xw = (LPWORD)x; *xw = ds; x += sizeof(WORD);
     *x++ = 0x8E; *x++ = 0xC0;
     *x++ = 0x66; *x++ = 0x0F; *x++ = 0xB7; *x++ = 0xC9;
     *x++ = 0x67; *x++ = 0x66; *x++ = 0x26; *x++ = 0x8B;
-                 *x++ = 0x91; *((DWORD *)x)++ = context->Edx;
+                 *x++ = 0x91; xd = (LPDWORD)x; *xd = context->Edx; x += sizeof(DWORD);
 
     *x++ = 0x55;
     *x++ = 0x66; *x++ = 0x52;
     *x++ = 0x52;
     *x++ = 0x66; *x++ = 0x52;
-    *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)__wine_call_from_16_thunk;
-                              *((WORD *)x)++ = cs;
+    *x++ = 0x66; *x++ = 0x9A;
+	xd = (LPDWORD)x; *xd = (DWORD)__wine_call_from_16_thunk; x += sizeof(DWORD);
+	xw = (LPWORD)x;  *xw = cs; x += sizeof(WORD);
 
     /* Jump to the stub code just created */
     context->Eip = LOWORD(context->Eax);
@@ -1499,6 +1502,8 @@
 void WINAPI C16ThkSL01(CONTEXT86 *context)
 {
     LPBYTE stub = MapSL(context->Eax), x = stub;
+    LPDWORD xd;
+    LPWORD xw;
 
     if (stub)
     {
@@ -1530,15 +1535,16 @@
          */
 
         *x++ = 0x66; *x++ = 0x33; *x++ = 0xC0;
-        *x++ = 0x66; *x++ = 0xBA; *((DWORD *)x)++ = (DWORD)td;
-        *x++ = 0x9A; *((DWORD *)x)++ = procAddress;
+        *x++ = 0x66; *x++ = 0xBA; xd = (LPDWORD)x; *xd = (DWORD)td; x += sizeof(DWORD);
+        *x++ = 0x9A; xd = (LPDWORD)x; *xd = procAddress; x += sizeof(DWORD);
 
         *x++ = 0x55;
         *x++ = 0x66; *x++ = 0x52;
         *x++ = 0x52;
         *x++ = 0x66; *x++ = 0x52;
-        *x++ = 0x66; *x++ = 0x9A; *((DWORD *)x)++ = (DWORD)__wine_call_from_16_thunk;
-                                  *((WORD *)x)++ = cs;
+        *x++ = 0x66; *x++ = 0x9A;
+		xd = (LPDWORD)x; *xd = (DWORD)__wine_call_from_16_thunk; x += sizeof(DWORD);
+		xw = (LPWORD)x; *xw = cs; x += sizeof(WORD);
 
         /* Jump to the stub code just created */
         context->Eip = LOWORD(context->Eax);



More information about the wine-patches mailing list