summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-08-16 13:03:43 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-08-16 13:03:43 (GMT)
commit3876ba4df3e26ded567937787afa2068b9815626 (patch)
treec4452046a4a872fb20c9437f5719b664baca41d7 /win
parentaf28c015d3494e872c4094934f33251157662310 (diff)
parent664a327665c85de251423f7a679879e8382041c8 (diff)
downloadtk-3876ba4df3e26ded567937787afa2068b9815626.zip
tk-3876ba4df3e26ded567937787afa2068b9815626.tar.gz
tk-3876ba4df3e26ded567937787afa2068b9815626.tar.bz2
[Bug 3388350] mingw64 compiler warnings
Diffstat (limited to 'win')
-rw-r--r--win/stubs.c4
-rw-r--r--win/tkWinColor.c18
-rw-r--r--win/tkWinDialog.c8
-rw-r--r--win/tkWinEmbed.c16
-rw-r--r--win/tkWinMenu.c8
-rw-r--r--win/tkWinPixmap.c2
-rw-r--r--win/tkWinTest.c18
-rw-r--r--win/tkWinWindow.c2
-rw-r--r--win/tkWinWm.c6
-rw-r--r--win/tkWinX.c12
-rw-r--r--win/ttkWinMonitor.c2
11 files changed, 48 insertions, 48 deletions
diff --git a/win/stubs.c b/win/stubs.c
index 678b176..1138ccb 100644
--- a/win/stubs.c
+++ b/win/stubs.c
@@ -29,7 +29,7 @@ XStringListToTextProperty(
int count,
XTextProperty *text_prop_return)
{
- return (Status) NULL;
+ return (Status) 0;
}
/*
@@ -148,7 +148,7 @@ XGetWMColormapWindows(
Window **windows_return,
int *count_return)
{
- return (Status) NULL;
+ return (Status) 0;
}
int
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index f4181b5..234c736 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.c
@@ -386,13 +386,13 @@ XAllocColor(
color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue);
entryPtr = Tcl_CreateHashEntry(&cmap->refCounts,
- (char *) color->pixel, &new);
+ INT2PTR(color->pixel), &new);
if (new) {
refCount = 1;
} else {
- refCount = ((int) Tcl_GetHashValue(entryPtr)) + 1;
+ refCount = (PTR2INT(Tcl_GetHashValue(entryPtr))) + 1;
}
- Tcl_SetHashValue(entryPtr, (ClientData)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
} else {
/*
* Determine what color will actually be used on non-colormap systems.
@@ -452,11 +452,11 @@ XFreeColors(
*/
for (i = 0; i < npixels; i++) {
- entryPtr = Tcl_FindHashEntry(&cmap->refCounts, (char *) pixels[i]);
+ entryPtr = Tcl_FindHashEntry(&cmap->refCounts, INT2PTR(pixels[i]));
if (!entryPtr) {
Tcl_Panic("Tried to free a color that isn't allocated.");
}
- refCount = (int) Tcl_GetHashValue(entryPtr) - 1;
+ refCount = PTR2INT(Tcl_GetHashValue(entryPtr)) - 1;
if (refCount == 0) {
cref = pixels[i] & 0x00ffffff;
index = GetNearestPaletteIndex(cmap->palette, cref);
@@ -474,7 +474,7 @@ XFreeColors(
}
Tcl_DeleteHashEntry(entryPtr);
} else {
- Tcl_SetHashValue(entryPtr, (ClientData)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
}
}
}
@@ -535,9 +535,9 @@ XCreateColormap(
Tcl_InitHashTable(&cmap->refCounts, TCL_ONE_WORD_KEYS);
for (i = 0; i < logPalettePtr->palNumEntries; i++) {
entryPtr = logPalettePtr->palPalEntry + i;
- hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, (char*) PALETTERGB(
- entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue), &new);
- Tcl_SetHashValue(hashPtr, (ClientData)1);
+ hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB(
+ entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new);
+ Tcl_SetHashValue(hashPtr, INT2PTR(1));
}
return (Colormap)cmap;
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 4110848..de7e84f 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -1032,10 +1032,10 @@ OFNHookProcW(
ofnData->dynFileBuffer = (char *) buffer;
}
- SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, (int) buffer);
+ SendMessageW(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
buffer += dirsize;
- SendMessageW(hdlg, CDM_GETSPEC, selsize, (int) buffer);
+ SendMessageW(hdlg, CDM_GETSPEC, selsize, PTR2INT(buffer));
/*
* If there are multiple files, delete the quotes and change
@@ -1580,9 +1580,9 @@ OFNHookProcA(
ofnData->dynFileBuffer = buffer;
}
- SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (int) buffer);
+ SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, PTR2INT(buffer));
buffer += dirsize;
- SendMessage(hdlg, CDM_GETSPEC, selsize, (int) buffer);
+ SendMessage(hdlg, CDM_GETSPEC, selsize, PTR2INT(buffer));
/*
* If there are multiple files, delete the quotes and change
diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c
index bc86019..b7f5085 100644
--- a/win/tkWinEmbed.c
+++ b/win/tkWinEmbed.c
@@ -259,7 +259,7 @@ TkpUseWindow(
if (Tcl_GetInt(interp, string, &id) != TCL_OK) {
return TCL_ERROR;
}
- hwnd = (HWND) id;
+ hwnd = (HWND) INT2PTR(id);
if ((HWND)winPtr->privatePtr == hwnd) {
return TCL_OK;
}
@@ -279,12 +279,12 @@ TkpUseWindow(
}
id = SendMessage(hwnd, TK_INFO, TK_CONTAINER_VERIFY, 0);
- if (id == (long)hwnd) {
+ if (id == PTR2INT(hwnd)) {
if (!SendMessage(hwnd, TK_INFO, TK_CONTAINER_ISAVAILABLE, 0)) {
Tcl_AppendResult(interp, "The container is already in use", NULL);
return TCL_ERROR;
}
- } else if (id == -(long)hwnd) {
+ } else if (id == -PTR2INT(hwnd)) {
Tcl_AppendResult(interp, "the window to use is not a Tk container",
NULL);
return TCL_ERROR;
@@ -457,7 +457,7 @@ TkWinEmbeddedEventProc(
result = containerPtr->embeddedHWnd == NULL? 1:0;
break;
case TK_CONTAINER_VERIFY:
- result = (long)containerPtr->parentHWnd;
+ result = PTR2INT(containerPtr->parentHWnd);
break;
default:
result = 0;
@@ -495,7 +495,7 @@ TkWinEmbeddedEventProc(
}
containerPtr->embeddedHWnd = (HWND)wParam;
}
- result = (long)containerPtr->parentHWnd;
+ result = PTR2INT(containerPtr->parentHWnd);
} else {
result = 0;
}
@@ -568,14 +568,14 @@ TkWinEmbeddedEventProc(
* returned.
*/
if (topwinPtr) {
- result = (long)GetParent(containerPtr->parentHWnd);
+ result = PTR2INT(GetParent(containerPtr->parentHWnd));
} else {
topwinPtr = containerPtr->parentPtr;
while (!(topwinPtr->flags & TK_TOP_HIERARCHY)) {
topwinPtr = topwinPtr->parentPtr;
}
if (topwinPtr && topwinPtr->window) {
- result = (long)GetParent(Tk_GetHWND(topwinPtr->window));
+ result = PTR2INT(GetParent(Tk_GetHWND(topwinPtr->window)));
} else {
result = 0;
}
@@ -759,7 +759,7 @@ TkWinEmbeddedEventProc(
* Reply the message sender: this is not a Tk container
*/
- return -(long)hwnd;
+ return -PTR2INT(hwnd);
} else {
result = 0;
}
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index 686c47d..3e9abe8 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -440,7 +440,7 @@ TkpDestroyMenuEntry(
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
}
- FreeID((WORD) (UINT) mePtr->platformEntryData);
+ FreeID((WORD) PTR2UINT(mePtr->platformEntryData));
mePtr->platformEntryData = NULL;
}
@@ -629,7 +629,7 @@ ReconfigureWindowsMenu(
flags |= MF_MENUBREAK;
}
- itemID = (UINT) mePtr->platformEntryData;
+ itemID = PTR2UINT(mePtr->platformEntryData);
if ((mePtr->type == CASCADE_ENTRY)
&& (mePtr->childMenuRefPtr != NULL)
&& (mePtr->childMenuRefPtr->menuPtr != NULL)) {
@@ -649,7 +649,7 @@ ReconfigureWindowsMenu(
* If the MF_POPUP flag is set, then the id is interpreted
* as the handle of a submenu.
*/
- itemID = (UINT) childMenuHdl;
+ itemID = PTR2UINT(childMenuHdl);
}
}
if ((menuPtr->menuType == MENUBAR)
@@ -860,7 +860,7 @@ TkpMenuNewEntry(
Tcl_DoWhenIdle(ReconfigureWindowsMenu, (ClientData) menuPtr);
}
- mePtr->platformEntryData = (TkMenuPlatformEntryData) (UINT) commandID;
+ mePtr->platformEntryData = (TkMenuPlatformEntryData) UINT2PTR(commandID);
return TCL_OK;
}
diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c
index 8eff2c5..51f0f59 100644
--- a/win/tkWinPixmap.c
+++ b/win/tkWinPixmap.c
@@ -59,7 +59,7 @@ Tk_GetPixmap(
screen = &display->screens[0];
planes = 1;
if (depth == screen->root_depth) {
- planes = (int) screen->ext_data;
+ planes = PTR2INT(screen->ext_data);
depth /= planes;
}
newTwdPtr->bitmap.handle =
diff --git a/win/tkWinTest.c b/win/tkWinTest.c
index ed2e3e5..d361ad7 100644
--- a/win/tkWinTest.c
+++ b/win/tkWinTest.c
@@ -273,7 +273,7 @@ TestwineventCmd(
return TCL_ERROR;
}
- hwnd = (HWND) strtol(argv[1], &rest, 0);
+ hwnd = (HWND) INT2PTR(strtol(argv[1], &rest, 0));
if (rest == argv[1]) {
hwnd = FindWindow(NULL, argv[1]);
if (hwnd == NULL) {
@@ -390,7 +390,7 @@ TestfindwindowObjCmd(
AppendSystemError(interp, GetLastError());
r = TCL_ERROR;
} else {
- Tcl_SetObjResult(interp, Tcl_NewLongObj((long)hwnd));
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(PTR2INT(hwnd)));
}
return r;
@@ -400,7 +400,7 @@ static BOOL CALLBACK
EnumChildrenProc(HWND hwnd, LPARAM lParam)
{
Tcl_Obj *listObj = (Tcl_Obj *)lParam;
- Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj((long)hwnd));
+ Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewLongObj(PTR2INT(hwnd)));
return TRUE;
}
@@ -426,10 +426,10 @@ TestgetwindowinfoObjCmd(
return TCL_ERROR;
if (tkWinProcs->useWide) {
- cch = GetClassNameW((HWND)hwnd, (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
+ cch = GetClassNameW(INT2PTR(hwnd), (LPWSTR)buf, sizeof(buf)/sizeof(WCHAR));
classObj = Tcl_NewUnicodeObj((LPWSTR)buf, cch);
} else {
- cch = GetClassNameA((HWND)hwnd, (LPSTR)buf, sizeof(buf));
+ cch = GetClassNameA(INT2PTR(hwnd), (LPSTR)buf, sizeof(buf));
classObj = Tcl_NewStringObj((LPSTR)buf, cch);
}
if (cch == 0) {
@@ -444,9 +444,9 @@ TestgetwindowinfoObjCmd(
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("id", -1));
Tcl_ListObjAppendElement(interp, resObj,
- Tcl_NewLongObj(GetWindowLong((HWND)hwnd, GWL_ID)));
+ Tcl_NewLongObj(GetWindowLong(INT2PTR(hwnd), GWL_ID)));
- cch = tkWinProcs->getWindowText((HWND)hwnd, (LPTSTR)buf, cchBuf);
+ cch = tkWinProcs->getWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
if (tkWinProcs->useWide) {
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
} else {
@@ -457,10 +457,10 @@ TestgetwindowinfoObjCmd(
Tcl_ListObjAppendElement(interp, resObj, textObj);
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("parent", -1));
Tcl_ListObjAppendElement(interp, resObj,
- Tcl_NewLongObj((long)GetParent((HWND)hwnd)));
+ Tcl_NewLongObj(PTR2INT(GetParent(INT2PTR(hwnd)))));
childrenObj = Tcl_NewListObj(0, NULL);
- EnumChildWindows((HWND)hwnd, EnumChildrenProc, (LPARAM)childrenObj);
+ EnumChildWindows(INT2PTR(hwnd), EnumChildrenProc, (LPARAM)childrenObj);
Tcl_ListObjAppendElement(interp, resObj, Tcl_NewStringObj("children", -1));
Tcl_ListObjAppendElement(interp, resObj, childrenObj);
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 83fa033..43ff0aa 100644
--- a/win/tkWinWindow.c
+++ b/win/tkWinWindow.c
@@ -209,7 +209,7 @@ TkpScanWindowId(
Window *idPtr) /* Place to store converted result. */
{
Tk_Window tkwin;
- Window number, *numberPtr = &number;
+ void *number, *numberPtr = &number;
/*
* We want sscanf for the 64-bit check, but if that doesn't work, then
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index b3af26a..23f496a 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -2002,7 +2002,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;
@@ -2261,7 +2261,7 @@ UpdateWrapper(
if (oldWrapper && (oldWrapper != wmPtr->wrapper)
&& (oldWrapper != GetDesktopWindow())) {
- SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) NULL);
+ SetWindowLongPtr(oldWrapper, GWLP_USERDATA, (LONG) 0);
if (wmPtr->numTransients > 0) {
/*
@@ -3755,7 +3755,7 @@ WmFrameCmd(
if (hwnd == NULL) {
hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr));
}
- sprintf(buf, "0x%x", (unsigned int) hwnd);
+ sprintf(buf, "0x%x", PTR2UINT(hwnd));
Tcl_SetResult(interp, buf, TCL_VOLATILE);
return TCL_OK;
}
diff --git a/win/tkWinX.c b/win/tkWinX.c
index 288da26..2d5f5f5 100644
--- a/win/tkWinX.c
+++ b/win/tkWinX.c
@@ -296,10 +296,10 @@ TkWinXInit(
* Initialize input language info
*/
- if (GetLocaleInfo(LANGIDFROMLCID((DWORD)GetKeyboardLayout(0)),
+ if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))),
LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(LPTSTR) &lpCP, sizeof(lpCP)/sizeof(TCHAR))
- && TranslateCharsetInfo((DWORD *)lpCP, &lpCs, TCI_SRCCODEPAGE)) {
+ && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) {
UpdateInputLanguage((int) lpCs.ciCharset);
}
@@ -519,8 +519,8 @@ TkWinDisplayChanged(
* the HWND and we'll just get blank spots copied onto the screen.
*/
- screen->ext_data = (XExtData *) GetDeviceCaps(dc, PLANES);
- screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * (int) screen->ext_data;
+ screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES));
+ screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data);
if (screen->root_visual != NULL) {
ckfree((char *) screen->root_visual);
@@ -1452,7 +1452,7 @@ UpdateInputLanguage(
if (keyInputCharset == charset) {
return;
}
- if (TranslateCharsetInfo((DWORD*)charset, &charsetInfo,
+ if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo,
TCI_SRCCHARSET) == 0) {
/*
* Some mysterious failure.
@@ -1995,7 +1995,7 @@ Tk_ResetUserInactiveTime(
inp.mi.mouseData = 0;
inp.mi.dwFlags = MOUSEEVENTF_MOVE;
inp.mi.time = 0;
- inp.mi.dwExtraInfo = (DWORD) NULL;
+ inp.mi.dwExtraInfo = (DWORD) 0;
SendInput(1, &inp, sizeof(inp));
}
diff --git a/win/ttkWinMonitor.c b/win/ttkWinMonitor.c
index fda8304..25c9c0c 100644
--- a/win/ttkWinMonitor.c
+++ b/win/ttkWinMonitor.c
@@ -92,7 +92,7 @@ CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp)
hwnd = CreateWindow( name, title, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hinst, NULL );
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG)interp);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)interp);
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
}