From e55404bc8b824f5841b7e5f42bff2867e7f490ab Mon Sep 17 00:00:00 2001 From: nijtmans Date: Mon, 29 Nov 2010 11:25:09 +0000 Subject: Fix various 64-bit gcc(-4.5.2) warnings: cast from pointer to integer of different size --- ChangeLog | 2 ++ win/tkWinWindow.c | 13 ++++++++----- win/tkWinWm.c | 10 +++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8e0f178..6635cdf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ * win/tkWinColor.c * win/tkWinPixmap.c * win/tkWinScrlbr.c + * win/tkWinWindow.c + * win/tkWinWm.c * win/ttkWinMonitor.c * win/tkWin32Dll.c: Make assembler code compile in Win64 with gcc. diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index ea80937..e1ce602 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWindow.c,v 1.21 2010/04/29 15:28:04 nijtmans Exp $ + * RCS: @(#) $Id: tkWinWindow.c,v 1.22 2010/11/29 11:25:09 nijtmans Exp $ */ #include "tkWinInt.h" @@ -213,7 +213,10 @@ TkpScanWindowId( Window *idPtr) /* Place to store converted result. */ { Tk_Window tkwin; - Window number, *numberPtr = &number; + union { + HWND hwnd; + int number; + } win; /* * We want sscanf for the 64-bit check, but if that doesn't work, then @@ -222,13 +225,13 @@ TkpScanWindowId( if ( #ifdef _WIN64 - (sscanf(string, "0x%p", &number) != 1) && + (sscanf(string, "0x%p", &win.hwnd) != 1) && #endif - Tcl_GetInt(interp, string, (int *) numberPtr) != TCL_OK) { + Tcl_GetInt(interp, string, &win.number) != TCL_OK) { return TCL_ERROR; } - tkwin = Tk_HWNDToWindow((HWND) number); + tkwin = Tk_HWNDToWindow(win.hwnd); if (tkwin) { *idPtr = Tk_WindowId(tkwin); } else { diff --git a/win/tkWinWm.c b/win/tkWinWm.c index a20161d..9428444 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinWm.c,v 1.145 2010/10/11 13:33:30 nijtmans Exp $ + * RCS: @(#) $Id: tkWinWm.c,v 1.146 2010/11/29 11:25:09 nijtmans Exp $ */ #include "tkWinInt.h" @@ -1946,7 +1946,7 @@ TkWmNewWindow( wmPtr->x = winPtr->changes.x; wmPtr->y = winPtr->changes.y; wmPtr->crefObj = NULL; - wmPtr->colorref = (COLORREF) NULL; + wmPtr->colorref = (COLORREF) 0; wmPtr->alpha = 1.0; wmPtr->configWidth = -1; @@ -2134,7 +2134,7 @@ UpdateWrapper( wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); - SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (INT_PTR) winPtr); + SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); tsdPtr->createWindow = NULL; if (wmPtr->exStyleConfig & WS_EX_LAYERED) { @@ -2189,7 +2189,7 @@ UpdateWrapper( WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); if (winPtr->flags & TK_EMBEDDED) { - SetWindowLongPtr(child, GWLP_WNDPROC, (INT_PTR) TopLevelProc); + SetWindowLongPtr(child, GWLP_WNDPROC, (LONG_PTR) TopLevelProc); } SetParent(child, wmPtr->wrapper); @@ -2202,7 +2202,7 @@ UpdateWrapper( if (oldWrapper && (oldWrapper != wmPtr->wrapper) && (oldWrapper != GetDesktopWindow())) { - SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) NULL); + SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG_PTR) 0); if (wmPtr->numTransients > 0) { /* -- cgit v0.12