PATCH: wincon aliasing , part 2

Marcus Meissner marcus at jet.franken.de
Thu Nov 21 15:59:53 CST 2002


Hi,

Changelog:
	Handle the COORD <-> DWORD conversion the canonical way.

Index: include/wincon.h
===================================================================
RCS file: /home/wine/wine/include/wincon.h,v
retrieving revision 1.17
diff -u -u -r1.17 wincon.h
--- include/wincon.h	18 Nov 2002 19:48:56 -0000	1.17
+++ include/wincon.h	21 Nov 2002 21:58:24 -0000
@@ -180,12 +180,12 @@
 
 inline static COORD __wine_GetLargestConsoleWindowSize_wrapper(HANDLE h)
 {
-    COORD c;
-    DWORD dw = GetLargestConsoleWindowSize(h);
-
-    c.X = LOWORD(dw);
-    c.Y = HIWORD(dw);
-    return c;
+    union {
+      COORD c;
+      DWORD dw;
+    } u;
+    u.dw = GetLargestConsoleWindowSize(h);
+    return u.c;
 }
 #define GetLargestConsoleWindowSize(h) __wine_GetLargestConsoleWindowSize_wrapper(h)
 
Index: dlls/kernel/console.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/console.c,v
retrieving revision 1.10
diff -u -u -r1.10 console.c
--- dlls/kernel/console.c	25 Oct 2002 21:02:30 -0000	1.10
+++ dlls/kernel/console.c	21 Nov 2002 21:58:25 -0000
@@ -796,10 +796,13 @@
 #undef GetLargestConsoleWindowSize
 DWORD WINAPI GetLargestConsoleWindowSize(HANDLE hConsoleOutput)
 {
-    COORD c;
-    c.X = 80;
-    c.Y = 24;
-    return *(DWORD *)&c;
+    union {
+	COORD c;
+	DWORD w;
+    } x;
+    x.c.X = 80;
+    x.c.Y = 24;
+    return x.w;
 }
 #endif /* defined(__i386__) */
 



More information about the wine-patches mailing list