DSTRICT: cast1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

this fixes some casts between pointer and intergers of different size.

License: LGPL, X11
Changelog:
	Michael Stefaniuc <mstefani@redhat.com>
	- silence some warnings due to casts between pointer and
	  intergers of different size

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
System Administration           Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani@redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
Index: controls/menu.c
===================================================================
RCS file: /home/wine/wine/controls/menu.c,v
retrieving revision 1.149
diff -u -u -r1.149 menu.c
--- controls/menu.c	17 Oct 2002 16:43:44 -0000	1.149
+++ controls/menu.c	18 Oct 2002 21:17:53 -0000
@@ -295,7 +295,7 @@
  */
 static POPUPMENU *MENU_GetMenu(HMENU hMenu)
 {
-    POPUPMENU *menu = USER_HEAP_LIN_ADDR(hMenu);
+    POPUPMENU *menu = USER_HEAP_LIN_ADDR(HMENU_16(hMenu));
     if (!menu || menu->wMagic != MENU_MAGIC)
     {
         WARN("invalid menu handle=%x, ptr=%p, magic=%x\n", hMenu, menu, menu? menu->wMagic:0);
@@ -663,7 +663,7 @@
 static UINT MENU_FindItemByKey( HWND hwndOwner, HMENU hmenu,
 				  UINT key, BOOL forceMenuChar )
 {
-    TRACE("\tlooking for '%c' in [%04x]\n", (char)key, (UINT16)hmenu );
+    TRACE("\tlooking for '%c' in [%04x]\n", (char)key, HMENU_16(hmenu) );
 
     if (!IsMenu( hmenu )) hmenu = GetSubMenu( get_win_sys_menu(hwndOwner), 0);
 
@@ -1788,7 +1788,7 @@
         }
     }
     else if (IS_BITMAP_ITEM(flags))
-        item->text = (LPWSTR)(HBITMAP)LOWORD(str);
+        item->text = (LPWSTR)HBITMAP_32(LOWORD(str));
     else item->text = NULL;
 
     if (flags & MF_OWNERDRAW)
@@ -3827,8 +3827,8 @@
 {
     HMENU hMenu;
     LPPOPUPMENU menu;
-    if (!(hMenu = USER_HEAP_ALLOC( sizeof(POPUPMENU) ))) return 0;
-    menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(hMenu);
+    if (!(hMenu = HMENU_32(USER_HEAP_ALLOC( sizeof(POPUPMENU) )))) return 0;
+    menu = (LPPOPUPMENU) USER_HEAP_LIN_ADDR(HMENU_16(hMenu));
 
     ZeroMemory(menu, sizeof(POPUPMENU));
     menu->wMagic = MENU_MAGIC;
@@ -4433,7 +4433,7 @@
     if (lpmii->fMask & MIIM_SUBMENU) {
 	menu->hSubMenu = lpmii->hSubMenu;
 	if (menu->hSubMenu) {
-	    POPUPMENU *subMenu = MENU_GetMenu((UINT16)menu->hSubMenu);
+	    POPUPMENU *subMenu = MENU_GetMenu(menu->hSubMenu);
 	    if (subMenu) {
 		subMenu->wFlags |= MF_POPUP;
 		menu->fType |= MF_POPUP;
Index: dlls/shell32/shell.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell.c,v
retrieving revision 1.47
diff -u -u -r1.47 shell.c
--- dlls/shell32/shell.c	17 Oct 2002 16:43:44 -0000	1.47
+++ dlls/shell32/shell.c	18 Oct 2002 21:17:55 -0000
@@ -190,7 +190,7 @@
  */
 HINSTANCE16 WINAPI FindExecutable16( LPCSTR lpFile, LPCSTR lpDirectory,
                                      LPSTR lpResult )
-{ return (HINSTANCE16)FindExecutableA( lpFile, lpDirectory, lpResult );
+{ return HINSTANCE_16(FindExecutableA( lpFile, lpDirectory, lpResult ));
 }
 
 
@@ -237,9 +237,9 @@
 
 	if (hFile == HFILE_ERROR)
 	{ /* not found - load from builtin module if available */
-	  HINSTANCE hInst = (HINSTANCE)LoadLibrary16(lpszExeFileName);
+	  HINSTANCE hInst = HINSTANCE_32(LoadLibrary16(lpszExeFileName));
 
-	  if (hInst < 32) /* hmm, no Win16 module - try Win32 :-) */
+	  if (hInst < (HINSTANCE) 32) /* hmm, no Win16 module - try Win32 :-) */
 	    hInst = LoadLibraryA(lpszExeFileName);
 	  if (hInst)
 	  {
Index: dlls/shell32/shell32_main.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v
retrieving revision 1.54
diff -u -u -r1.54 shell32_main.h
--- dlls/shell32/shell32_main.h	17 Oct 2002 16:43:44 -0000	1.54
+++ dlls/shell32/shell32_main.h	18 Oct 2002 21:17:55 -0000
@@ -199,6 +199,7 @@
 /* handle conversions */
 #define HICON_16(h32)		(LOWORD(h32))
 #define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+#define HINSTANCE_16(h32)	(LOWORD(h32))
 #define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
 
 #endif
Index: dlls/user/text.c
===================================================================
RCS file: /home/wine/wine/dlls/user/text.c,v
retrieving revision 1.38
diff -u -u -r1.38 text.c
--- dlls/user/text.c	10 Jun 2002 22:47:58 -0000	1.38
+++ dlls/user/text.c	18 Oct 2002 21:17:56 -0000
@@ -37,6 +37,7 @@
 #include "winbase.h"
 #include "winerror.h"
 #include "winnls.h"
+#include "wownt32.h"
 #include "user.h"
 #include "wine/debug.h"
 
@@ -1176,7 +1177,7 @@
         if(_32bit)
             retval = fn(memdc, lp, slen);
         else
-            retval = (BOOL)((BOOL16)((GRAYSTRINGPROC16)fn)((HDC16)memdc, lp, (INT16)slen));
+            retval = (BOOL)((BOOL16)((GRAYSTRINGPROC16)fn)(HDC_16(memdc), lp, (INT16)slen));
     }
     else
     {
Index: dlls/user/dde/client.c
===================================================================
RCS file: /home/wine/wine/dlls/user/dde/client.c,v
retrieving revision 1.9
diff -u -u -r1.9 client.c
--- dlls/user/dde/client.c	4 Sep 2002 19:37:01 -0000	1.9
+++ dlls/user/dde/client.c	18 Oct 2002 21:17:57 -0000
@@ -688,7 +688,7 @@
     }
 
     WDML_ExtractAck(uiLo, &ddeAck);
-    pXAct->hDdeData = (HDDEDATA)ddeAck.fAck;
+    pXAct->hDdeData = (HDDEDATA)(UINT_PTR)ddeAck.fAck;
 
     return WDML_QS_HANDLED;
 }
Index: dlls/winsock/async.c
===================================================================
RCS file: /home/wine/wine/dlls/winsock/async.c,v
retrieving revision 1.27
diff -u -u -r1.27 async.c
--- dlls/winsock/async.c	17 Oct 2002 16:43:43 -0000	1.27
+++ dlls/winsock/async.c	18 Oct 2002 21:17:57 -0000
@@ -111,6 +111,9 @@
 WINE_DEFAULT_DEBUG_CHANNEL(winsock);
 
 
+/* handle16 --> handle conversions */
+#define HANDLE_32(h16)		((HANDLE)(ULONG_PTR)(h16))
+
 /* critical section to protect some non-rentrant net function */
 CRITICAL_SECTION csWSgetXXXbyYYY = CRITICAL_SECTION_INIT("csWSgetXXXbyYYY");
 
@@ -723,7 +726,7 @@
  */
 INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle)
 {
-    return (HANDLE16)WSACancelAsyncRequest((HANDLE)hAsyncTaskHandle);
+    return (INT16)WSACancelAsyncRequest(HANDLE_32(hAsyncTaskHandle));
 }
 
 /***********************************************************************
Index: include/user.h
===================================================================
RCS file: /home/wine/wine/include/user.h,v
retrieving revision 1.45
diff -u -u -r1.45 user.h
--- include/user.h	18 Oct 2002 04:05:49 -0000	1.45
+++ include/user.h	18 Oct 2002 21:17:57 -0000
@@ -145,10 +145,12 @@
 extern DWORD USER16_AlertableWait;
 
 /* HANDLE16 <-> HANDLE conversions */
-#define HCURSOR_16(h32) (LOWORD(h32))
-#define HICON_16(h32)   (LOWORD(h32))
+#define HCURSOR_16(h32)		(LOWORD(h32))
+#define HICON_16(h32)		(LOWORD(h32))
+#define HINSTANCE_16(h32)	(LOWORD(h32))
 
-#define HCURSOR_32(h16) ((HCURSOR)(ULONG_PTR)(h16))
-#define HICON_32(h16)   ((HICON)(ULONG_PTR)(h16))
+#define HCURSOR_32(h16)		((HCURSOR)(ULONG_PTR)(h16))
+#define HICON_32(h16)		((HICON)(ULONG_PTR)(h16))
+#define HINSTANCE_32(h16)	((HINSTANCE)(ULONG_PTR)(h16))
 
 #endif  /* __WINE_USER_H */
Index: loader/task.c
===================================================================
RCS file: /home/wine/wine/loader/task.c,v
retrieving revision 1.125
diff -u -u -r1.125 task.c
--- loader/task.c	24 Sep 2002 18:29:39 -0000	1.125
+++ loader/task.c	18 Oct 2002 21:17:59 -0000
@@ -66,6 +66,10 @@
 #define hFirstTask   (pThhook->HeadTDB)
 #define hLockedTask  (pThhook->LockTDB)
 
+/* handle <--> handle16 conversions */
+#define HANDLE_16(h32)		(LOWORD(h32))
+#define HANDLE_32(h16)		((HANDLE)(ULONG_PTR)(h16))
+
 static UINT16 nTaskCount = 0;
 
 static HTASK16 initial_task;
@@ -1054,7 +1058,7 @@
     else if ( IsTask16( (HTASK16)thread ) )
         teb = (TASK_GetPtr( (HANDLE16)thread ))->teb;
 
-    if ( teb ) teb->queue = (HQUEUE16) hQueue;
+    if ( teb ) teb->queue = HANDLE_16(hQueue);
 }
 
 /***********************************************************************
@@ -1062,7 +1066,7 @@
  */
 HANDLE WINAPI GetFastQueue16( void )
 {
-    HANDLE ret = (HANDLE)NtCurrentTeb()->queue;
+    HANDLE ret = HANDLE_32(NtCurrentTeb()->queue);
 
     if (!ret) FIXME("(): should initialize thread-local queue, expect failure!\n" );
     return ret;
Index: windows/class.c
===================================================================
RCS file: /home/wine/wine/windows/class.c,v
retrieving revision 1.51
diff -u -u -r1.51 class.c
--- windows/class.c	17 Oct 2002 16:43:42 -0000	1.51
+++ windows/class.c	18 Oct 2002 21:18:00 -0000
@@ -1125,7 +1125,7 @@
     wc->lpfnWndProc   = CLASS_GetProc( classPtr, WIN_PROC_16 );
     wc->cbClsExtra    = (INT16)classPtr->cbClsExtra;
     wc->cbWndExtra    = (INT16)classPtr->cbWndExtra;
-    wc->hInstance     = classPtr->style & CS_GLOBALCLASS ? GetModuleHandle16("USER") : (HINSTANCE16)classPtr->hInstance;
+    wc->hInstance     = classPtr->style & CS_GLOBALCLASS ? GetModuleHandle16("USER") : HINSTANCE_16(classPtr->hInstance);
     wc->hIcon         = HICON_16(classPtr->hIcon);
     wc->hCursor       = HCURSOR_16(classPtr->hCursor);
     wc->hbrBackground = HBRUSH_16(classPtr->hbrBackground);
@@ -1234,7 +1234,7 @@
     wc->lpfnWndProc   = CLASS_GetProc( classPtr, WIN_PROC_16 );
     wc->cbClsExtra    = (INT16)classPtr->cbClsExtra;
     wc->cbWndExtra    = (INT16)classPtr->cbWndExtra;
-    wc->hInstance     = (HINSTANCE16)classPtr->hInstance;
+    wc->hInstance     = HINSTANCE_16(classPtr->hInstance);
     wc->hIcon         = HICON_16(classPtr->hIcon);
     wc->hIconSm       = HICON_16(classPtr->hIconSm);
     wc->hCursor       = HCURSOR_16(classPtr->hCursor);
Index: windows/dialog.c
===================================================================
RCS file: /home/wine/wine/windows/dialog.c,v
retrieving revision 1.107
diff -u -u -r1.107 dialog.c
--- windows/dialog.c	17 Oct 2002 16:43:42 -0000	1.107
+++ windows/dialog.c	18 Oct 2002 21:18:01 -0000
@@ -443,7 +443,7 @@
                 }
                 instance = dlgInfo->hDialogHeap;
             }
-            else instance = (HINSTANCE16)hInst;
+            else instance = HINSTANCE_16(hInst);
 
             segptr = MapLS( info.data );
             hwndCtrl = WIN_Handle32( CreateWindowEx16( info.exStyle | WS_EX_NOPARENTNOTIFY,
Index: windows/struct32.c
===================================================================
RCS file: /home/wine/wine/windows/struct32.c,v
retrieving revision 1.6
diff -u -u -r1.6 struct32.c
--- windows/struct32.c	17 Oct 2002 16:43:42 -0000	1.6
+++ windows/struct32.c	18 Oct 2002 21:18:01 -0000
@@ -19,6 +19,7 @@
  */
 
 #include "struct32.h"
+#include "user.h"
 #include "wownt32.h"
 #include "win.h"
 #include "winerror.h"
@@ -91,8 +92,8 @@
                                    CREATESTRUCT16* to )
 {
     to->lpCreateParams = from->lpCreateParams;
-    to->hInstance      = (HINSTANCE16)from->hInstance;
-    to->hMenu          = (HMENU16)from->hMenu;
+    to->hInstance      = HINSTANCE_16(from->hInstance);
+    to->hMenu          = HMENU_16(from->hMenu);
     to->hwndParent     = HWND_16(from->hwndParent);
     to->cy             = from->cy;
     to->cx             = from->cx;
@@ -106,8 +107,8 @@
                                    CREATESTRUCTA *to )
 {
     to->lpCreateParams = from->lpCreateParams;
-    to->hInstance      = (HINSTANCE)from->hInstance;
-    to->hMenu          = (HMENU)from->hMenu;
+    to->hInstance      = HINSTANCE_32(from->hInstance);
+    to->hMenu          = HMENU_32(from->hMenu);
     to->hwndParent     = WIN_Handle32(from->hwndParent);
     to->cy             = from->cy;
     to->cx             = from->cx;
@@ -121,7 +122,7 @@
 void STRUCT32_MDICREATESTRUCT32Ato16( const MDICREATESTRUCTA* from,
                                       MDICREATESTRUCT16* to )
 {
-    to->hOwner = (HINSTANCE16)from->hOwner;
+    to->hOwner = HINSTANCE_16(from->hOwner);
     to->x      = from->x;
     to->y      = from->y;
     to->cx     = from->cx;
@@ -133,7 +134,7 @@
 void STRUCT32_MDICREATESTRUCT16to32A( const MDICREATESTRUCT16* from,
                                       MDICREATESTRUCTA *to )
 {
-    to->hOwner = (HINSTANCE)from->hOwner;
+    to->hOwner = HINSTANCE_32(from->hOwner);
     to->x      = from->x;
     to->y      = from->y;
     to->cx     = from->cx;
Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.199
diff -u -u -r1.199 win.c
--- windows/win.c	17 Oct 2002 18:21:29 -0000	1.199
+++ windows/win.c	18 Oct 2002 21:18:02 -0000
@@ -1255,8 +1255,8 @@
     /* Create the window */
 
     cs.lpCreateParams = data;
-    cs.hInstance      = (HINSTANCE)instance;
-    cs.hMenu          = (HMENU)menu;
+    cs.hInstance      = HINSTANCE_32(instance);
+    cs.hMenu          = HMENU_32(menu);
     cs.hwndParent     = WIN_Handle32( parent );
     cs.style          = style;
     cs.lpszName       = windowName;
@@ -3084,7 +3084,7 @@
         {
             HDC hDC = GetDC(hWnd);
 
-            if (!SendMessageW( hWnd, WM_ERASEBKGND, (WPARAM16)hDC, 0 ))
+            if (!SendMessageW( hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0 ))
                 wndPtr->flags |= WIN_NEEDS_ERASEBKGND;
 
             ReleaseDC( hWnd, hDC );
Index: windows/winpos.c
===================================================================
RCS file: /home/wine/wine/windows/winpos.c,v
retrieving revision 1.137
diff -u -u -r1.137 winpos.c
--- windows/winpos.c	11 Oct 2002 23:41:07 -0000	1.137
+++ windows/winpos.c	18 Oct 2002 21:18:03 -0000
@@ -29,6 +29,7 @@
 #include "controls.h"
 #include "user.h"
 #include "win.h"
+#include "wownt32.h"
 #include "hook.h"
 #include "message.h"
 #include "queue.h"
@@ -1222,7 +1223,7 @@
 
     handle = USER_HEAP_ALLOC( sizeof(DWP) + (count-1)*sizeof(WINDOWPOS) );
     if (!handle) return 0;
-    pDWP = (DWP *) USER_HEAP_LIN_ADDR( handle );
+    pDWP = (DWP *) USER_HEAP_LIN_ADDR(HDWP_16(handle));
     pDWP->actualCount    = 0;
     pDWP->suggestedCount = count;
     pDWP->valid          = TRUE;
@@ -1246,7 +1247,7 @@
     hwnd = WIN_GetFullHandle( hwnd );
     if (hwnd == GetDesktopWindow()) return 0;
 
-    if (!(pDWP = USER_HEAP_LIN_ADDR( hdwp ))) return 0;
+    if (!(pDWP = USER_HEAP_LIN_ADDR(HDWP_16(hdwp)))) return 0;
 
     USER_Lock();
 
@@ -1288,7 +1289,7 @@
             retvalue = 0;
             goto END;
         }
-        pDWP = (DWP *) USER_HEAP_LIN_ADDR( newhdwp );
+        pDWP = (DWP *) USER_HEAP_LIN_ADDR(HDWP_16(newhdwp));
         pDWP->suggestedCount++;
     }
     pDWP->winPos[pDWP->actualCount].hwnd = hwnd;
@@ -1316,7 +1317,7 @@
     BOOL res = TRUE;
     int i;
 
-    pDWP = (DWP *) USER_HEAP_LIN_ADDR( hdwp );
+    pDWP = (DWP *) USER_HEAP_LIN_ADDR(HDWP_16(hdwp));
     if (!pDWP) return FALSE;
     for (i = 0, winpos = pDWP->winPos; i < pDWP->actualCount; i++, winpos++)
     {
Index: windows/winproc.c
===================================================================
RCS file: /home/wine/wine/windows/winproc.c,v
retrieving revision 1.93
diff -u -u -r1.93 winproc.c
--- windows/winproc.c	17 Oct 2002 18:26:53 -0000	1.93
+++ windows/winproc.c	18 Oct 2002 21:18:04 -0000
@@ -1124,7 +1124,7 @@
     case WM_CTLCOLOR:
     	if ( HIWORD(*plparam) > CTLCOLOR_STATIC ) return -1;
         *pmsg32    = WM_CTLCOLORMSGBOX + HIWORD(*plparam);
-        *pwparam32 = (WPARAM)(HDC)wParam16;
+        *pwparam32 = (WPARAM)HDC_32(wParam16);
         *plparam   = (LPARAM)WIN_Handle32( LOWORD(*plparam) );
         return 0;
     case WM_COMPAREITEM:
@@ -1185,7 +1185,7 @@
             dis->itemID     = dis16->itemID;
             dis->itemAction = dis16->itemAction;
             dis->itemState  = dis16->itemState;
-            dis->hwndItem   = (dis->CtlType == ODT_MENU) ? (HWND)(HMENU)dis16->hwndItem
+            dis->hwndItem   = (dis->CtlType == ODT_MENU) ? (HWND)HMENU_32(dis16->hwndItem)
                                                          : WIN_Handle32( dis16->hwndItem );
             dis->hDC        = dis16->hDC;
             dis->itemData   = dis16->itemData;
@@ -1229,23 +1229,23 @@
     case WM_MDISETMENU:
         if(wParam16==TRUE)
            *pmsg32=WM_MDIREFRESHMENU;
-        *pwparam32 = (WPARAM)(HMENU)LOWORD(*plparam);
-        *plparam   = (LPARAM)(HMENU)HIWORD(*plparam);
+        *pwparam32 = (WPARAM)HMENU_32(LOWORD(*plparam));
+        *plparam   = (LPARAM)HMENU_32(HIWORD(*plparam));
         return 0;
     case WM_MENUCHAR:
         *pwparam32 = MAKEWPARAM( wParam16, LOWORD(*plparam) );
-        *plparam   = (LPARAM)(HMENU)HIWORD(*plparam);
+        *plparam   = (LPARAM)HMENU_32(HIWORD(*plparam));
         return 0;
     case WM_MENUSELECT:
         if((LOWORD(*plparam) & MF_POPUP) && (LOWORD(*plparam) != 0xFFFF))
         {
-            HMENU hmenu=(HMENU)HIWORD(*plparam);
+            HMENU hmenu=HMENU_32(HIWORD(*plparam));
             UINT Pos=MENU_FindSubMenu( &hmenu, wParam16);
             if(Pos==0xFFFF) Pos=0; /* NO_SELECTED_ITEM */
             *pwparam32 = MAKEWPARAM( Pos, LOWORD(*plparam) );
         }
         else *pwparam32 = MAKEWPARAM( wParam16, LOWORD(*plparam) );
-        *plparam   = (LPARAM)(HMENU)HIWORD(*plparam);
+        *plparam   = (LPARAM)HMENU_32(HIWORD(*plparam));
         return 0;
     case WM_MDIACTIVATE:
 	if( *plparam )
@@ -1517,7 +1517,7 @@
     case WM_NEXTMENU:
         {
             MDINEXTMENU *next = (MDINEXTMENU *)lParam;
-            result = MAKELONG( next->hmenuNext, HWND_16(next->hwndNext) );
+            result = MAKELONG( HMENU_16(next->hmenuNext), HWND_16(next->hwndNext) );
             HeapFree( GetProcessHeap(), 0, next );
         }
         break;
@@ -1614,7 +1614,7 @@
         ch = wParam16;
         MultiByteToWideChar( CP_ACP, 0, &ch, 1, &wch, 1);
         *pwparam32 = MAKEWPARAM( wch, LOWORD(*plparam) );
-        *plparam   = (LPARAM)(HMENU)HIWORD(*plparam);
+        *plparam   = (LPARAM)HMENU_32(HIWORD(*plparam));
         return 0;
     case WM_CHAR:
     case WM_DEADCHAR:
@@ -1951,7 +1951,7 @@
             dis->itemAction = (UINT16)dis32->itemAction;
             dis->itemState  = (UINT16)dis32->itemState;
             dis->hwndItem   = HWND_16( dis32->hwndItem );
-            dis->hDC        = (HDC16)dis32->hDC;
+            dis->hDC        = HDC_16(dis32->hDC);
             dis->itemData   = dis32->itemData;
             CONV_RECT32TO16( &dis32->rcItem, &dis->rcItem );
             *plparam = MapLS( dis );

Attachment: pgp00056.pgp
Description: PGP signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux