summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authornijtmans <nijtmans>2009-01-28 20:47:49 (GMT)
committernijtmans <nijtmans>2009-01-28 20:47:49 (GMT)
commit53f95f2d8f73b96fbd4dac1a784ce90eb133c0a1 (patch)
treefdebc2108b277faed42ddafa5e7633fc51b503ec /win
parent8faa6f4e39faa11f5f8363f8ce53550991b95d3f (diff)
downloadtk-53f95f2d8f73b96fbd4dac1a784ce90eb133c0a1.zip
tk-53f95f2d8f73b96fbd4dac1a784ce90eb133c0a1.tar.gz
tk-53f95f2d8f73b96fbd4dac1a784ce90eb133c0a1.tar.bz2
- eliminate some unnessary type casts
- some internal const decorations - spacing
Diffstat (limited to 'win')
-rw-r--r--win/tkWinColor.c8
-rw-r--r--win/tkWinDialog.c20
-rw-r--r--win/tkWinFont.c6
-rw-r--r--win/tkWinMenu.c24
-rw-r--r--win/tkWinSend.c4
-rw-r--r--win/tkWinWindow.c4
-rw-r--r--win/tkWinWm.c47
7 files changed, 56 insertions, 57 deletions
diff --git a/win/tkWinColor.c b/win/tkWinColor.c
index 2d68384..e0d763f 100644
--- a/win/tkWinColor.c
+++ b/win/tkWinColor.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: tkWinColor.c,v 1.12 2008/10/17 23:18:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinColor.c,v 1.13 2009/01/28 20:47:49 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -394,7 +394,7 @@ XAllocColor(
} else {
refCount = ((int) 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.
@@ -476,7 +476,7 @@ XFreeColors(
}
Tcl_DeleteHashEntry(entryPtr);
} else {
- Tcl_SetHashValue(entryPtr, (ClientData)refCount);
+ Tcl_SetHashValue(entryPtr, INT2PTR(refCount));
}
}
}
@@ -539,7 +539,7 @@ XCreateColormap(
entryPtr = logPalettePtr->palPalEntry + i;
hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, (char*) PALETTERGB(
entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue), &new);
- Tcl_SetHashValue(hashPtr, (ClientData)1);
+ Tcl_SetHashValue(hashPtr, INT2PTR(1));
}
return (Colormap)cmap;
diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c
index 3f422f2..4b75595 100644
--- a/win/tkWinDialog.c
+++ b/win/tkWinDialog.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinDialog.c,v 1.60 2009/01/06 01:26:26 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinDialog.c,v 1.61 2009/01/28 20:47:49 nijtmans Exp $
*
*/
@@ -338,7 +338,7 @@ Tk_ChooseColorObjCmd(
for (i = 1; i < objc; i += 2) {
int index;
- char *string;
+ const char *string;
Tcl_Obj *optionPtr, *valuePtr;
optionPtr = objv[i];
@@ -570,7 +570,7 @@ GetFileNameW(
OPENFILENAMEW ofn;
WCHAR file[TK_MULTI_MAX_PATH];
int filterIndex, result, winCode, oldMode, i, multi = 0;
- char *extension, *filter, *title;
+ const char *extension, *filter, *title;
Tk_Window tkwin;
HWND hWnd;
Tcl_Obj *filterObj, *initialTypeObj, *typeVariableObj;
@@ -619,7 +619,7 @@ GetFileNameW(
for (i = 1; i < objc; i += 2) {
int index;
- char *string;
+ const char *string;
Tcl_Obj *optionPtr, *valuePtr;
optionPtr = objv[i];
@@ -1015,7 +1015,7 @@ GetFileNameA(
OPENFILENAME ofn;
TCHAR file[TK_MULTI_MAX_PATH], savePath[MAX_PATH];
int filterIndex, result, winCode, oldMode, i, multi = 0;
- char *extension, *filter, *title;
+ const char *extension, *filter, *title;
Tk_Window tkwin;
HWND hWnd;
Tcl_Obj *filterObj, *initialTypeObj, *typeVariableObj;
@@ -1063,7 +1063,7 @@ GetFileNameA(
for (i = 1; i < objc; i += 2) {
int index;
- char *string;
+ const char *string;
Tcl_Obj *optionPtr, *valuePtr;
optionPtr = objv[i];
@@ -1467,7 +1467,7 @@ MakeFilter(
{
char *filterStr;
char *p;
- char *initial = NULL;
+ const char *initial = NULL;
int pass;
int ix = 0; /* index counter */
FileFilterList flist;
@@ -1687,7 +1687,7 @@ Tk_ChooseDirectoryObjCmd(
Tk_Window tkwin;
HWND hWnd;
- char *utfTitle; /* Title for window */
+ const char *utfTitle; /* Title for window */
TCHAR saveDir[MAX_PATH];
Tcl_DString titleString; /* UTF Title */
Tcl_DString initDirString; /* Initial directory */
@@ -1717,7 +1717,7 @@ Tk_ChooseDirectoryObjCmd(
for (i = 1; i < objc; i += 2) {
int index;
- char *string;
+ const char *string;
Tcl_Obj *optionPtr, *valuePtr;
optionPtr = objv[i];
@@ -2090,7 +2090,7 @@ Tk_MessageBoxObjCmd(
for (i = 1; i < objc; i += 2) {
int index;
- char *string;
+ const char *string;
Tcl_Obj *optionPtr, *valuePtr;
optionPtr = objv[i];
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 9fa4963..a1ef63a 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.45 2008/11/22 20:05:32 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.46 2009/01/28 20:47:49 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -2363,7 +2363,7 @@ SeenName(
}
seen += strlen(seen) + 1;
}
- Tcl_DStringAppend(dsPtr, (char *) name, (int) (strlen(name) + 1));
+ Tcl_DStringAppend(dsPtr, name, (int) (strlen(name) + 1));
return 0;
}
@@ -2615,7 +2615,7 @@ FamilyOrAliasExists(
int i;
if (FamilyExists(hdc, faceName) != 0) {
- return (char *) faceName;
+ return faceName;
}
aliases = TkFontGetAliasList(faceName);
if (aliases != NULL) {
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c
index ac92b44..aa3e046 100644
--- a/win/tkWinMenu.c
+++ b/win/tkWinMenu.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinMenu.c,v 1.62 2008/12/09 21:22:56 dgp Exp $
+ * RCS: @(#) $Id: tkWinMenu.c,v 1.63 2009/01/28 20:47:49 nijtmans Exp $
*/
#define OEMRESOURCE
@@ -202,7 +202,7 @@ GetNewID(
commandEntryPtr = Tcl_CreateHashEntry(&tsdPtr->commandTable,
((char *) NULL) + curID, &newEntry);
if (newEntry == 1) {
- Tcl_SetHashValue(commandEntryPtr, (char *) mePtr);
+ Tcl_SetHashValue(commandEntryPtr, mePtr);
*menuIDPtr = curID;
tsdPtr->lastCommandID = curID;
return TCL_OK;
@@ -292,7 +292,7 @@ TkpNewMenu(
hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable,
(char *) winMenuHdl, &newEntry);
- Tcl_SetHashValue(hashEntryPtr, (char *) menuPtr);
+ Tcl_SetHashValue(hashEntryPtr, menuPtr);
menuPtr->platformData = (TkMenuPlatformData) winMenuHdl;
return TCL_OK;
@@ -319,7 +319,7 @@ TkpDestroyMenu(
TkMenu *menuPtr) /* The common menu structure */
{
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
- char *searchName;
+ const char *searchName;
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
@@ -1073,7 +1073,7 @@ TkWinHandleMenuEvent(
if ((menuRefPtr != NULL) && (menuRefPtr->parentEntryPtr != NULL)) {
for (parentEntryPtr = menuRefPtr->parentEntryPtr ; ;
parentEntryPtr = parentEntryPtr->nextCascadePtr) {
- char *name = Tcl_GetString(parentEntryPtr->namePtr);
+ const char *name = Tcl_GetString(parentEntryPtr->namePtr);
if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) {
break;
@@ -1356,7 +1356,7 @@ TkpSetWindowMenuBar(
winMenuHdl = CreateMenu();
hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable,
(char *) winMenuHdl, &newEntry);
- Tcl_SetHashValue(hashEntryPtr, (char *) menuPtr);
+ Tcl_SetHashValue(hashEntryPtr, menuPtr);
menuPtr->platformData = (TkMenuPlatformData) winMenuHdl;
TkWinSetMenu(tkwin, winMenuHdl);
if (!(menuPtr->menuFlags & MENU_RECONFIGURE_PENDING)) {
@@ -1465,7 +1465,7 @@ GetMenuAccelGeometry(
} else if (mePtr->accelPtr == NULL) {
*widthPtr = 0;
} else {
- char *accel = Tcl_GetString(mePtr->accelPtr);
+ const char *accel = Tcl_GetString(mePtr->accelPtr);
*widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength);
}
@@ -1721,7 +1721,7 @@ DrawMenuEntryAccelerator(
{
int baseline;
int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth;
- char *accel;
+ const char *accel;
if (mePtr->accelPtr != NULL) {
accel = Tcl_GetString(mePtr->accelPtr);
@@ -2164,7 +2164,7 @@ DrawMenuEntryLabel(
}
if (!haveImage || (mePtr->compound != COMPOUND_NONE)) {
if (mePtr->labelLength > 0) {
- char *label = Tcl_GetString(mePtr->labelPtr);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
textHeight = fmPtr->linespace;
@@ -2259,7 +2259,7 @@ DrawMenuEntryLabel(
if ((mePtr->compound != COMPOUND_NONE) || !haveImage) {
if (mePtr->labelLength > 0) {
int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2;
- char *label = Tcl_GetString(mePtr->labelPtr);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
if (TkWinGetPlatformTheme() == TK_THEME_WIN_CLASSIC) {
/*
@@ -2463,7 +2463,7 @@ TkpDrawMenuEntry(
} else {
TkMenuEntry *cascadeEntryPtr;
int parentDisabled = 0;
- char *name;
+ const char *name;
for (cascadeEntryPtr = menuPtr->menuRefPtr->parentEntryPtr;
cascadeEntryPtr != NULL;
@@ -2595,7 +2595,7 @@ GetMenuLabelGeometry(
if (mePtr->labelPtr != NULL) {
int textWidth;
- char *label = Tcl_GetString(mePtr->labelPtr);
+ const char *label = Tcl_GetString(mePtr->labelPtr);
textWidth = Tk_TextWidth(tkfont, label, mePtr->labelLength);
diff --git a/win/tkWinSend.c b/win/tkWinSend.c
index 10cd181..f7cba1f 100644
--- a/win/tkWinSend.c
+++ b/win/tkWinSend.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinSend.c,v 1.18 2008/10/17 23:18:38 nijtmans Exp $
+ * RCS: @(#) $Id: tkWinSend.c,v 1.19 2009/01/28 20:47:49 nijtmans Exp $
*/
#include "tkInt.h"
@@ -791,7 +791,7 @@ Send(
if (ei.bstrSource != NULL) {
int len;
- char *szErrorInfo;
+ const char *szErrorInfo;
opError = Tcl_NewUnicodeObj(ei.bstrSource, -1);
Tcl_ListObjIndex(interp, opError, 0, &opErrorCode);
diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c
index 6d6d2d1..ab335a8 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.19 2008/10/20 10:50:20 dkf Exp $
+ * RCS: @(#) $Id: tkWinWindow.c,v 1.20 2009/01/28 20:47:49 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -83,7 +83,7 @@ Tk_AttachHWND(
twdPtr->window.handle = hwnd;
entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &new);
- Tcl_SetHashValue(entryPtr, (ClientData)tkwin);
+ Tcl_SetHashValue(entryPtr, tkwin);
return (Window)twdPtr;
}
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 9267049..1f4fea5 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.135 2009/01/07 00:25:43 patthoyts Exp $
+ * RCS: @(#) $Id: tkWinWm.c,v 1.136 2009/01/28 20:47:49 nijtmans Exp $
*/
#include "tkWinInt.h"
@@ -36,7 +36,7 @@
* Event structure for synthetic activation events. These events are placed on
* the event queue whenever a toplevel gets a WM_MOUSEACTIVATE message or
* a WM_ACTIVATE. If the window is being moved (*flagPtr will be true)
- * then the handling of this event must be delayed until the operation
+ * then the handling of this event must be delayed until the operation
* has completed to avoid a premature WM_EXITSIZEMOVE event.
*/
@@ -433,7 +433,7 @@ static int InstallColormaps(HWND hwnd, int message,
int isForemost);
static void InvalidateSubTree(TkWindow *winPtr, Colormap colormap);
static void InvalidateSubTreeDepth(TkWindow *winPtr);
-static int ParseGeometry(Tcl_Interp *interp, char *string,
+static int ParseGeometry(Tcl_Interp *interp, const char *string,
TkWindow *winPtr);
static void RefreshColormap(Colormap colormap, TkDisplay *dispPtr);
static void SetLimits(HWND hwnd, MINMAXINFO *info);
@@ -2860,7 +2860,7 @@ Tk_WmObjCmd(
WMOPT_WITHDRAW
};
int index, length;
- char *argv1;
+ const char *argv1;
TkWindow *winPtr, **winPtrPtr = &winPtr;
TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
@@ -3078,7 +3078,7 @@ WmAttributesCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
LONG style, exStyle, styleBit, *stylePtr = NULL;
- char *string;
+ const char *string;
int i, boolean, length;
int config_fullscreen = 0, updatewrapper = 0;
int fullscreen_attr_changed = 0, fullscreen_attr = 0;
@@ -3192,7 +3192,7 @@ WmAttributesCmd(
}
wmPtr->alpha = dval;
} else { /* -transparentcolor */
- char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length);
+ const char *crefstr = Tcl_GetStringFromObj(objv[i+1], &length);
if (length == 0) {
/* reset to no transparent color */
@@ -3370,7 +3370,7 @@ WmClientCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
if ((objc != 3) && (objc != 4)) {
@@ -3532,7 +3532,7 @@ WmCommandCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int cmdArgc;
const char **cmdArgv;
@@ -3542,9 +3542,8 @@ WmCommandCmd(
}
if (objc == 3) {
if (wmPtr->cmdArgv != NULL) {
- argv3 = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
- Tcl_SetResult(interp, argv3, TCL_VOLATILE);
- ckfree(argv3);
+ char *merged = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv);
+ Tcl_SetResult(interp, merged, TCL_DYNAMIC);
}
return TCL_OK;
}
@@ -3792,7 +3791,7 @@ WmGeometryCmd(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
char xSign, ySign;
int width, height;
- char *argv3;
+ const char *argv3;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?");
@@ -3944,7 +3943,7 @@ WmGroupCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Tk_Window tkwin2;
- char *argv3;
+ const char *argv3;
int length;
if ((objc != 3) && (objc != 4)) {
@@ -4007,7 +4006,7 @@ WmIconbitmapCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */
- char *string;
+ const char *string;
if ((objc < 3) || (objc > 5)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?");
@@ -4017,7 +4016,7 @@ WmIconbitmapCmd(
* If we have 5 arguments, we must have a '-default' flag.
*/
- char *argv3 = Tcl_GetString(objv[3]);
+ const char *argv3 = Tcl_GetString(objv[3]);
if (strcmp(argv3, "-default")) {
Tcl_AppendResult(interp, "illegal option \"", argv3,
@@ -4197,7 +4196,7 @@ WmIconmaskCmd(
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
Pixmap pixmap;
- char *argv3;
+ const char *argv3;
if ((objc != 3) && (objc != 4)) {
Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?");
@@ -4254,7 +4253,7 @@ WmIconnameCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
if (objc > 4) {
@@ -4876,7 +4875,7 @@ WmProtocolCmd(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
register ProtocolHandler *protPtr, *prevPtr;
Atom protocol;
- char *cmd;
+ const char *cmd;
int cmdLength;
if ((objc < 3) || (objc > 5)) {
@@ -5352,7 +5351,7 @@ WmTitleCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
register WmInfo *wmPtr = winPtr->wmInfoPtr;
- char *argv3;
+ const char *argv3;
int length;
HWND wrapper;
@@ -6178,7 +6177,7 @@ UpdateGeometryInfo(
static int
ParseGeometry(
Tcl_Interp *interp, /* Used for error reporting. */
- char *string, /* String containing new geometry. Has the
+ const char *string, /* String containing new geometry. Has the
* standard form "=wxh+x+y". */
TkWindow *winPtr) /* Pointer to top-level window whose geometry
* is to be changed. */
@@ -6186,7 +6185,7 @@ ParseGeometry(
register WmInfo *wmPtr = winPtr->wmInfoPtr;
int x, y, width, height, flags;
char *end;
- register char *p = string;
+ register const char *p = string;
/*
* The leading "=" is optional.
@@ -7797,7 +7796,7 @@ WmProc(
}
}
/* fall through */
-
+
case WM_EXITSIZEMOVE:
if (inMoveSize) {
inMoveSize = 0;
@@ -7959,13 +7958,13 @@ WmProc(
int grab = TkGrabState(winPtr);
if (grab != TK_GRAB_NONE && SC_MINIMIZE == cmd)
goto done;
- if (grab == TK_GRAB_EXCLUDED
+ if (grab == TK_GRAB_EXCLUDED
&& !(SC_MOVE == cmd || SC_SIZE == cmd)) {
goto done;
}
}
/* fall through */
-
+
case WM_INITMENU:
case WM_COMMAND:
case WM_MENUCHAR: