From b48cedb1603d1c7f7e5e40c51f0621d5a044aac2 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Wed, 28 Jan 2009 20:47:48 +0000 Subject: - eliminate some unnessary type casts - some internal const decorations - spacing FossilOrigin-Name: 380696cadafe40c73feee0f0b45084587f31f011 --- ChangeLog | 20 +++++++++++ generic/ttk/ttkCache.c | 16 ++++----- generic/ttk/ttkLayout.c | 4 +-- generic/ttk/ttkState.c | 4 +-- generic/ttk/ttkTheme.c | 8 ++--- macosx/tkMacOSXMenu.c | 6 ++-- macosx/tkMacOSXPrivate.h | 94 ++++++++++++++++++++++++------------------------ unix/tkUnixFont.c | 4 +-- unix/tkUnixMenu.c | 16 ++++----- unix/tkUnixWm.c | 33 +++++++++-------- win/tkWinColor.c | 8 ++--- win/tkWinDialog.c | 20 +++++------ win/tkWinFont.c | 6 ++-- win/tkWinMenu.c | 24 ++++++------- win/tkWinSend.c | 4 +-- win/tkWinWindow.c | 4 +-- win/tkWinWm.c | 47 ++++++++++++------------ 17 files changed, 168 insertions(+), 150 deletions(-) diff --git a/ChangeLog b/ChangeLog index 028000f..9cfa338 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2009-01-28 Jan Nijtmans + + * generic/ttk/ttkCache.c: - eliminate some unnessary type casts + * generic/ttk/ttkLayout.c - some internal const decorations + * generic/ttk/ttkState.c - spacing + * generic/ttk/ttkTheme.c + * macosx/tkMacOSXMenu.c + * macosx/tkMacOSXPrivate.h + * unix/tkUnixFont.c + * unix/tkUnixMenu.c + * unix/tkUnixWm.c + * win/tkWinColor.c + * win/tkWinDialog.c + * win/tkWinFont.c + * win/tkWinMenu.c + * win/tkWinSend.c + * win/tkWinWindow.c + * win/tkWinWM.c + 2009-01-22 Kevin B. Kenny * unix/tcl.m4: Corrected a typo ($(SHLIB_VERSION) should be @@ -24,6 +43,7 @@ * unix/configure: autoconf-2.59 * win/configure: + 2009-01-14 Jan Nijtmans * generic/tkImgPhoto.c: fix for aMSN compatibility [tcl-Bug 2507326] diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index a12bf30..0d558d4 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -1,5 +1,5 @@ /* - * $Id: ttkCache.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ + * $Id: ttkCache.c,v 1.2 2009/01/28 20:47:49 nijtmans Exp $ * Ttk theme engine, resource cache. * * Copyright (c) 2004, Joe English @@ -141,7 +141,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) void Ttk_FreeResourceCache(Ttk_ResourceCache cache) { - Tcl_HashEntry *entryPtr; + Tcl_HashEntry *entryPtr; Tcl_HashSearch search; Ttk_ClearCache(cache); @@ -200,10 +200,10 @@ static void InitCacheWindow(Ttk_ResourceCache cache, Tk_Window tkwin) * Ttk_RegisterNamedColor -- * Specify an RGB triplet as a named color. * Overrides any previous named color specification. - * + * */ void Ttk_RegisterNamedColor( - Ttk_ResourceCache cache, + Ttk_ResourceCache cache, const char *colorName, XColor *colorPtr) { @@ -212,7 +212,7 @@ void Ttk_RegisterNamedColor( char nameBuf[14]; Tcl_Obj *colorNameObj; - sprintf(nameBuf, "#%04X%04X%04X", + sprintf(nameBuf, "#%04X%04X%04X", colorPtr->red, colorPtr->green, colorPtr->blue); colorNameObj = Tcl_NewStringObj(nameBuf, -1); Tcl_IncrRefCount(colorNameObj); @@ -223,7 +223,7 @@ void Ttk_RegisterNamedColor( Tcl_DecrRefCount(oldColor); } - Tcl_SetHashValue(entryPtr, (ClientData)colorNameObj); + Tcl_SetHashValue(entryPtr, colorNameObj); } /* @@ -234,7 +234,7 @@ void Ttk_RegisterNamedColor( */ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr) { - Tcl_HashEntry *entryPtr = + Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr)); if (entryPtr) { /* Use named color instead */ objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); @@ -249,7 +249,7 @@ typedef void *(*Allocator)(Tcl_Interp *, Tk_Window, Tcl_Obj *); static Tcl_Obj *Ttk_Use( Tcl_Interp *interp, - Tcl_HashTable *table, + Tcl_HashTable *table, Allocator allocate, Tk_Window tkwin, Tcl_Obj *objPtr) diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 2f599dd..8107683 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -5,7 +5,7 @@ * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkLayout.c,v 1.13 2008/12/07 16:34:56 das Exp $ + * $Id: ttkLayout.c,v 1.14 2009/01/28 20:47:49 nijtmans Exp $ */ #include @@ -619,7 +619,7 @@ Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) return 0; while (i < objc) { - char *elementName = Tcl_GetString(objv[i]); + const char *elementName = Tcl_GetString(objv[i]); unsigned flags = 0x0, sticky = TTK_FILL_BOTH; Tcl_Obj *childSpec = 0; diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 693c5d7..8586db0 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -1,5 +1,5 @@ /* - * $Id: ttkState.c,v 1.3 2008/12/03 18:44:49 jenglish Exp $ + * $Id: ttkState.c,v 1.4 2009/01/28 20:47:49 nijtmans Exp $ * * Tk widget state utilities. * @@ -83,7 +83,7 @@ static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) return status; for (i = 0; i < objc; ++i) { - char *stateName = Tcl_GetString(objv[i]); + const char *stateName = Tcl_GetString(objv[i]); int on, j; if (*stateName == '!') { diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 91805d6..1bcee83 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.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. * - * $Id: ttkTheme.c,v 1.16 2008/10/24 20:01:10 jenglish Exp $ + * $Id: ttkTheme.c,v 1.17 2009/01/28 20:47:49 nijtmans Exp $ */ #include @@ -332,7 +332,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) themePtr->rootStyle->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; - Tcl_SetHashValue(entryPtr, (ClientData)themePtr->rootStyle); + Tcl_SetHashValue(entryPtr, themePtr->rootStyle); return themePtr; } @@ -563,7 +563,7 @@ Ttk_CreateTheme( if (!parent) parent = pkgPtr->defaultTheme; themePtr = NewTheme(pkgPtr->cache, parent); - Tcl_SetHashValue(entryPtr, (ClientData) themePtr); + Tcl_SetHashValue(entryPtr, themePtr); return themePtr; } @@ -711,7 +711,7 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; - Tcl_SetHashValue(entryPtr, (ClientData)stylePtr); + Tcl_SetHashValue(entryPtr, stylePtr); return stylePtr; } return (Style*)Tcl_GetHashValue(entryPtr); diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 331befa..119162c 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.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: tkMacOSXMenu.c,v 1.49 2008/12/09 21:22:56 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXMenu.c,v 1.50 2009/01/28 20:47:49 nijtmans Exp $ */ #include "tkMacOSXPrivate.h" @@ -537,7 +537,7 @@ int Tcl_AppendResult(interp, "No more menus can be allocated.", NULL); return TCL_ERROR; } - Tcl_SetHashValue(commandEntryPtr, (char *) menuPtr); + Tcl_SetHashValue(commandEntryPtr, menuPtr); *menuIDPtr = returnID; return TCL_OK; } @@ -2650,7 +2650,7 @@ DrawMenuEntryAccelerator( CFRelease(cfStr); } } else { - Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel + + Tk_DrawChars(menuPtr->display, d, gc, tkfont, accel + geometryPtr->accelTextStart, mePtr->accelLength - geometryPtr->accelTextStart, leftEdge, baseline); } diff --git a/macosx/tkMacOSXPrivate.h b/macosx/tkMacOSXPrivate.h index 5756b0c..b9c89e8 100644 --- a/macosx/tkMacOSXPrivate.h +++ b/macosx/tkMacOSXPrivate.h @@ -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: tkMacOSXPrivate.h,v 1.9 2008/10/27 11:55:45 dkf Exp $ + * RCS: @(#) $Id: tkMacOSXPrivate.h,v 1.10 2009/01/28 20:47:49 nijtmans Exp $ */ #ifndef _TKMACPRIV @@ -20,65 +20,65 @@ /* Define constants only available on Mac OS X 10.3 or later */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 - #define kEventAppAvailableWindowBoundsChanged 110 - #define kEventParamTransactionID 'trns' - #define kEventParamWindowPartCode 'wpar' - #define typeWindowPartCode 'wpar' - #define kMenuAttrDoNotUseUserCommandKeys (1 << 7) - #define kSimpleWindowClass 18 - #define kWindowDoesNotCycleAttribute (1L << 15) - #define kWindowAsyncDragAttribute (1L << 23) - #define kThemeBrushAlternatePrimaryHighlightColor -5 - #define kThemeResizeUpCursor 19 - #define kThemeResizeDownCursor 19 - #define kThemeResizeUpDownCursor 19 - #define kThemePoofCursor 19 - #define kThemeBackgroundMetal 6 - #define kThemeIncDecButtonSmall 21 - #define kThemeIncDecButtonMini 22 - #define kThemeComboBox 16 - #define kThemeMiniSystemFont 109 - #define kAppearancePartUpButton 20 - #define kAppearancePartDownButton 21 - #define kAppearancePartPageUpArea 22 - #define kAppearancePartPageDownArea 23 - #define kAppearancePartIndicator 129 - #define kUIModeAllSuppressed 4 - #define FixedToInt(a) ((short)(((Fixed)(a) + fixed1/2) >> 16)) - #define IntToFixed(a) ((Fixed)(a) << 16) +# define kEventAppAvailableWindowBoundsChanged 110 +# define kEventParamTransactionID 'trns' +# define kEventParamWindowPartCode 'wpar' +# define typeWindowPartCode 'wpar' +# define kMenuAttrDoNotUseUserCommandKeys (1 << 7) +# define kSimpleWindowClass 18 +# define kWindowDoesNotCycleAttribute (1L << 15) +# define kWindowAsyncDragAttribute (1L << 23) +# define kThemeBrushAlternatePrimaryHighlightColor -5 +# define kThemeResizeUpCursor 19 +# define kThemeResizeDownCursor 19 +# define kThemeResizeUpDownCursor 19 +# define kThemePoofCursor 19 +# define kThemeBackgroundMetal 6 +# define kThemeIncDecButtonSmall 21 +# define kThemeIncDecButtonMini 22 +# define kThemeComboBox 16 +# define kThemeMiniSystemFont 109 +# define kAppearancePartUpButton 20 +# define kAppearancePartDownButton 21 +# define kAppearancePartPageUpArea 22 +# define kAppearancePartPageDownArea 23 +# define kAppearancePartIndicator 129 +# define kUIModeAllSuppressed 4 +# define FixedToInt(a) ((short)(((Fixed)(a) + fixed1/2) >> 16)) +# define IntToFixed(a) ((Fixed)(a) << 16) #endif /* Define constants only available on Mac OS X 10.4 or later */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 - #define kWindowNoTitleBarAttribute (1L << 9) - #define kWindowMetalNoContentSeparatorAttribute (1L << 11) - #define kThemeDisclosureTriangle 6 - #define kThemeBrushListViewOddRowBackground 56 - #define kThemeBrushListViewEvenRowBackground 57 - #define kThemeBrushListViewColumnDivider 58 - #define kThemeMetricScrollBarMinThumbHeight 132 - #define kThemeMetricSmallScrollBarMinThumbHeight 134 - #define kThemeScrollBarMedium kThemeMediumScrollBar - #define kThemeScrollBarSmall kThemeSmallScrollBar - #ifdef __BIG_ENDIAN__ - #define kCGBitmapByteOrder32Host (4 << 12) - #else - #define kCGBitmapByteOrder32Host (2 << 12) - #endif +# define kWindowNoTitleBarAttribute (1L << 9) +# define kWindowMetalNoContentSeparatorAttribute (1L << 11) +# define kThemeDisclosureTriangle 6 +# define kThemeBrushListViewOddRowBackground 56 +# define kThemeBrushListViewEvenRowBackground 57 +# define kThemeBrushListViewColumnDivider 58 +# define kThemeMetricScrollBarMinThumbHeight 132 +# define kThemeMetricSmallScrollBarMinThumbHeight 134 +# define kThemeScrollBarMedium kThemeMediumScrollBar +# define kThemeScrollBarSmall kThemeSmallScrollBar +# ifdef __BIG_ENDIAN__ +# define kCGBitmapByteOrder32Host (4 << 12) +# else +# define kCGBitmapByteOrder32Host (2 << 12) +# endif #endif /* Define constants only available on Mac OS X 10.5 or later */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 - #define kWindowUnifiedTitleAndToolbarAttribute (1L << 7) - #define kWindowTexturedSquareCornersAttribute (1L << 10) +# define kWindowUnifiedTitleAndToolbarAttribute (1L << 7) +# define kWindowTexturedSquareCornersAttribute (1L << 10) #endif /* HIToolbox version constants */ #ifndef kHIToolboxVersionNumber10_3 - #define kHIToolboxVersionNumber10_3 (145) +# define kHIToolboxVersionNumber10_3 (145) #endif #ifndef kHIToolboxVersionNumber10_4 - #define kHIToolboxVersionNumber10_4 (219) +# define kHIToolboxVersionNumber10_4 (219) #endif #ifndef kHIToolboxVersionNumber10_5 - #define kHIToolboxVersionNumber10_5 (343) +# define kHIToolboxVersionNumber10_5 (343) #endif /* Macros for HIToolbox runtime version checking */ MODULE_SCOPE float tkMacOSXToolboxVersionNumber; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index b069cd9..ba78339 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.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: tkUnixFont.c,v 1.39 2008/11/22 18:08:51 dkf Exp $ + * RCS: @(#) $Id: tkUnixFont.c,v 1.40 2009/01/28 20:47:49 nijtmans Exp $ */ #include "tkUnixInt.h" @@ -2361,7 +2361,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; } diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 1dbf6f8..9becd73 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.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: tkUnixMenu.c,v 1.22 2008/12/09 23:02:17 dkf Exp $ + * RCS: @(#) $Id: tkUnixMenu.c,v 1.23 2009/01/28 20:47:49 nijtmans Exp $ */ #include "default.h" @@ -398,9 +398,9 @@ GetMenuAccelGeometry( if (mePtr->type == CASCADE_ENTRY) { *widthPtr = 2 * CASCADE_ARROW_WIDTH; } else if ((menuPtr->menuType != MENUBAR) && (mePtr->accelPtr != NULL)) { - char *accel = Tcl_GetString(mePtr->accelPtr); + const char *accel = Tcl_GetString(mePtr->accelPtr); - *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength); + *widthPtr = Tk_TextWidth(tkfont, accel, mePtr->accelLength); } else { *widthPtr = 0; } @@ -517,7 +517,7 @@ DrawMenuEntryAccelerator( (menuPtr->postedCascade == mePtr) ? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED); } else if (mePtr->accelPtr != NULL) { - char *accel = Tcl_GetString(mePtr->accelPtr); + const char *accel = Tcl_GetString(mePtr->accelPtr); int left = x + mePtr->labelWidth + activeBorderWidth + mePtr->indicatorSpace; @@ -705,7 +705,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; @@ -802,7 +802,7 @@ DrawMenuEntryLabel( int baseline = y + (height + fmPtr->ascent - fmPtr->descent) / 2; if (mePtr->labelLength > 0) { - char *label = Tcl_GetString(mePtr->labelPtr); + const char *label = Tcl_GetString(mePtr->labelPtr); Tk_DrawChars(menuPtr->display, d, gc, tkfont, label, mePtr->labelLength, leftEdge + textXOffset, @@ -1346,7 +1346,7 @@ TkpDrawMenuEntry( cascadeEntryPtr != NULL; cascadeEntryPtr = cascadeEntryPtr->nextCascadePtr) { if (cascadeEntryPtr->namePtr != NULL) { - char *name = Tcl_GetString(cascadeEntryPtr->namePtr); + const char *name = Tcl_GetString(cascadeEntryPtr->namePtr); if (strcmp(name, Tk_PathName(menuPtr->tkwin)) == 0) { if (cascadeEntryPtr->state == ENTRY_DISABLED) { @@ -1490,7 +1490,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); if ((mePtr->compound != COMPOUND_NONE) && haveImage) { diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index d4a1a31..3af0ab5 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.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: tkUnixWm.c,v 1.69 2008/12/10 04:13:01 das Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.70 2009/01/28 20:47:49 nijtmans Exp $ */ #include "tkUnixInt.h" @@ -330,7 +330,7 @@ static void GetMaxSize(WmInfo *wmPtr, int *maxWidthPtr, int *maxHeightPtr); static void MenubarDestroyProc(ClientData clientData, XEvent *eventPtr); -static int ParseGeometry(Tcl_Interp *interp, char *string, +static int ParseGeometry(Tcl_Interp *interp, const char *string, TkWindow *winPtr); static void ReparentEvent(WmInfo *wmPtr, XReparentEvent *eventPtr); static void PropertyEvent(WmInfo *wmPtr, XPropertyEvent *eventPtr); @@ -1023,7 +1023,7 @@ Tk_WmObjCmd( WMOPT_WITHDRAW }; int index; int length; - char *argv1; + const char *argv1; TkWindow *winPtr; Tk_Window targetWin; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -1437,7 +1437,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)) { @@ -1622,7 +1622,7 @@ WmCommandCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - char *argv3; + const char *argv3; int cmdArgc; const char **cmdArgv; @@ -1632,9 +1632,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 *arg = Tcl_Merge(wmPtr->cmdArgc, wmPtr->cmdArgv); + Tcl_SetResult(interp, arg, TCL_DYNAMIC); } return TCL_OK; } @@ -1878,7 +1877,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?"); @@ -2031,7 +2030,7 @@ WmGroupCmd( register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; - char *argv3; + const char *argv3; int length; if ((objc != 3) && (objc != 4)) { @@ -2106,7 +2105,7 @@ WmIconbitmapCmd( { register WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; - char *argv3; + const char *argv3; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?"); @@ -2225,7 +2224,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?"); @@ -2283,7 +2282,7 @@ WmIconnameCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - char *argv3; + const char *argv3; int length; if (objc > 4) { @@ -2944,7 +2943,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)) { @@ -3386,7 +3385,7 @@ WmTitleCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - char *argv3; + const char *argv3; int length; if (objc > 4) { @@ -5361,7 +5360,7 @@ UpdateHints( 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. */ @@ -5369,7 +5368,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. 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: -- cgit v0.12