diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2008-04-27 22:38:54 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2008-04-27 22:38:54 (GMT) |
commit | 4513cb9f431ea8c6b151913a016ec6c75bcac559 (patch) | |
tree | 681f7c2354a3726da3ab7da646d316c1275f540d /generic | |
parent | 1876f5f7ee429456ad89540bcf659c092245bf1b (diff) | |
download | tk-4513cb9f431ea8c6b151913a016ec6c75bcac559.zip tk-4513cb9f431ea8c6b151913a016ec6c75bcac559.tar.gz tk-4513cb9f431ea8c6b151913a016ec6c75bcac559.tar.bz2 |
Get rid of pre-C89-isms (esp. CONST vs const).
Diffstat (limited to 'generic')
70 files changed, 2153 insertions, 2145 deletions
diff --git a/generic/tk3d.c b/generic/tk3d.c index 3922fc8..c36631a 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.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: tk3d.c,v 1.19 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tk3d.c,v 1.20 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -21,7 +21,7 @@ * by Tk_GetReliefFromObj. */ -static CONST char *reliefStrings[] = { +static const char *reliefStrings[] = { "flat", "groove", "raised", "ridge", "solid", "sunken", NULL }; @@ -320,7 +320,7 @@ Tk_Draw3DRectangle( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOf3DBorder( Tk_3DBorder border) /* Token for border. */ { @@ -645,7 +645,7 @@ Tk_GetReliefFromObj( int Tk_GetRelief( Tcl_Interp *interp, /* For error messages. */ - CONST char *name, /* Name of a relief type. */ + const char *name, /* Name of a relief type. */ int *reliefPtr) /* Where to store converted relief. */ { char c; @@ -694,7 +694,7 @@ Tk_GetRelief( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfRelief( int relief) /* One of TK_RELIEF_FLAT, TK_RELIEF_RAISED, or * TK_RELIEF_SUNKEN. */ diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 0e60295..039b4d1 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.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: tkArgv.c,v 1.13 2008/04/07 22:27:41 hobbs Exp $ + * RCS: @(#) $Id: tkArgv.c,v 1.14 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -63,7 +63,7 @@ Tk_ParseArgv( * means ignore Tk option specs. */ int *argcPtr, /* Number of arguments in argv. Modified to * hold # args left in argv at end. */ - CONST char **argv, /* Array of arguments. Modified to hold those + const char **argv, /* Array of arguments. Modified to hold those * that couldn't be processed here. */ Tk_ArgvInfo *argTable, /* Array of option descriptions */ int flags) /* Or'ed combination of various flag bits, @@ -73,7 +73,7 @@ Tk_ParseArgv( /* Pointer to the current entry in the table * of argument descriptions. */ Tk_ArgvInfo *matchPtr; /* Descriptor that matches current argument. */ - CONST char *curArg; /* Current argument */ + const char *curArg; /* Current argument */ register char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. * because first char. will almost always be @@ -195,7 +195,7 @@ Tk_ParseArgv( if (argc == 0) { goto missingArg; } - *((CONST char **)infoPtr->dst) = argv[srcIndex]; + *((const char **)infoPtr->dst) = argv[srcIndex]; srcIndex++; argc--; break; @@ -228,7 +228,7 @@ Tk_ParseArgv( } break; case TK_ARGV_FUNC: { - typedef int (ArgvFunc)(char *, char *, CONST char *); + typedef int (ArgvFunc)(char *, char *, const char *); ArgvFunc *handlerProc = (ArgvFunc *) infoPtr->src; if ((*handlerProc)(infoPtr->dst, infoPtr->key, argv[srcIndex])) { @@ -239,7 +239,7 @@ Tk_ParseArgv( } case TK_ARGV_GENFUNC: { typedef int (ArgvGenFunc)(char *, Tcl_Interp *, char *, int, - CONST char **); + const char **); ArgvGenFunc *handlerProc = (ArgvGenFunc *) infoPtr->src; argc = (*handlerProc)(infoPtr->dst, interp, infoPtr->key, diff --git a/generic/tkAtom.c b/generic/tkAtom.c index ae35527..1028ea0 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.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: tkAtom.c,v 1.7 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkAtom.c,v 1.8 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -78,7 +78,7 @@ Atom Tk_InternAtom( Tk_Window tkwin, /* Window token; map name to atom for this * window's display. */ - CONST char *name) /* Name to turn into atom. */ + const char *name) /* Name to turn into atom. */ { register TkDisplay *dispPtr; register Tcl_HashEntry *hPtr; @@ -123,7 +123,7 @@ Tk_InternAtom( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_GetAtomName( Tk_Window tkwin, /* Window token; map atom to name relative to * this window's display. */ diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index db323d1..eb2217f 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.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: tkCanvArc.c,v 1.16 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvArc.c,v 1.17 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -81,7 +81,7 @@ typedef struct ArcItem { */ static int StyleParseProc(ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, CONST char *value, + Tk_Window tkwin, const char *value, char *widgRec, int offset); static char * StylePrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); @@ -183,17 +183,17 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr); static int ConfigureArc(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int CreateArc(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeleteArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static int ArcCoords(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]); + Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static int ArcToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double ArcToPoint(Tk_Canvas canvas, @@ -273,7 +273,7 @@ CreateArc( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing arc. */ + Tcl_Obj *const objv[]) /* Arguments describing arc. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; int i; @@ -351,7 +351,7 @@ ArcCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { ArcItem *arcPtr = (ArcItem *) itemPtr; @@ -426,7 +426,7 @@ ConfigureArc( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Arc item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; @@ -442,7 +442,7 @@ ConfigureArc( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) arcPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -503,7 +503,7 @@ ConfigureArc( arcPtr->outline.gc = newGC; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (state==TK_STATE_HIDDEN) { ComputeArcBbox(canvas, arcPtr); @@ -512,7 +512,7 @@ ConfigureArc( color = arcPtr->fillColor; stipple = arcPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (arcPtr->activeFillColor!=NULL) { color = arcPtr->activeFillColor; } @@ -653,7 +653,7 @@ ComputeArcBbox( Tk_State state = arcPtr->header.state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = arcPtr->outline.width; @@ -664,7 +664,7 @@ ComputeArcBbox( arcPtr->header.x1 = arcPtr->header.x2 = arcPtr->header.y1 = arcPtr->header.y2 = -1; return; - } else if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *) arcPtr) { + } else if (Canvas(canvas)->currentItemPtr == (Tk_Item *) arcPtr) { if (arcPtr->outline.activeWidth>width) { width = arcPtr->outline.activeWidth; } @@ -796,7 +796,7 @@ DisplayArc( Pixmap stipple; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } lineWidth = arcPtr->outline.width; if (lineWidth < 1.0) { @@ -804,7 +804,7 @@ DisplayArc( } dashnumber = arcPtr->outline.dash.number; stipple = arcPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (arcPtr->outline.activeWidth>lineWidth) { lineWidth = arcPtr->outline.activeWidth; } @@ -972,11 +972,11 @@ ArcToPoint( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = (double) arcPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (arcPtr->outline.activeWidth>width) { width = (double) arcPtr->outline.activeWidth; } @@ -1148,10 +1148,10 @@ ArcToArea( Tk_State state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = (double) arcPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (arcPtr->outline.activeWidth>width) { width = (double) arcPtr->outline.activeWidth; } @@ -1470,7 +1470,7 @@ ComputeArcOutline( outlinePtr = arcPtr->outlinePtr; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } /* @@ -1528,7 +1528,7 @@ ComputeArcOutline( */ width = arcPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *) arcPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *) arcPtr) { if (arcPtr->outline.activeWidth>arcPtr->outline.width) { width = arcPtr->outline.activeWidth; } @@ -1854,13 +1854,13 @@ ArcToPostscript( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } color = arcPtr->outline.color; stipple = arcPtr->outline.stipple; fillColor = arcPtr->fillColor; fillStipple = arcPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (arcPtr->outline.activeColor!=NULL) { color = arcPtr->outline.activeColor; } @@ -2004,7 +2004,7 @@ StyleParseProc( ClientData clientData, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ - CONST char *value, /* Value of option. */ + const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index da4ba12..72afa99 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.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: tkCanvBmap.c,v 1.14 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvBmap.c,v 1.15 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -90,7 +90,7 @@ static Tk_ConfigSpec configSpecs[] = { static int BitmapCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int BitmapToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double BitmapToPoint(Tk_Canvas canvas, @@ -101,10 +101,10 @@ static void ComputeBitmapBbox(Tk_Canvas canvas, BitmapItem *bmapPtr); static int ConfigureBitmap(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int TkcCreateBitmap(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeleteBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayBitmap(Tk_Canvas canvas, @@ -170,7 +170,7 @@ TkcCreateBitmap( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */ + Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; int i; @@ -246,7 +246,7 @@ BitmapCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; @@ -312,7 +312,7 @@ ConfigureBitmap( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Bitmap item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; @@ -327,7 +327,7 @@ ConfigureBitmap( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) bmapPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -347,7 +347,7 @@ ConfigureBitmap( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (state == TK_STATE_HIDDEN) { ComputeBitmapBbox(canvas, bmapPtr); @@ -356,7 +356,7 @@ ConfigureBitmap( fgColor = bmapPtr->fgColor; bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (bmapPtr->activeFgColor!=NULL) { fgColor = bmapPtr->activeFgColor; } @@ -488,10 +488,10 @@ ComputeBitmapBbox( Tk_State state = bmapPtr->header.state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } bitmap = bmapPtr->bitmap; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)bmapPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *)bmapPtr) { if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } @@ -598,10 +598,10 @@ DisplayBitmap( */ if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } bitmap = bmapPtr->bitmap; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (bmapPtr->activeBitmap!=None) { bitmap = bmapPtr->activeBitmap; } @@ -864,12 +864,12 @@ BitmapToPostscript( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } fgColor = bmapPtr->fgColor; bgColor = bmapPtr->bgColor; bitmap = bmapPtr->bitmap; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (bmapPtr->activeFgColor!=NULL) { fgColor = bmapPtr->activeFgColor; } diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 04cbf9e..02cce14 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.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: tkCanvImg.c,v 1.11 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvImg.c,v 1.12 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -80,7 +80,7 @@ static void ImageChangedProc(ClientData clientData, int imgHeight); static int ImageCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[]); + Tcl_Obj *const argv[]); static int ImageToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double ImageToPoint(Tk_Canvas canvas, @@ -90,10 +90,10 @@ static int ImageToPostscript(Tcl_Interp *interp, static void ComputeImageBbox(Tk_Canvas canvas, ImageItem *imgPtr); static int ConfigureImage(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST argv[], int flags); + Tcl_Obj *const argv[], int flags); static int CreateImage(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST argv[]); + int argc, Tcl_Obj *const argv[]); static void DeleteImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayImage(Tk_Canvas canvas, @@ -159,7 +159,7 @@ CreateImage( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */ + Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; int i; @@ -231,7 +231,7 @@ ImageCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { ImageItem *imgPtr = (ImageItem *) itemPtr; @@ -296,7 +296,7 @@ ConfigureImage( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Image item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; @@ -305,7 +305,7 @@ ConfigureImage( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) imgPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -439,10 +439,10 @@ ComputeImageBbox( Tk_State state = imgPtr->header.state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } image = imgPtr->image; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)imgPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *)imgPtr) { if (imgPtr->activeImage != NULL) { image = imgPtr->activeImage; } @@ -542,11 +542,11 @@ DisplayImage( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } image = imgPtr->image; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (imgPtr->activeImage != NULL) { image = imgPtr->activeImage; } @@ -699,7 +699,7 @@ ImageToPostscript( * information; 0 means final Postscript is * being created.*/ { - ImageItem *imgPtr = (ImageItem *)itemPtr; + ImageItem *imgPtr = (ImageItem *) itemPtr; Tk_Window canvasWin = Tk_CanvasTkwin(canvas); char buffer[256]; @@ -709,11 +709,11 @@ ImageToPostscript( Tk_State state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } image = imgPtr->image; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (imgPtr->activeImage != NULL) { image = imgPtr->activeImage; } diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index b0e122c..21f7fc5 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.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: tkCanvLine.c,v 1.22 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvLine.c,v 1.23 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -82,11 +82,11 @@ static int ArrowheadPostscript(Tcl_Interp *interp, static void ComputeLineBbox(Tk_Canvas canvas, LineItem *linePtr); static int ConfigureLine(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int ConfigureArrows(Tk_Canvas canvas, LineItem *linePtr); static int CreateLine(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeleteLine(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayLine(Tk_Canvas canvas, @@ -97,7 +97,7 @@ static int GetLineIndex(Tcl_Interp *interp, Tcl_Obj *obj, int *indexPtr); static int LineCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void LineDeleteCoords(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); static void LineInsert(Tk_Canvas canvas, @@ -110,13 +110,13 @@ static int LineToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int ArrowParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, - CONST char *value, char *recordPtr, int offset); + const char *value, char *recordPtr, int offset); static char * ArrowPrintProc(ClientData clientData, Tk_Window tkwin, char *recordPtr, int offset, Tcl_FreeProc **freeProcPtr); static int ParseArrowShape(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, - CONST char *value, char *recordPtr, int offset); + const char *value, char *recordPtr, int offset); static char * PrintArrowShape(ClientData clientData, Tk_Window tkwin, char *recordPtr, int offset, Tcl_FreeProc **freeProcPtr); @@ -285,7 +285,7 @@ CreateLine( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing line. */ + Tcl_Obj *const objv[]) /* Arguments describing line. */ { LineItem *linePtr = (LineItem *) itemPtr; int i; @@ -364,7 +364,7 @@ LineCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { LineItem *linePtr = (LineItem *) itemPtr; int i, numPoints; @@ -477,7 +477,7 @@ ConfigureLine( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Line item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { LineItem *linePtr = (LineItem *) itemPtr; @@ -489,7 +489,7 @@ ConfigureLine( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) linePtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -501,7 +501,7 @@ ConfigureLine( state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (linePtr->outline.activeWidth > linePtr->outline.width || @@ -663,7 +663,7 @@ ComputeLineBbox( Tk_TSOffset *tsoffset; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (!(linePtr->numPoints) || (state==TK_STATE_HIDDEN)) { @@ -675,7 +675,7 @@ ComputeLineBbox( } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -853,10 +853,10 @@ DisplayLine( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } linewidth = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth != linewidth) { linewidth = linePtr->outline.activeWidth; } @@ -967,7 +967,7 @@ LineInsert( Tcl_Obj **objv; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK) @@ -997,7 +997,7 @@ LineInsert( for (i=0; i<objc; i++) { if (Tcl_GetDoubleFromObj(NULL, objv[i], &newCoordPtr[i + beforeThis]) != TCL_OK) { - Tcl_ResetResult(((TkCanvas *)canvas)->interp); + Tcl_ResetResult(Canvas(canvas)->interp); ckfree((char *) newCoordPtr); return; } @@ -1099,7 +1099,7 @@ LineInsert( } } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -1152,7 +1152,7 @@ LineDeleteCoords( Tk_State state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } first &= -2; @@ -1264,7 +1264,7 @@ LineDeleteCoords( } } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -1331,11 +1331,11 @@ LineToPoint( */ if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -1547,10 +1547,10 @@ LineToArea( Tk_State state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -1863,7 +1863,7 @@ ParseArrowShape( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Not used. */ - CONST char *value, /* Textual specification of arrow shape. */ + const char *value, /* Textual specification of arrow shape. */ char *recordPtr, /* Pointer to item record in which to store * arrow information. */ int offset) /* Offset of shape information in widget @@ -1872,7 +1872,7 @@ ParseArrowShape( LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; int argc; - CONST char **argv = NULL; + const char **argv = NULL; if (offset != Tk_Offset(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); @@ -1967,7 +1967,7 @@ ArrowParseProc( ClientData clientData, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ - CONST char *value, /* Value of option. */ + const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { @@ -2097,11 +2097,11 @@ ConfigureArrows( } if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = linePtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *)linePtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -2250,13 +2250,13 @@ LineToPostscript( Tk_State state = itemPtr->state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = linePtr->outline.width; color = linePtr->outline.color; stipple = linePtr->outline.stipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (linePtr->outline.activeWidth>width) { width = linePtr->outline.activeWidth; } @@ -2422,12 +2422,12 @@ ArrowheadPostscript( Pixmap stipple; Tk_State state = linePtr->header.state; - if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + if (state == TK_STATE_NULL) { + state = Canvas(canvas)->canvas_state; } stipple = linePtr->outline.stipple; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)linePtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *) linePtr) { if (linePtr->outline.activeStipple!=None) { stipple = linePtr->outline.activeStipple; } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index 1e61367..8050857 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.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: tkCanvPoly.c,v 1.18 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvPoly.c,v 1.19 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -160,10 +160,10 @@ static void ComputePolygonBbox(Tk_Canvas canvas, PolygonItem *polyPtr); static int ConfigurePolygon(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int CreatePolygon(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeletePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayPolygon(Tk_Canvas canvas, @@ -174,7 +174,7 @@ static int GetPolygonIndex(Tcl_Interp *interp, Tcl_Obj *obj, int *indexPtr); static int PolygonCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void PolygonDeleteCoords(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); static void PolygonInsert(Tk_Canvas canvas, @@ -253,7 +253,7 @@ CreatePolygon( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing polygon. */ + Tcl_Obj *const objv[]) /* Arguments describing polygon. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i; @@ -336,7 +336,7 @@ PolygonCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; int i, numPoints; @@ -435,7 +435,7 @@ ConfigurePolygon( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Polygon item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; @@ -449,7 +449,7 @@ ConfigurePolygon( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) polyPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -472,7 +472,7 @@ ConfigurePolygon( } if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (state==TK_STATE_HIDDEN) { ComputePolygonBbox(canvas, polyPtr); @@ -495,7 +495,7 @@ ConfigurePolygon( color = polyPtr->fillColor; stipple = polyPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->activeFillColor!=NULL) { color = polyPtr->activeFillColor; } @@ -632,7 +632,7 @@ ComputePolygonBbox( Tk_TSOffset *tsoffset; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; if (polyPtr->coordPtr == NULL || (polyPtr->numPoints < 1) || (state==TK_STATE_HIDDEN)) { @@ -640,7 +640,7 @@ ComputePolygonBbox( polyPtr->header.y1 = polyPtr->header.y2 = -1; return; } - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)polyPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *)polyPtr) { if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } @@ -894,9 +894,9 @@ DisplayPolygon( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth>linewidth) { linewidth = polyPtr->outline.activeWidth; } @@ -1028,7 +1028,7 @@ PolygonInsert( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (!obj || (Tcl_ListObjGetElements(NULL, obj, &objc, &objv) != TCL_OK) @@ -1129,7 +1129,7 @@ PolygonInsert( TkIncludePoint(itemPtr, polyPtr->coordPtr+j); } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth > width) { width = polyPtr->outline.activeWidth; } @@ -1263,10 +1263,10 @@ PolygonToPoint( bestDist = 1.0e36; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } @@ -1460,11 +1460,11 @@ PolygonToArea( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } @@ -1820,14 +1820,14 @@ PolygonToPostscript( } if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = polyPtr->outline.width; color = polyPtr->outline.color; stipple = polyPtr->fillStipple; fillColor = polyPtr->fillColor; fillStipple = polyPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (polyPtr->outline.activeWidth>width) { width = polyPtr->outline.activeWidth; } diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index d8d60a5..a5efd72 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.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: tkCanvPs.c,v 1.19 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvPs.c,v 1.20 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -156,7 +156,7 @@ TkCanvPostscriptCmd( TkCanvas *canvasPtr, /* Information about canvas widget. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. Caller has already parsed + const char **argv) /* Argument strings. Caller has already parsed * this command enough to know that argv[1] is * "postscript". */ { @@ -166,7 +166,7 @@ TkCanvPostscriptCmd( Tk_Item *itemPtr; #define STRING_LENGTH 400 char string[STRING_LENGTH+1]; - CONST char *p; + const char *p; time_t now; size_t length; Tk_Window tkwin = canvasPtr->tkwin; @@ -640,7 +640,7 @@ Tk_PostscriptColor( */ if (psInfoPtr->colorVar != NULL) { - CONST char *cmdString; + const char *cmdString; cmdString = Tcl_GetVar2(interp, psInfoPtr->colorVar, Tk_NameOfColor(colorPtr), 0); @@ -715,14 +715,14 @@ Tk_PostscriptFont( */ if (psInfoPtr->fontVar != NULL) { - CONST char *name = Tk_NameOfFont(tkfont); + const char *name = Tk_NameOfFont(tkfont); Tcl_Obj **objv; int objc; double size; Tcl_Obj *list = Tcl_GetVar2Ex(interp, psInfoPtr->fontVar, name, 0); if (list != NULL) { - CONST char *fontname; + const char *fontname; if (Tcl_ListObjGetElements(interp, list, &objc, &objv) != TCL_OK || objc != 2 diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 1dfdc7f..34206ea 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.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: tkCanvText.c,v 1.26 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvText.c,v 1.27 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -139,10 +139,10 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeTextBbox(Tk_Canvas canvas, TextItem *textPtr); static int ConfigureText(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int argc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int CreateText(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST objv[]); + int argc, Tcl_Obj *const objv[]); static void DeleteText(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayCanvText(Tk_Canvas canvas, @@ -161,7 +161,7 @@ static void SetTextCursor(Tk_Canvas canvas, Tk_Item *itemPtr, int index); static int TextCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, - int argc, Tcl_Obj *CONST objv[]); + int argc, Tcl_Obj *const objv[]); static void TextDeleteChars(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); static void TextInsert(Tk_Canvas canvas, @@ -228,7 +228,7 @@ CreateText( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */ + Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { TextItem *textPtr = (TextItem *) itemPtr; int i; @@ -322,7 +322,7 @@ TextCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { TextItem *textPtr = (TextItem *) itemPtr; @@ -389,7 +389,7 @@ ConfigureText( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { TextItem *textPtr = (TextItem *) itemPtr; @@ -405,7 +405,7 @@ ConfigureText( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) textPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -423,12 +423,12 @@ ConfigureText( } if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } color = textPtr->color; stipple = textPtr->stipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (textPtr->activeColor!=NULL) { color = textPtr->activeColor; } @@ -615,7 +615,7 @@ ComputeTextBbox( Tk_State state = textPtr->header.state; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } Tk_FreeTextLayout(textPtr->textLayout); @@ -729,10 +729,10 @@ DisplayCanvText( textInfoPtr = textPtr->textInfoPtr; if(state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } stipple = textPtr->stipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (textPtr->activeStipple!=None) { stipple = textPtr->activeStipple; } @@ -1087,7 +1087,7 @@ TextToPoint( double value; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } textPtr = (TextItem *) itemPtr; value = (double) Tk_DistanceToTextLayout(textPtr->textLayout, @@ -1132,7 +1132,7 @@ TextToArea( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } textPtr = (TextItem *) itemPtr; @@ -1377,7 +1377,7 @@ GetSelText( TextItem *textPtr = (TextItem *) itemPtr; int byteCount; char *text; - CONST char *selStart, *selEnd; + const char *selStart, *selEnd; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; if ((textInfoPtr->selectFirst < 0) || @@ -1438,14 +1438,14 @@ TextToPostscript( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } color = textPtr->color; stipple = textPtr->stipple; if (state == TK_STATE_HIDDEN || textPtr->color == NULL || textPtr->text == NULL || *textPtr->text == 0) { return TCL_OK; - } else if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + } else if (Canvas(canvas)->currentItemPtr == itemPtr) { if (textPtr->activeColor!=NULL) { color = textPtr->activeColor; } diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index e0c9a3a..5c14d48 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.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: tkCanvUtil.c,v 1.19 2008/03/11 22:31:19 das Exp $ + * RCS: @(#) $Id: tkCanvUtil.c,v 1.20 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -47,7 +47,7 @@ static Tk_SmoothMethod tkRawSmoothMethod = { static void SmoothMethodCleanupProc(ClientData clientData, Tcl_Interp *interp); static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp); -static int DashConvert(char *l, CONST char *p, int n, +static int DashConvert(char *l, const char *p, int n, double width); static void TranslateAndAppendCoords(TkCanvas *canvPtr, double x, double y, XPoint *outArr, int numOut); @@ -75,8 +75,7 @@ Tk_Window Tk_CanvasTkwin( Tk_Canvas canvas) /* Token for the canvas. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; - return canvasPtr->tkwin; + return Canvas(canvas)->tkwin; } /* @@ -108,10 +107,9 @@ Tk_CanvasDrawableCoords( short *drawableXPtr, /* Screen coordinates are stored here. */ short *drawableYPtr) { - TkCanvas *canvasPtr = (TkCanvas *) canvas; double tmp; - tmp = x - canvasPtr->drawableXOrigin; + tmp = x - Canvas(canvas)->drawableXOrigin; if (tmp > 0) { tmp += 0.5; } else { @@ -125,7 +123,7 @@ Tk_CanvasDrawableCoords( *drawableXPtr = (short) tmp; } - tmp = y - canvasPtr->drawableYOrigin; + tmp = y - Canvas(canvas)->drawableYOrigin; if (tmp > 0) { tmp += 0.5; } else { @@ -168,10 +166,9 @@ Tk_CanvasWindowCoords( short *screenXPtr, /* Screen coordinates are stored here. */ short *screenYPtr) { - TkCanvas *canvasPtr = (TkCanvas *) canvas; double tmp; - tmp = x - canvasPtr->xOrigin; + tmp = x - Canvas(canvas)->xOrigin; if (tmp > 0) { tmp += 0.5; } else { @@ -185,7 +182,7 @@ Tk_CanvasWindowCoords( *screenXPtr = (short) tmp; } - tmp = y - canvasPtr->yOrigin; + tmp = y - Canvas(canvas)->yOrigin; if (tmp > 0) { tmp += 0.5; } else { @@ -224,17 +221,15 @@ int Tk_CanvasGetCoord( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ - CONST char *string, /* Describes coordinate (any screen coordinate + const char *string, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; - - if (Tk_GetScreenMM(canvasPtr->interp, canvasPtr->tkwin, string, + if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string, doublePtr) != TCL_OK) { return TCL_ERROR; } - *doublePtr *= canvasPtr->pixelsPerMM; + *doublePtr *= Canvas(canvas)->pixelsPerMM; return TCL_OK; } @@ -266,13 +261,11 @@ Tk_CanvasGetCoordFromObj( * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; - - if (Tk_GetMMFromObj(canvasPtr->interp, canvasPtr->tkwin, obj, + if (Tk_GetMMFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr) != TCL_OK) { return TCL_ERROR; } - *doublePtr *= canvasPtr->pixelsPerMM; + *doublePtr *= Canvas(canvas)->pixelsPerMM; return TCL_OK; } @@ -301,10 +294,9 @@ Tk_CanvasSetStippleOrigin( * to draw a stippled pattern as part of * redisplaying the canvas. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; - - XSetTSOrigin(canvasPtr->display, gc, -canvasPtr->drawableXOrigin, - -canvasPtr->drawableYOrigin); + XSetTSOrigin(Canvas(canvas)->display, gc, + -Canvas(canvas)->drawableXOrigin, + -Canvas(canvas)->drawableYOrigin); } /* @@ -333,7 +325,7 @@ Tk_CanvasSetOffset( * redisplaying the canvas. */ Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; + register TkCanvas *canvasPtr = Canvas(canvas); int flags = 0; int x = - canvasPtr->drawableXOrigin; int y = - canvasPtr->drawableYOrigin; @@ -377,7 +369,7 @@ Tk_CanvasTextInfo * Tk_CanvasGetTextInfo( Tk_Canvas canvas) /* Token for the canvas widget. */ { - return &((TkCanvas *) canvas)->textInfo; + return &Canvas(canvas)->textInfo; } /* @@ -403,13 +395,13 @@ Tk_CanvasTagsParseProc( ClientData clientData, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ - CONST char *value, /* Value of option (list of tag names). */ + const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item (ignored). */ { register Tk_Item *itemPtr = (Tk_Item *) widgRec; int argc, i; - CONST char **argv; + const char **argv; Tk_Uid *newPtr; /* @@ -486,7 +478,7 @@ Tk_CanvasTagsPrintProc( return (char *) itemPtr->tagPtr[0]; } *freeProcPtr = TCL_DYNAMIC; - return Tcl_Merge(itemPtr->numTags, (CONST char **) itemPtr->tagPtr); + return Tcl_Merge(itemPtr->numTags, (const char **) itemPtr->tagPtr); } /* @@ -512,11 +504,11 @@ TkCanvasDashParseProc( ClientData clientData, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ - CONST char *value, /* Value of option. */ + const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { - return Tk_GetDash(interp, value, (Tk_Dash *)(widgRec+offset)); + return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } /* @@ -552,8 +544,7 @@ TkCanvasDashPrintProc( * for return string. */ { Tk_Dash *dash = (Tk_Dash *) (widgRec+offset); - char *buffer; - char *p; + char *buffer, *p; int i = dash->number; if (i < 0) { @@ -568,12 +559,12 @@ TkCanvasDashPrintProc( *freeProcPtr = NULL; return ""; } - buffer = (char *)ckalloc((unsigned int) (4*i)); + buffer = (char *) ckalloc((unsigned int) (4*i)); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; sprintf(buffer, "%d", *p++ & 0xff); - while(--i) { + while (--i) { sprintf(buffer+strlen(buffer), " %d", *p++ & 0xff); } return buffer; @@ -617,8 +608,7 @@ InitSmoothMethods( ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc; ptr->nextPtr = NULL; - Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc, - (ClientData) methods); + Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc,methods); return methods; } @@ -646,8 +636,7 @@ Tk_CreateSmoothMethod( Tk_SmoothMethod *smooth) { SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr; - methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod", - NULL); + methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Initialize if we were not previously initialized. @@ -678,8 +667,7 @@ Tk_CreateSmoothMethod( ptr->smooth.coordProc = smooth->coordProc; ptr->smooth.postscriptProc = smooth->postscriptProc; ptr->nextPtr = methods; - Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc, - (ClientData) ptr); + Tcl_SetAssocData(interp, "smoothMethod", SmoothMethodCleanupProc, ptr); } /* @@ -705,10 +693,11 @@ SmoothMethodCleanupProc( * interpreter. */ Tcl_Interp *interp) /* Interpreter that is being deleted. */ { - SmoothAssocData *ptr, *methods = (SmoothAssocData *) clientData; + SmoothAssocData *ptr, *methods = clientData; while (methods != NULL) { - methods = (ptr = methods)->nextPtr; + ptr = methods; + methods = methods->nextPtr; ckfree((char *) ptr); } } @@ -735,7 +724,7 @@ TkSmoothParseProc( ClientData clientData, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ - CONST char *value, /* Value of option. */ + const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { @@ -751,8 +740,7 @@ TkSmoothParseProc( return TCL_OK; } length = strlen(value); - methods = (SmoothAssocData *) Tcl_GetAssocData(interp, "smoothMethod", - NULL); + methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Not initialized yet; fix that now. @@ -857,15 +845,15 @@ TkSmoothPrintProc( int Tk_GetDash( Tcl_Interp *interp, /* Used for error reporting. */ - CONST char *value, /* Textual specification of dash list. */ + const char *value, /* Textual specification of dash list. */ Tk_Dash *dash) /* Pointer to record in which to store dash * information. */ { int argc, i; - CONST char **largv, **argv = NULL; + const char **largv, **argv = NULL; char *pt; - if ((value==NULL) || (*value==0) ) { + if ((value == NULL) || (*value == '\0')) { dash->number = 0; return TCL_OK; } @@ -877,17 +865,16 @@ Tk_GetDash( switch (*value) { case '.': case ',': case '-': case '_': i = DashConvert(NULL, value, -1, 0.0); - if (i>0) { - i = strlen(value); - } else { + if (i <= 0) { goto badDashList; } - if (i > (int)sizeof(char *)) { - dash->pattern.pt = pt = (char *) ckalloc(strlen(value)); + i = strlen(value); + if (i > (int) sizeof(char *)) { + dash->pattern.pt = pt = ckalloc(strlen(value)); } else { pt = dash->pattern.array; } - memcpy(pt,value, (unsigned int) i); + memcpy(pt, value, (unsigned) i); dash->number = -i; return TCL_OK; } @@ -897,11 +884,11 @@ Tk_GetDash( goto badDashList; } - if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + if ((unsigned) ABS(dash->number) > sizeof(char *)) { ckfree((char *) dash->pattern.pt); } if (argc > (int)sizeof(char *)) { - dash->pattern.pt = pt = (char *) ckalloc((unsigned int) argc); + dash->pattern.pt = pt = ckalloc((unsigned) argc); } else { pt = dash->pattern.array; } @@ -932,13 +919,12 @@ Tk_GetDash( badDashList: Tcl_AppendResult(interp, "bad dash list \"", value, - "\": must be a list of integers or a format like \"-..\"", - NULL); + "\": must be a list of integers or a format like \"-..\"", NULL); syntaxError: if (argv != NULL) { ckfree((char *) argv); } - if ((unsigned int)ABS(dash->number) > sizeof(char *)) { + if ((unsigned) ABS(dash->number) > sizeof(char *)) { ckfree((char *) dash->pattern.pt); } dash->number = 0; @@ -1010,13 +996,13 @@ Tk_DeleteOutline( if (outline->gc != None) { Tk_FreeGC(display, outline->gc); } - if ((unsigned int)ABS(outline->dash.number) > sizeof(char *)) { + if ((unsigned) ABS(outline->dash.number) > sizeof(char *)) { ckfree((char *) outline->dash.pattern.pt); } - if ((unsigned int)ABS(outline->activeDash.number) > sizeof(char *)) { + if ((unsigned) ABS(outline->activeDash.number) > sizeof(char *)) { ckfree((char *) outline->activeDash.pattern.pt); } - if ((unsigned int)ABS(outline->disabledDash.number) > sizeof(char *)) { + if ((unsigned) ABS(outline->disabledDash.number) > sizeof(char *)) { ckfree((char *) outline->disabledDash.pattern.pt); } if (outline->color != NULL) { @@ -1094,9 +1080,9 @@ Tk_ConfigOutlineGC( color = outline->color; stipple = outline->stipple; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == item) { + if (Canvas(canvas)->currentItemPtr == item) { if (outline->activeWidth>width) { width = outline->activeWidth; } @@ -1177,7 +1163,7 @@ Tk_ChangeOutlineGC( Tk_Item *item, Tk_Outline *outline) { - CONST char *p; + const char *p; double width; Tk_Dash *dash; XColor *color; @@ -1192,9 +1178,9 @@ Tk_ChangeOutlineGC( color = outline->color; stipple = outline->stipple; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == item) { + if (Canvas(canvas)->currentItemPtr == item) { if (outline->activeWidth > width) { width = outline->activeWidth; } @@ -1231,25 +1217,25 @@ Tk_ChangeOutlineGC( int i = -dash->number; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - q = (char *) ckalloc(2*(unsigned int)i); + q = (char *) ckalloc(2 * (unsigned) i); i = DashConvert(q, p, i, width); - XSetDashes(((TkCanvas *)canvas)->display, outline->gc, - outline->offset, q, i); + XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i); ckfree(q); } else if (dash->number>2 || (dash->number==2 && (dash->pattern.array[0]!=dash->pattern.array[1]))) { - p = (dash->number > (int)sizeof(char *)) + p = (dash->number > (int) sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - XSetDashes(((TkCanvas *)canvas)->display, outline->gc, - outline->offset, p, dash->number); + XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, p, + dash->number); } if (stipple!=None) { - int w=0; int h=0; + int w = 0; int h = 0; Tk_TSOffset *tsoffset = &outline->tsoffset; int flags = tsoffset->flags; + if (!(flags & TK_OFFSET_INDEX) && (flags & (TK_OFFSET_CENTER|TK_OFFSET_MIDDLE))) { - Tk_SizeOfBitmap(((TkCanvas *)canvas)->display, stipple, &w, &h); + Tk_SizeOfBitmap(Canvas(canvas)->display, stipple, &w, &h); if (flags & TK_OFFSET_CENTER) { w /= 2; } else { @@ -1311,9 +1297,9 @@ Tk_ResetOutlineGC( color = outline->color; stipple = outline->stipple; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == item) { + if (Canvas(canvas)->currentItemPtr == item) { if (outline->activeWidth>width) { width = outline->activeWidth; } @@ -1354,11 +1340,11 @@ Tk_ResetOutlineGC( } else { dashList = 4; } - XSetDashes(((TkCanvas *)canvas)->display, outline->gc, - outline->offset, &dashList , 1); + XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, + &dashList , 1); } if (stipple != None) { - XSetTSOrigin(((TkCanvas *)canvas)->display, outline->gc, 0, 0); + XSetTSOrigin(Canvas(canvas)->display, outline->gc, 0, 0); return 1; } return 0; @@ -1388,28 +1374,21 @@ Tk_CanvasPsOutline( Tk_Item *item, Tk_Outline *outline) { - char string[41]; - char pattern[11]; + char string[41], pattern[11]; int i; - char *ptr; - char *str = string; - char *lptr = pattern; - Tcl_Interp *interp = ((TkCanvas *)canvas)->interp; - double width; - Tk_Dash *dash; - XColor *color; - Pixmap stipple; + char *ptr, *str = string, *lptr = pattern; + Tcl_Interp *interp = Canvas(canvas)->interp; + double width = outline->width; + Tk_Dash *dash = &outline->dash; + XColor *color = outline->color; + Pixmap stipple = outline->stipple; Tk_State state = item->state; - width = outline->width; - dash = &(outline->dash); - color = outline->color; - stipple = outline->stipple; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } - if (((TkCanvas *)canvas)->currentItemPtr == item) { + if (Canvas(canvas)->currentItemPtr == item) { if (outline->activeWidth > width) { width = outline->activeWidth; } @@ -1440,12 +1419,12 @@ Tk_CanvasPsOutline( Tcl_AppendResult(interp, string, NULL); if (dash->number > 10) { - str = (char *)ckalloc((unsigned int) (1 + 4*dash->number)); + str = (char *) ckalloc((unsigned) (1 + 4*dash->number)); } else if (dash->number < -5) { - str = (char *)ckalloc((unsigned int) (1 - 8*dash->number)); - lptr = (char *)ckalloc((unsigned int) (1 - 2*dash->number)); + str = (char *) ckalloc((unsigned) (1 - 8*dash->number)); + lptr = (char *) ckalloc((unsigned) (1 - 2*dash->number)); } - ptr = ((unsigned int)ABS(dash->number) > sizeof(char *)) ? + ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; if (dash->number > 0) { char *ptr0 = ptr; @@ -1523,7 +1502,7 @@ static int DashConvert( char *l, /* Must be at least 2*n chars long, or NULL to * indicate "just check syntax". */ - CONST char *p, /* String to parse. */ + const char *p, /* String to parse. */ int n, /* Length of string to parse, or -1 to * indicate that strlen() should be used. */ double width) /* Width of line. */ @@ -1531,7 +1510,7 @@ DashConvert( int result = 0; int size, intWidth; - if (n<0) { + if (n < 0) { n = strlen(p); } intWidth = (int) (width + 0.5); @@ -1713,7 +1692,7 @@ TkCanvTranslatePath( double x, y; x = coordArr[i*2]; - y = coordArr[i*2+1]; + y = coordArr[i*2 + 1]; if (x<lft || x>rgh || y<top || y>btm) { break; } @@ -1731,10 +1710,10 @@ TkCanvTranslatePath( * b[]. Initialize a[] to be equal to coordArr[]. */ - if (numVertex*12 <= (int)(sizeof(staticSpace)/sizeof(staticSpace[0]))) { + if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) { tempArr = staticSpace; } else { - tempArr = (double *)ckalloc(numVertex*12*sizeof(tempArr[0])); + tempArr = (double *) ckalloc(numVertex * 12 * sizeof(double)); } for (i=0; i<numVertex*2; i++){ tempArr[i] = coordArr[i]; @@ -1770,7 +1749,7 @@ TkCanvTranslatePath( maxOutput = numVertex*3; for (j=0; j<4; j++){ double xClip = limit[j]; - int inside = a[0]<xClip; + int inside = a[0] < xClip; double priorY = a[1]; numOutput = 0; @@ -1781,7 +1760,7 @@ TkCanvTranslatePath( for (i=0; i<numVertex; i++){ double x = a[i*2]; - double y = a[i*2+1]; + double y = a[i*2 + 1]; if (x >= xClip) { /* @@ -1799,11 +1778,11 @@ TkCanvTranslatePath( double x0, y0, yN; assert(i > 0); - x0 = a[i*2-2]; - y0 = a[i*2-1]; + x0 = a[i*2 - 2]; + y0 = a[i*2 - 1]; yN = y0 + (y - y0)*(xClip-x0)/(x-x0); b[numOutput*2] = -yN; - b[numOutput*2+1] = xClip; + b[numOutput*2 + 1] = xClip; numOutput++; assert(numOutput <= maxOutput); priorY = yN; @@ -1825,7 +1804,8 @@ TkCanvTranslatePath( * The current vertex is to the left of xClip */ if (!inside) { - /* If the current vertex is on the left of xClip and one + /* + * If the current vertex is on the left of xClip and one * or more prior vertices where to the right, then we have * to draw a line segment along xClip that extends from * the spot where we first crossed from left to right to @@ -1835,19 +1815,19 @@ TkCanvTranslatePath( double x0, y0, yN; assert(i > 0); - x0 = a[i*2-2]; - y0 = a[i*2-1]; + x0 = a[i*2 - 2]; + y0 = a[i*2 - 1]; yN = y0 + (y - y0)*(xClip-x0)/(x-x0); if (yN != priorY) { b[numOutput*2] = -yN; - b[numOutput*2+1] = xClip; + b[numOutput*2 + 1] = xClip; numOutput++; assert(numOutput <= maxOutput); } inside = 1; } b[numOutput*2] = -y; - b[numOutput*2+1] = x; + b[numOutput*2 + 1] = x; numOutput++; assert(numOutput <= maxOutput); } diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 550a7d3..405c81e 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.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: tkCanvWind.c,v 1.16 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkCanvWind.c,v 1.17 2008/04/27 22:38:55 dkf Exp $ */ #include <stdio.h> @@ -73,10 +73,10 @@ static void ComputeWindowBbox(Tk_Canvas canvas, WindowItem *winItemPtr); static int ConfigureWinItem(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[], int flags); + Tcl_Obj *const objv[], int flags); static int CreateWinItem(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeleteWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayWinItem(Tk_Canvas canvas, @@ -89,7 +89,7 @@ static void TranslateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void WinItemLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void WinItemRequestProc(ClientData clientData, @@ -174,7 +174,7 @@ CreateWinItem( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing window. */ + Tcl_Obj *const objv[]) /* Arguments describing window. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; int i; @@ -202,6 +202,7 @@ CreateWinItem( i = 1; } else { char *arg = Tcl_GetString(objv[1]); + i = 2; if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; @@ -244,7 +245,7 @@ WinItemCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1, y1, x2, y2, ... */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; @@ -308,7 +309,7 @@ ConfigureWinItem( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Window item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; @@ -318,7 +319,7 @@ ConfigureWinItem( oldWindow = winItemPtr->tkwin; canvasTkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, canvasTkwin, configSpecs, objc, - (CONST char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) { + (const char **) objv, (char *) winItemPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } @@ -453,7 +454,7 @@ ComputeWindowBbox( y = (int) (winItemPtr->y + ((winItemPtr->y >= 0) ? 0.5 : - 0.5)); if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if ((winItemPtr->tkwin == NULL) || (state == TK_STATE_HIDDEN)) { /* @@ -578,7 +579,7 @@ DisplayWinItem( return; } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } /* @@ -759,8 +760,7 @@ xerrorhandler( { return 0; } -#endif - +#endif /* X_GetImage */ /* *-------------------------------------------------------------- @@ -790,8 +790,7 @@ WinItemToPostscript( * information; 0 means final Postscript is * being created. */ { - WindowItem *winItemPtr = (WindowItem *)itemPtr; - + WindowItem *winItemPtr = (WindowItem *) itemPtr; double x, y; int width, height; Tk_Window tkwin = winItemPtr->tkwin; @@ -890,7 +889,7 @@ CanvasPsWindow( */ ximage = XGetImage(Tk_Display(tkwin), Tk_WindowId(tkwin), 0, 0, - (unsigned int)width, (unsigned int)height, AllPlanes, ZPixmap); + (unsigned) width, (unsigned) height, AllPlanes, ZPixmap); #ifdef X_GetImage Tk_DeleteErrorHandler(handle); @@ -900,8 +899,8 @@ CanvasPsWindow( return TCL_OK; } - result = TkPostscriptImage(interp, tkwin, - ((TkCanvas *)canvas)->psInfo, ximage, 0, 0, width, height); + result = TkPostscriptImage(interp, tkwin, Canvas(canvas)->psInfo, ximage, + 0, 0, width, height); XDestroyImage(ximage); return result; @@ -1069,11 +1068,11 @@ WinItemLostSlaveProc( * was stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - WindowItem *winItemPtr = (WindowItem *) clientData; + WindowItem *winItemPtr = clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, - WinItemStructureProc, (ClientData) winItemPtr); + WinItemStructureProc, winItemPtr); if (canvasTkwin != Tk_Parent(winItemPtr->tkwin)) { Tk_UnmaintainGeometry(winItemPtr->tkwin, canvasTkwin); } diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index e6cc864..3d5240e 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.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: tkCanvas.c,v 1.47 2008/04/17 14:53:44 dgp Exp $ + * RCS: @(#) $Id: tkCanvas.c,v 1.48 2008/04/27 22:38:55 dkf Exp $ */ /* #define USE_OLD_TAG_SEARCH 1 */ @@ -266,12 +266,12 @@ static void CanvasSetOrigin(TkCanvas *canvasPtr, static void CanvasUpdateScrollbars(TkCanvas *canvasPtr); static int CanvasWidgetCmd(ClientData clientData, Tcl_Interp *interp, int argc, - Tcl_Obj *CONST *argv); + Tcl_Obj *const *argv); static void CanvasWorldChanged( ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, - Tcl_Obj *CONST *argv, int flags); + Tcl_Obj *const *argv, int flags); static void DestroyCanvas(char *memPtr); static void DisplayCanvas(ClientData clientData); static void DoItem(Tcl_Interp *interp, @@ -280,18 +280,18 @@ static void EventuallyRedrawItem(Tk_Canvas canvas, Tk_Item *itemPtr); #ifdef USE_OLD_TAG_SEARCH static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, - int argc, Tcl_Obj *CONST *argv, + int argc, Tcl_Obj *const *argv, Tcl_Obj *newTagObj, int first); #else /* USE_OLD_TAG_SEARCH */ static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, - int argc, Tcl_Obj *CONST *argv, + int argc, Tcl_Obj *const *argv, Tcl_Obj *newTagObj, int first, TagSearch **searchPtrPtr); #endif /* USE_OLD_TAG_SEARCH */ static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, - Tcl_Obj *CONST *argv, Tk_Uid uid, int enclosed); + Tcl_Obj *const *argv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); -static CONST char** TkGetStringsFromObjs(int argc, Tcl_Obj *CONST *objv); +static const char** TkGetStringsFromObjs(int argc, Tcl_Obj *const *objv); static void InitCanvas(void); #ifdef USE_OLD_TAG_SEARCH static Tk_Item * NextItem(TagSearch *searchPtr); @@ -377,7 +377,7 @@ Tk_CanvasObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - Tcl_Obj *CONST argv[]) /* Argument objects. */ + Tcl_Obj *const argv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window) clientData; TkCanvas *canvasPtr; @@ -527,9 +527,9 @@ CanvasWidgetCmd( ClientData clientData, /* Information about canvas widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ @@ -541,7 +541,7 @@ CanvasWidgetCmd( #endif /* USE_OLD_TAG_SEARCH */ int index; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "addtag", "bbox", "bind", "canvasx", "canvasy", "cget", "configure", "coords", "create", "dchars", "delete", "dtag", @@ -778,12 +778,12 @@ CanvasWidgetCmd( goto done; } } else if (objc == 4) { - CONST char *command; + const char *command; command = Tk_GetBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3])); if (command == NULL) { - CONST char *string; + const char *string; string = Tcl_GetStringResult(interp); @@ -900,7 +900,8 @@ CanvasWidgetCmd( result = (*itemPtr->typePtr->coordProc)(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3); } else { - CONST char **args = TkGetStringsFromObjs(objc-3, objv+3); + const char **args = TkGetStringsFromObjs(objc-3, objv+3); + result = (*itemPtr->typePtr->coordProc)(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, (Tcl_Obj **) args); @@ -977,7 +978,8 @@ CanvasWidgetCmd( result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3); } else { - CONST char **args = TkGetStringsFromObjs(objc-3, objv+3); + const char **args = TkGetStringsFromObjs(objc-3, objv+3); + result = (*typePtr->createProc)(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, (Tcl_Obj **) args); if (args != NULL) { @@ -1373,7 +1375,8 @@ CanvasWidgetCmd( (Tk_Canvas) canvasPtr, itemPtr, objc-3, objv+3, TK_CONFIG_ARGV_ONLY); } else { - CONST char **args = TkGetStringsFromObjs(objc-3, objv+3); + const char **args = TkGetStringsFromObjs(objc-3, objv+3); + result = (*itemPtr->typePtr->configProc)(interp, (Tk_Canvas) canvasPtr, itemPtr, objc-3, (Tcl_Obj **) args, TK_CONFIG_ARGV_ONLY); @@ -1444,7 +1447,7 @@ CanvasWidgetCmd( break; } case CANV_POSTSCRIPT: { - CONST char **args = TkGetStringsFromObjs(objc, objv); + const char **args = TkGetStringsFromObjs(objc, objv); result = TkCanvPostscriptCmd(canvasPtr, interp, objc, args); if (args != NULL) { @@ -1519,7 +1522,7 @@ CanvasWidgetCmd( } case CANV_SCAN: { int x, y, gain = 10; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "mark", "dragto", NULL }; @@ -1563,7 +1566,7 @@ CanvasWidgetCmd( } case CANV_SELECT: { int index, optionindex; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "adjust", "clear", "from", "item", "to", NULL }; enum options { @@ -1696,7 +1699,8 @@ CanvasWidgetCmd( - canvasPtr->inset, canvasPtr->scrollX1, canvasPtr->scrollX2)); } else { - CONST char **args = TkGetStringsFromObjs(objc, objv); + const char **args = TkGetStringsFromObjs(objc, objv); + type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count); if (args != NULL) { ckfree((char *) args); @@ -1742,7 +1746,8 @@ CanvasWidgetCmd( - canvasPtr->inset, canvasPtr->scrollY1, canvasPtr->scrollY2)); } else { - CONST char **args = TkGetStringsFromObjs(objc, objv); + const char **args = TkGetStringsFromObjs(objc, objv); + type = Tk_GetScrollInfo(interp, objc, args, &fraction, &count); if (args != NULL) { ckfree((char *) args); @@ -1881,14 +1886,14 @@ ConfigureCanvas( TkCanvas *canvasPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ + Tcl_Obj *const objv[], /* Argument objects. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { XGCValues gcValues; GC newGC; if (Tk_ConfigureWidget(interp, canvasPtr->tkwin, configSpecs, - objc, (CONST char **) objv, (char *) canvasPtr, + objc, (const char **) objv, (char *) canvasPtr, flags|TK_CONFIG_OBJS) != TCL_OK) { return TCL_ERROR; } @@ -1941,7 +1946,7 @@ ConfigureCanvas( canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { int argc2; - CONST char **argv2; + const char **argv2; if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString, &argc2, &argv2) != TCL_OK) { @@ -2023,11 +2028,10 @@ static void CanvasWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkCanvas *canvasPtr; + TkCanvas *canvasPtr = (TkCanvas *) instanceData; Tk_Item *itemPtr; int result; - canvasPtr = (TkCanvas *) instanceData; itemPtr = canvasPtr->firstItemPtr; for ( ; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { result = (*itemPtr->typePtr->configProc)(canvasPtr->interp, @@ -2066,7 +2070,7 @@ static void DisplayCanvas( ClientData clientData) /* Information about widget. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; @@ -2307,7 +2311,7 @@ CanvasEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; if (eventPtr->type == Expose) { int x, y; @@ -2399,7 +2403,7 @@ static void CanvasCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; Tk_Window tkwin = canvasPtr->tkwin; /* @@ -2440,7 +2444,7 @@ Tk_CanvasEventuallyRedraw( int x2, int y2) /* Lower right corner of area to redraw. * Pixels on edge are not redrawn. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; + TkCanvas *canvasPtr = Canvas(canvas); /* * If tkwin is NULL, the canvas has been destroyed, so we can't really @@ -2505,7 +2509,8 @@ EventuallyRedrawItem( Tk_Canvas canvas, /* Information about widget. */ Tk_Item *itemPtr) /* Item to be redrawn. */ { - TkCanvas *canvasPtr = (TkCanvas *) canvas; + TkCanvas *canvasPtr = Canvas(canvas); + if ((itemPtr->x1 >= itemPtr->x2) || (itemPtr->y1 >= itemPtr->y2) || (itemPtr->x2 < canvasPtr->xOrigin) || (itemPtr->y2 < canvasPtr->yOrigin) || @@ -3900,7 +3905,7 @@ FindItems( TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */ int objc, /* Number of entries in argv. Must be greater * than zero. */ - Tcl_Obj *CONST *objv, /* Arguments that describe what items to + Tcl_Obj *const *objv, /* Arguments that describe what items to * search for (see user doc on "find" and * "addtag" options). */ Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all @@ -3921,7 +3926,7 @@ FindItems( Tk_Item *itemPtr; Tk_Uid uid; int index, result; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "above", "all", "below", "closest", "enclosed", "overlapping", "withtag", NULL }; @@ -4148,7 +4153,7 @@ FindArea( Tcl_Interp *interp, /* Interpreter for error reporting and result * storing. */ TkCanvas *canvasPtr, /* Canvas whose items are to be searched. */ - Tcl_Obj *CONST *objv, /* Array of four arguments that give the + Tcl_Obj *const *objv, /* Array of four arguments that give the * coordinates of the rectangular area to * search. */ Tk_Uid uid, /* If non-NULL, gives new tag to set on all @@ -4354,9 +4359,9 @@ CanvasBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; - Tcl_Preserve((ClientData) canvasPtr); + Tcl_Preserve(canvasPtr); /* * This code below keeps track of the current modifier state in @@ -4433,7 +4438,7 @@ CanvasBindProc( CanvasDoEvent(canvasPtr, eventPtr); done: - Tcl_Release((ClientData) canvasPtr); + Tcl_Release(canvasPtr); } /* @@ -4643,8 +4648,8 @@ PickCurrentItem( #else /* USE_OLD_TAG_SEARCH */ DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid); #endif /* USE_OLD_TAG_SEA */ - if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT && - prevItemPtr != canvasPtr->currentItemPtr)) { + if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT + && prevItemPtr != canvasPtr->currentItemPtr)) { (*canvasPtr->currentItemPtr->typePtr->configProc)(canvasPtr->interp, (Tk_Canvas) canvasPtr, canvasPtr->currentItemPtr, 0, NULL, TK_CONFIG_ARGV_ONLY); @@ -4806,14 +4811,14 @@ CanvasDoEvent( (numObjects * sizeof(ClientData))); } #ifdef USE_OLD_TAG_SEARCH - objectPtr[0] = (ClientData) Tk_GetUid("all"); + objectPtr[0] = Tk_GetUid("all"); #else /* USE_OLD_TAG_SEARCH */ - objectPtr[0] = (ClientData) searchUids->allUid; + objectPtr[0] = searchUids->allUid; #endif /* USE_OLD_TAG_SEARCH */ for (i = itemPtr->numTags-1; i >= 0; i--) { - objectPtr[i+1] = (ClientData) itemPtr->tagPtr[i]; + objectPtr[i+1] = itemPtr->tagPtr[i]; } - objectPtr[itemPtr->numTags+1] = (ClientData) itemPtr; + objectPtr[itemPtr->numTags+1] = itemPtr; #ifndef USE_OLD_TAG_SEARCH /* @@ -4866,7 +4871,7 @@ static void CanvasBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; @@ -4874,13 +4879,11 @@ CanvasBlinkProc( if (canvasPtr->textInfo.cursorOn) { canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - canvasPtr->insertOffTime, CanvasBlinkProc, - (ClientData) canvasPtr); + canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr); } else { canvasPtr->textInfo.cursorOn = 1; canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - canvasPtr->insertOnTime, CanvasBlinkProc, - (ClientData) canvasPtr); + canvasPtr->insertOnTime, CanvasBlinkProc, canvasPtr); } if (canvasPtr->textInfo.focusItemPtr != NULL) { EventuallyRedrawItem((Tk_Canvas) canvasPtr, @@ -4918,8 +4921,7 @@ CanvasFocusProc( canvasPtr->textInfo.cursorOn = 1; if (canvasPtr->insertOffTime != 0) { canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - canvasPtr->insertOffTime, CanvasBlinkProc, - (ClientData) canvasPtr); + canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr); } } else { canvasPtr->textInfo.gotFocus = 0; @@ -4933,7 +4935,7 @@ CanvasFocusProc( if (canvasPtr->highlightWidth > 0) { canvasPtr->flags |= REDRAW_BORDERS; if (!(canvasPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayCanvas, (ClientData) canvasPtr); + Tcl_DoWhenIdle(DisplayCanvas, canvasPtr); canvasPtr->flags |= REDRAW_PENDING; } } @@ -4976,7 +4978,7 @@ CanvasSelectTo( if (canvasPtr->textInfo.selItemPtr == NULL) { Tk_OwnSelection(canvasPtr->tkwin, XA_PRIMARY, CanvasLostSelection, - (ClientData) canvasPtr); + canvasPtr); } else if (canvasPtr->textInfo.selItemPtr != itemPtr) { EventuallyRedrawItem((Tk_Canvas) canvasPtr, canvasPtr->textInfo.selItemPtr); @@ -5032,7 +5034,7 @@ CanvasFetchSelection( * not including terminating NULL * character. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; if (canvasPtr->textInfo.selItemPtr == NULL) { return -1; @@ -5067,7 +5069,7 @@ static void CanvasLostSelection( ClientData clientData) /* Information about entry widget. */ { - TkCanvas *canvasPtr = (TkCanvas *) clientData; + TkCanvas *canvasPtr = clientData; if (canvasPtr->textInfo.selItemPtr != NULL) { EventuallyRedrawItem((Tk_Canvas) canvasPtr, @@ -5196,14 +5198,14 @@ CanvasUpdateScrollbars( */ interp = canvasPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); xScrollCmd = canvasPtr->xScrollCmd; if (xScrollCmd != NULL) { - Tcl_Preserve((ClientData) xScrollCmd); + Tcl_Preserve(xScrollCmd); } yScrollCmd = canvasPtr->yScrollCmd; if (yScrollCmd != NULL) { - Tcl_Preserve((ClientData) yScrollCmd); + Tcl_Preserve(yScrollCmd); } xOrigin = canvasPtr->xOrigin; yOrigin = canvasPtr->yOrigin; @@ -5218,6 +5220,7 @@ CanvasUpdateScrollbars( if (canvasPtr->xScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions(xOrigin + inset, xOrigin + width - inset, scrollX1, scrollX2); + result = Tcl_VarEval(interp, xScrollCmd, " ", Tcl_GetString(fractions), NULL); Tcl_DecrRefCount(fractions); @@ -5225,12 +5228,13 @@ CanvasUpdateScrollbars( Tcl_BackgroundError(interp); } Tcl_ResetResult(interp); - Tcl_Release((ClientData) xScrollCmd); + Tcl_Release(xScrollCmd); } if (yScrollCmd != NULL) { Tcl_Obj *fractions = ScrollFractions(yOrigin + inset, yOrigin + height - inset, scrollY1, scrollY2); + result = Tcl_VarEval(interp, yScrollCmd, " ", Tcl_GetString(fractions), NULL); Tcl_DecrRefCount(fractions); @@ -5238,9 +5242,9 @@ CanvasUpdateScrollbars( Tcl_BackgroundError(interp); } Tcl_ResetResult(interp); - Tcl_Release((ClientData) yScrollCmd); + Tcl_Release(yScrollCmd); } - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* @@ -5389,17 +5393,18 @@ CanvasSetOrigin( */ /* ARGSUSED */ -static CONST char ** +static const char ** TkGetStringsFromObjs( int objc, - Tcl_Obj *CONST objv[]) + Tcl_Obj *const objv[]) { register int i; - CONST char **argv; + const char **argv; + if (objc <= 0) { return NULL; } - argv = (CONST char **) ckalloc((objc+1) * sizeof(char *)); + argv = (const char **) ckalloc((objc+1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } @@ -5435,8 +5440,7 @@ Tk_CanvasPsColor( Tk_Canvas canvas, /* Information about canvas. */ XColor *colorPtr) /* Information about color. */ { - return Tk_PostscriptColor(interp, ((TkCanvas *) canvas)->psInfo, - colorPtr); + return Tk_PostscriptColor(interp, Canvas(canvas)->psInfo, colorPtr); } /* @@ -5469,7 +5473,7 @@ Tk_CanvasPsFont( Tk_Font tkfont) /* Information about font in which text is to * be printed. */ { - return Tk_PostscriptFont(interp, ((TkCanvas *) canvas)->psInfo, tkfont); + return Tk_PostscriptFont(interp, Canvas(canvas)->psInfo, tkfont); } /* @@ -5502,9 +5506,8 @@ Tk_CanvasPsBitmap( * rectangular region to output. */ int width, int height) /* Size of rectangular region. */ { - return Tk_PostscriptBitmap(interp, ((TkCanvas *) canvas)->tkwin, - ((TkCanvas *) canvas)->psInfo, bitmap, startX, startY, - width, height); + return Tk_PostscriptBitmap(interp, Canvas(canvas)->tkwin, + Canvas(canvas)->psInfo, bitmap, startX, startY, width, height); } /* @@ -5536,8 +5539,8 @@ Tk_CanvasPsStipple( Tk_Canvas canvas, /* Information about canvas. */ Pixmap bitmap) /* Bitmap to use for stippling. */ { - return Tk_PostscriptStipple(interp, ((TkCanvas *) canvas)->tkwin, - ((TkCanvas *) canvas)->psInfo, bitmap); + return Tk_PostscriptStipple(interp, Canvas(canvas)->tkwin, + Canvas(canvas)->psInfo, bitmap); } /* @@ -5563,7 +5566,7 @@ Tk_CanvasPsY( * is being generated. */ double y) /* Y-coordinate in canvas coords. */ { - return Tk_PostscriptY(y, ((TkCanvas *) canvas)->psInfo); + return Tk_PostscriptY(y, Canvas(canvas)->psInfo); } /* @@ -5593,8 +5596,7 @@ Tk_CanvasPsPath( * coordinates giving points for path. */ int numPoints) /* Number of points at *coordPtr. */ { - Tk_PostscriptPath(interp, ((TkCanvas *) canvas)->psInfo, - coordPtr, numPoints); + Tk_PostscriptPath(interp, Canvas(canvas)->psInfo, coordPtr, numPoints); } /* diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index cd0455b..c4e6c23 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.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: tkClipboard.c,v 1.18 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkClipboard.c,v 1.19 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -58,7 +58,7 @@ ClipboardHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkClipboardTarget *targetPtr = (TkClipboardTarget*) clientData; + TkClipboardTarget *targetPtr = clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; size_t count = 0; @@ -136,9 +136,9 @@ ClipboardAppHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkDisplay *dispPtr = (TkDisplay *) clientData; + TkDisplay *dispPtr = clientData; size_t length; - CONST char *p; + const char *p; p = dispPtr->clipboardAppPtr->winPtr->nameUid; length = strlen(p); @@ -207,7 +207,7 @@ static void ClipboardLostSel( ClientData clientData) /* Pointer to TkDisplay structure. */ { - TkDisplay *dispPtr = (TkDisplay*) clientData; + TkDisplay *dispPtr = clientData; dispPtr->clipboardActive = 0; } @@ -284,7 +284,7 @@ Tk_ClipboardClear( if (!dispPtr->clipboardActive) { Tk_OwnSelection(dispPtr->clipWindow, dispPtr->clipboardAtom, - ClipboardLostSel, (ClientData) dispPtr); + ClipboardLostSel, dispPtr); dispPtr->clipboardActive = 1; } dispPtr->clipboardAppPtr = winPtr->mainPtr; @@ -326,7 +326,7 @@ Tk_ClipboardAppend( * clipboard item, e.g. STRING or LENGTH. */ Atom format, /* Format in which the selection information * should be returned to the requestor. */ - char* buffer) /* NULL terminated string containing the data + char *buffer) /* NULL terminated string containing the data * to be added to the clipboard. */ { TkWindow *winPtr = (TkWindow *) tkwin; @@ -343,7 +343,7 @@ Tk_ClipboardAppend( Tk_ClipboardClear(interp, tkwin); } else if (!dispPtr->clipboardActive) { Tk_OwnSelection(dispPtr->clipWindow, dispPtr->clipboardAtom, - ClipboardLostSel, (ClientData) dispPtr); + ClipboardLostSel, dispPtr); dispPtr->clipboardActive = 1; } @@ -360,14 +360,14 @@ Tk_ClipboardAppend( } } if (targetPtr == NULL) { - targetPtr = (TkClipboardTarget*) ckalloc(sizeof(TkClipboardTarget)); + targetPtr = (TkClipboardTarget *) ckalloc(sizeof(TkClipboardTarget)); targetPtr->type = type; targetPtr->format = format; targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL; targetPtr->nextPtr = dispPtr->clipTargetPtr; dispPtr->clipTargetPtr = targetPtr; Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, - type, ClipboardHandler, (ClientData) targetPtr, format); + type, ClipboardHandler, targetPtr, format); } else if (targetPtr->format != format) { Tcl_AppendResult(interp, "format \"", Tk_GetAtomName(tkwin, format), "\" does not match current format \"", @@ -380,7 +380,7 @@ Tk_ClipboardAppend( * Append a new buffer to the buffer chain. */ - cbPtr = (TkClipboardBuffer*) ckalloc(sizeof(TkClipboardBuffer)); + cbPtr = (TkClipboardBuffer *) ckalloc(sizeof(TkClipboardBuffer)); cbPtr->nextPtr = NULL; if (targetPtr->lastBufferPtr != NULL) { targetPtr->lastBufferPtr->nextPtr = cbPtr; @@ -393,7 +393,7 @@ Tk_ClipboardAppend( cbPtr->buffer = (char *) ckalloc((unsigned) (cbPtr->length + 1)); strcpy(cbPtr->buffer, buffer); - TkSelUpdateClipboard((TkWindow*)(dispPtr->clipWindow), targetPtr); + TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr); return TCL_OK; } @@ -420,12 +420,12 @@ Tk_ClipboardObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = (Tk_Window) clientData; char *path = NULL; Atom selection; - static CONST char *optionStrings[] = { "append", "clear", "get", NULL }; + static const char *optionStrings[] = { "append", "clear", "get", NULL }; enum options { CLIPBOARD_APPEND, CLIPBOARD_CLEAR, CLIPBOARD_GET }; int index, i; @@ -445,7 +445,7 @@ Tk_ClipboardObjCmd( char *targetName = NULL; char *formatName = NULL; char *string; - static CONST char *appendOptionStrings[] = { + static const char *appendOptionStrings[] = { "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; @@ -516,7 +516,7 @@ Tk_ClipboardObjCmd( Tcl_GetString(objv[i])); } case CLIPBOARD_CLEAR: { - static CONST char *clearOptionStrings[] = { "-displayof", NULL }; + static const char *clearOptionStrings[] = { "-displayof", NULL }; enum clearOptions { CLEAR_DISPLAYOF }; int subIndex; @@ -548,7 +548,7 @@ Tk_ClipboardObjCmd( Tcl_DString selBytes; int result; char *string; - static CONST char *getOptionStrings[] = { + static const char *getOptionStrings[] = { "-displayof", "-type", NULL }; enum getOptions { APPEND_DISPLAYOF, APPEND_TYPE }; @@ -647,12 +647,12 @@ TkClipInit( * and set up an event handler for it. */ - dispPtr->clipWindow = Tk_CreateWindow(interp, (Tk_Window) NULL, - "_clip", DisplayString(dispPtr->display)); + dispPtr->clipWindow = Tk_CreateWindow(interp, NULL, "_clip", + DisplayString(dispPtr->display)); if (dispPtr->clipWindow == NULL) { return TCL_ERROR; } - Tcl_Preserve((ClientData) dispPtr->clipWindow); + Tcl_Preserve(dispPtr->clipWindow); atts.override_redirect = True; Tk_ChangeWindowAttributes(dispPtr->clipWindow, CWOverrideRedirect, &atts); Tk_MakeWindowExist(dispPtr->clipWindow); @@ -673,11 +673,9 @@ TkClipInit( */ Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, - dispPtr->applicationAtom, ClipboardAppHandler, - (ClientData) dispPtr, XA_STRING); + dispPtr->applicationAtom, ClipboardAppHandler, dispPtr,XA_STRING); Tk_CreateSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, - dispPtr->windowAtom, ClipboardWindowHandler, - (ClientData) dispPtr, XA_STRING); + dispPtr->windowAtom, ClipboardWindowHandler, dispPtr, XA_STRING); return TCL_OK; } diff --git a/generic/tkColor.c b/generic/tkColor.c index 85593ac..8fbb85e 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.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: tkColor.c,v 1.16 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkColor.c,v 1.17 2008/04/27 22:38:55 dkf Exp $ */ #include "tkInt.h" @@ -129,8 +129,8 @@ Tk_AllocColorFromObj( */ if (tkColPtr != NULL) { - TkColor *firstColorPtr = (TkColor *) - Tcl_GetHashValue(tkColPtr->hashPtr); + TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + FreeColorObjProc(objPtr); for (tkColPtr = firstColorPtr; tkColPtr != NULL; tkColPtr = tkColPtr->nextPtr) { @@ -138,7 +138,7 @@ Tk_AllocColorFromObj( && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { tkColPtr->resourceRefCount++; tkColPtr->objRefCount++; - objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr; + objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; return (XColor *) tkColPtr; } } @@ -149,7 +149,7 @@ Tk_AllocColorFromObj( */ tkColPtr = (TkColor *) Tk_GetColor(interp, tkwin, Tcl_GetString(objPtr)); - objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr; + objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; if (tkColPtr != NULL) { tkColPtr->objRefCount++; } @@ -204,7 +204,7 @@ Tk_GetColor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew); if (!isNew) { - existingColPtr = (TkColor *) Tcl_GetHashValue(nameHashPtr); + existingColPtr = Tcl_GetHashValue(nameHashPtr); for (tkColPtr = existingColPtr; tkColPtr != NULL; tkColPtr = tkColPtr->nextPtr) { if ((tkColPtr->screen == Tk_Screen(tkwin)) @@ -310,7 +310,7 @@ Tk_GetColorByValue( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable, (char *) &valueKey, &isNew); if (!isNew) { - tkColPtr = (TkColor *) Tcl_GetHashValue(valueHashPtr); + tkColPtr = Tcl_GetHashValue(valueHashPtr); tkColPtr->resourceRefCount++; return &tkColPtr->color; } @@ -355,7 +355,7 @@ Tk_GetColorByValue( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfColor( XColor *colorPtr) /* Color whose name is desired. */ { @@ -364,7 +364,7 @@ Tk_NameOfColor( if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, @@ -415,8 +415,8 @@ Tk_GCForColor( if (tkColPtr->gc == None) { gcValues.foreground = tkColPtr->color.pixel; - tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), - drawable, GCForeground, &gcValues); + tkColPtr->gc = XCreateGC(DisplayOfScreen(tkColPtr->screen), drawable, + GCForeground, &gcValues); } return tkColPtr->gc; } @@ -474,7 +474,7 @@ Tk_FreeColor( } TkpFreeColor(tkColPtr); - prevPtr = (TkColor *) Tcl_GetHashValue(tkColPtr->hashPtr); + prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr); if (prevPtr == tkColPtr) { if (tkColPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(tkColPtr->hashPtr); @@ -553,7 +553,7 @@ static void FreeColorObjProc( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkColor *tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { tkColPtr->objRefCount--; @@ -588,10 +588,10 @@ DupColorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkColor *tkColPtr = (TkColor *) srcObjPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; if (tkColPtr != NULL) { tkColPtr->objRefCount++; @@ -638,7 +638,7 @@ Tk_GetColorFromObj( * map. If it is, we are done. */ - tkColPtr = (TkColor *) objPtr->internalRep.twoPtrValue.ptr1; + tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; if ((tkColPtr != NULL) && (tkColPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == tkColPtr->screen) @@ -664,12 +664,12 @@ Tk_GetColorFromObj( if (hashPtr == NULL) { goto error; } - for (tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr); + for (tkColPtr = Tcl_GetHashValue(hashPtr); (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { if ((Tk_Screen(tkwin) == tkColPtr->screen) && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { FreeColorObjProc(objPtr); - objPtr->internalRep.twoPtrValue.ptr1 = (void *) tkColPtr; + objPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; tkColPtr->objRefCount++; return (XColor *) tkColPtr; } @@ -780,7 +780,7 @@ TkDebugColor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name); if (hashPtr != NULL) { - TkColor *tkColPtr = (TkColor *) Tcl_GetHashValue(hashPtr); + TkColor *tkColPtr = Tcl_GetHashValue(hashPtr); if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 368d0ce..5521615 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.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: tkConfig.c,v 1.26 2007/12/13 15:24:13 dgp Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.27 2008/04/27 22:38:55 dkf Exp $ */ /* @@ -50,7 +50,7 @@ */ typedef struct TkOption { - CONST Tk_OptionSpec *specPtr; + const Tk_OptionSpec *specPtr; /* The original spec from the template passed * to Tk_CreateOptionTable.*/ Tk_Uid dbNameUID; /* The Uid form of the option database @@ -123,7 +123,7 @@ static Tcl_Obj * GetConfigList(char *recordPtr, Option *optionPtr, Tk_Window tkwin); static Tcl_Obj * GetObjectForOption(char *recordPtr, Option *optionPtr, Tk_Window tkwin); -static Option * GetOption(CONST char *name, OptionTable *tablePtr); +static Option * GetOption(const char *name, OptionTable *tablePtr); static Option * GetOptionFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, OptionTable *tablePtr); static int ObjectIsEmpty(Tcl_Obj *objPtr); @@ -166,7 +166,7 @@ Tk_OptionTable Tk_CreateOptionTable( Tcl_Interp *interp, /* Interpreter associated with the application * in which this table will be used. */ - CONST Tk_OptionSpec *templatePtr) + const Tk_OptionSpec *templatePtr) /* Static information about the configuration * options. */ { @@ -174,7 +174,7 @@ Tk_CreateOptionTable( Tcl_HashEntry *hashEntryPtr; int newEntry; OptionTable *tablePtr; - CONST Tk_OptionSpec *specPtr, *specPtr2; + const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; int numOptions, i; @@ -194,7 +194,7 @@ Tk_CreateOptionTable( hashTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(hashTablePtr, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, OPTION_HASH_KEY, DestroyOptionHashTable, - (ClientData) hashTablePtr); + hashTablePtr); } /* @@ -270,7 +270,7 @@ Tk_CreateOptionTable( || (specPtr->type == TK_OPTION_BORDER)) && (specPtr->clientData != NULL)) { optionPtr->extra.monoColorPtr = - Tcl_NewStringObj((char *) specPtr->clientData, -1); + Tcl_NewStringObj(specPtr->clientData, -1); Tcl_IncrRefCount(optionPtr->extra.monoColorPtr); } @@ -278,8 +278,8 @@ Tk_CreateOptionTable( /* * Get the custom parsing, etc., functions. */ - optionPtr->extra.custom = - (Tk_ObjCustomOption *) specPtr->clientData; + + optionPtr->extra.custom = specPtr->clientData; } } if (((specPtr->type == TK_OPTION_STRING) @@ -303,8 +303,8 @@ Tk_CreateOptionTable( */ if (specPtr->clientData != NULL) { - tablePtr->nextPtr = (OptionTable *) Tk_CreateOptionTable(interp, - (Tk_OptionSpec *) specPtr->clientData); + tablePtr->nextPtr = (OptionTable *) + Tk_CreateOptionTable(interp, specPtr->clientData); } return (Tk_OptionTable) tablePtr; @@ -385,7 +385,7 @@ DestroyOptionHashTable( ClientData clientData, /* The hash table we are destroying */ Tcl_Interp *interp) /* The interpreter we are destroying */ { - Tcl_HashTable *hashTablePtr = (Tcl_HashTable *) clientData; + Tcl_HashTable *hashTablePtr = clientData; Tcl_HashSearch search; Tcl_HashEntry *hashEntryPtr; OptionTable *tablePtr; @@ -634,7 +634,7 @@ DoObjConfig( Tk_SavedOption internal; /* Used to save the old internal * representation of the value if * savedOptionPtr is NULL. */ - CONST Tk_OptionSpec *specPtr; + const Tk_OptionSpec *specPtr; int nullOK; /* @@ -735,7 +735,7 @@ DoObjConfig( int newValue; if (Tcl_GetIndexFromObj(interp, valuePtr, - (CONST char **) optionPtr->specPtr->clientData, + optionPtr->specPtr->clientData, optionPtr->specPtr->optionName+1, 0, &newValue) != TCL_OK) { return TCL_ERROR; } @@ -1030,13 +1030,13 @@ ObjectIsEmpty( static Option * GetOption( - CONST char *name, /* String balue to be looked up in the option + const char *name, /* String balue to be looked up in the option * table. */ OptionTable *tablePtr) /* Table in which to look up name. */ { Option *bestPtr, *optionPtr; OptionTable *tablePtr2; - CONST char *p1, *p2; + const char *p1, *p2; int count; /* @@ -1184,9 +1184,9 @@ GetOptionFromObj( *---------------------------------------------------------------------- */ -CONST Tk_OptionSpec * +const Tk_OptionSpec * TkGetOptionSpec( - CONST char *name, /* String value to be looked up. */ + const char *name, /* String value to be looked up. */ Tk_OptionTable optionTable) /* Table in which to look up name. */ { Option *optionPtr; @@ -1262,7 +1262,7 @@ Tk_SetOptions( char *recordPtr, /* The record to configure. */ Tk_OptionTable optionTable, /* Describes valid options. */ int objc, /* The number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Contains one or more name-value pairs. */ + Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */ Tk_Window tkwin, /* Window associated with the thing being * configured; needed for some options (such * as colors). */ @@ -1385,7 +1385,7 @@ Tk_RestoreSavedOptions( * record. */ char *internalPtr; /* Points to internal value of option in * record. */ - CONST Tk_OptionSpec *specPtr; + const Tk_OptionSpec *specPtr; /* * Be sure to restore the options in the opposite order they were set. @@ -1575,7 +1575,7 @@ Tk_FreeConfigOptions( int count; Tcl_Obj **oldPtrPtr, *oldPtr; char *oldInternalPtr; - CONST Tk_OptionSpec *specPtr; + const Tk_OptionSpec *specPtr; for (tablePtr = (OptionTable *) optionTable; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 0ea2051..5d0ba6e 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.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: tkConsole.c,v 1.36 2008/04/01 16:30:52 dgp Exp $ + * RCS: @(#) $Id: tkConsole.c,v 1.37 2008/04/27 22:38:56 dkf Exp $ */ #include "tk.h" @@ -48,19 +48,19 @@ typedef struct ChannelData { static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp); static void ConsoleDeleteProc(ClientData clientData); static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr); -static int ConsoleHandle(ClientData instanceData, - int direction, ClientData *handlePtr); -static int ConsoleInput(ClientData instanceData, - char *buf, int toRead, int *errorCode); +static int ConsoleHandle(ClientData instanceData, int direction, + ClientData *handlePtr); +static int ConsoleInput(ClientData instanceData, char *buf, int toRead, + int *errorCode); static int ConsoleObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); -static int ConsoleOutput(ClientData instanceData, - CONST char *buf, int toWrite, int *errorCode); + int objc, Tcl_Obj *const objv[]); +static int ConsoleOutput(ClientData instanceData, const char *buf, + int toWrite, int *errorCode); static void ConsoleWatch(ClientData instanceData, int mask); static void DeleteConsoleInterp(ClientData clientData); static void InterpDeleteProc(ClientData clientData, Tcl_Interp *interp); static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); /* * This structure describes the channel type structure for file based IO: @@ -175,7 +175,7 @@ ShouldUseConsoleChannel( */ if (fileType == FILE_TYPE_CHAR) { - dcb.DCBlength = sizeof( DCB ) ; + dcb.DCBlength = sizeof(DCB); if (!GetConsoleMode(handle, &consoleParams) && !GetCommState(handle, &dcb)) { /* @@ -237,9 +237,12 @@ Tk_InitConsoleChannels( return; } - consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int)sizeof(int)); + consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); if (*consoleInitPtr) { - /* We've already initialized console channels in this thread. */ + /* + * We've already initialized console channels in this thread. + */ + return; } *consoleInitPtr = 1; @@ -250,15 +253,16 @@ Tk_InitConsoleChannels( if (!(doIn || doOut || doErr)) { /* - * No std channels should be tied to the console; - * Thus, no need to create the console + * No std channels should be tied to the console; thus, no need to + * create the console. */ + return; } /* - * At least one std channel wants to be tied to the console, - * so create the interp for it to live in. + * At least one std channel wants to be tied to the console, so create the + * interp for it to live in. */ info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo)); @@ -268,18 +272,16 @@ Tk_InitConsoleChannels( if (doIn) { ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData)); + data->info = info; data->info->refCount++; data->type = TCL_STDIN; consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console0", - (ClientData) data, TCL_READABLE); + data, TCL_READABLE); if (consoleChannel != NULL) { - Tcl_SetChannelOption(NULL, consoleChannel, - "-translation", "lf"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-buffering", "none"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-encoding", "utf-8"); + Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf"); + Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none"); + Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDIN); Tcl_RegisterChannel(NULL, consoleChannel); @@ -287,18 +289,16 @@ Tk_InitConsoleChannels( if (doOut) { ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData)); + data->info = info; data->info->refCount++; data->type = TCL_STDOUT; consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console1", - (ClientData) data, TCL_WRITABLE); + data, TCL_WRITABLE); if (consoleChannel != NULL) { - Tcl_SetChannelOption(NULL, consoleChannel, - "-translation", "lf"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-buffering", "none"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-encoding", "utf-8"); + Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf"); + Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none"); + Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDOUT); Tcl_RegisterChannel(NULL, consoleChannel); @@ -306,18 +306,16 @@ Tk_InitConsoleChannels( if (doErr) { ChannelData *data = (ChannelData *) ckalloc(sizeof(ChannelData)); + data->info = info; data->info->refCount++; data->type = TCL_STDERR; consoleChannel = Tcl_CreateChannel(&consoleChannelType, "console2", - (ClientData) data, TCL_WRITABLE); + data, TCL_WRITABLE); if (consoleChannel != NULL) { - Tcl_SetChannelOption(NULL, consoleChannel, - "-translation", "lf"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-buffering", "none"); - Tcl_SetChannelOption(NULL, consoleChannel, - "-encoding", "utf-8"); + Tcl_SetChannelOption(NULL, consoleChannel, "-translation", "lf"); + Tcl_SetChannelOption(NULL, consoleChannel, "-buffering", "none"); + Tcl_SetChannelOption(NULL, consoleChannel, "-encoding", "utf-8"); } Tcl_SetStdChannel(consoleChannel, TCL_STDERR); Tcl_RegisterChannel(NULL, consoleChannel); @@ -378,7 +376,7 @@ Tk_CreateConsoleWindow( } if (haveConsoleChannel) { - ChannelData *data = (ChannelData *)Tcl_GetChannelInstanceData(chan); + ChannelData *data = (ChannelData *) Tcl_GetChannelInstanceData(chan); info = data->info; if (info->consoleInterp) { /* New ConsoleInfo for a new console window */ @@ -388,21 +386,21 @@ Tk_CreateConsoleWindow( /* Update any console channels to make use of the new console */ if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDIN)) == &consoleChannelType) { - data = (ChannelData *)Tcl_GetChannelInstanceData(chan); + data = (ChannelData *) Tcl_GetChannelInstanceData(chan); data->info->refCount--; data->info = info; data->info->refCount++; } if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDOUT)) == &consoleChannelType) { - data = (ChannelData *)Tcl_GetChannelInstanceData(chan); + data = (ChannelData *) Tcl_GetChannelInstanceData(chan); data->info->refCount--; data->info = info; data->info->refCount++; } if (Tcl_GetChannelType(chan = Tcl_GetStdChannel(TCL_STDERR)) == &consoleChannelType) { - data = (ChannelData *)Tcl_GetChannelInstanceData(chan); + data = (ChannelData *) Tcl_GetChannelInstanceData(chan); data->info->refCount--; data->info = info; data->info->refCount++; @@ -416,17 +414,16 @@ Tk_CreateConsoleWindow( info->consoleInterp = consoleInterp; info->interp = interp; - Tcl_CallWhenDeleted(consoleInterp, InterpDeleteProc, (ClientData) info); + Tcl_CallWhenDeleted(consoleInterp, InterpDeleteProc, info); info->refCount++; - Tcl_CreateThreadExitHandler(DeleteConsoleInterp, - (ClientData) consoleInterp); + Tcl_CreateThreadExitHandler(DeleteConsoleInterp, consoleInterp); /* * Add console commands to the interp */ - token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd, - (ClientData) info, ConsoleDeleteProc); + token = Tcl_CreateObjCommand(interp, "console", ConsoleObjCmd, info, + ConsoleDeleteProc); info->refCount++; /* @@ -435,29 +432,29 @@ Tk_CreateConsoleWindow( * handler takes care of us. */ Tcl_CreateObjCommand(consoleInterp, "consoleinterp", InterpreterObjCmd, - (ClientData) info, NULL); + info, NULL); mainWindow = Tk_MainWindow(interp); if (mainWindow) { Tk_CreateEventHandler(mainWindow, StructureNotifyMask, - ConsoleEventProc, (ClientData) info); + ConsoleEventProc, info); info->refCount++; } - Tcl_Preserve((ClientData) consoleInterp); + Tcl_Preserve(consoleInterp); result = Tcl_GlobalEval(consoleInterp, "source $tk_library/console.tcl"); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp)); } - Tcl_Release((ClientData) consoleInterp); + Tcl_Release(consoleInterp); if (result == TCL_ERROR) { Tcl_DeleteCommandFromToken(interp, token); mainWindow = Tk_MainWindow(interp); if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, - ConsoleEventProc, (ClientData) info); + ConsoleEventProc, info); if (--info->refCount <= 0) { ckfree((char *) info); } @@ -466,7 +463,7 @@ Tk_CreateConsoleWindow( } return TCL_OK; - error: + error: Tcl_AddErrorInfo(interp, "\n (creating console window)"); if (!Tcl_InterpDeleted(consoleInterp)) { Tcl_DeleteInterp(consoleInterp); @@ -495,11 +492,11 @@ Tk_CreateConsoleWindow( static int ConsoleOutput( ClientData instanceData, /* Indicates which device to use. */ - CONST char *buf, /* The data buffer. */ + const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ { - ChannelData *data = (ChannelData *)instanceData; + ChannelData *data = instanceData; ConsoleInfo *info = data->info; *errorCode = 0; @@ -510,6 +507,7 @@ ConsoleOutput( if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1); + if (data->type == TCL_STDERR) { Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("stderr", -1)); @@ -517,7 +515,8 @@ ConsoleOutput( Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("stdout", -1)); } - Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj(buf, toWrite)); + Tcl_ListObjAppendElement(NULL, cmd, + Tcl_NewStringObj(buf, toWrite)); Tcl_IncrRefCount(cmd); Tcl_GlobalEvalObj(consoleInterp, cmd); Tcl_DecrRefCount(cmd); @@ -576,12 +575,15 @@ ConsoleClose( ClientData instanceData, /* Unused. */ Tcl_Interp *interp) /* Unused. */ { - ChannelData *data = (ChannelData *)instanceData; + ChannelData *data = instanceData; ConsoleInfo *info = data->info; if (info) { if (--info->refCount <= 0) { - /* Assuming the Tcl_Interp * fields must already be NULL */ + /* + * Assuming the Tcl_Interp * fields must already be NULL. + */ + ckfree((char *) info); } } @@ -668,10 +670,10 @@ ConsoleObjCmd( ClientData clientData, /* Access to the console interp */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj *CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { int index, result; - static CONST char *options[] = {"eval", "hide", "show", "title", NULL}; + static const char *options[] = {"eval", "hide", "show", "title", NULL}; enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE}; Tcl_Obj *cmd = NULL; ConsoleInfo *info = (ConsoleInfo *) clientData; @@ -722,12 +724,12 @@ ConsoleObjCmd( Tcl_IncrRefCount(cmd); if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { - Tcl_Preserve((ClientData) consoleInterp); + Tcl_Preserve(consoleInterp); result = Tcl_GlobalEvalObj(consoleInterp, cmd); Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(consoleInterp)); - Tcl_Release((ClientData) consoleInterp); + Tcl_Release(consoleInterp); } else { Tcl_AppendResult(interp, "no active console interp", NULL); result = TCL_ERROR; @@ -755,12 +757,12 @@ InterpreterObjCmd( ClientData clientData, /* */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj *CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { int index, result = TCL_OK; - static CONST char *options[] = {"eval", "record", NULL}; + static const char *options[] = {"eval", "record", NULL}; enum option {OTHER_EVAL, OTHER_RECORD}; - ConsoleInfo *info = (ConsoleInfo *) clientData; + ConsoleInfo *info = clientData; Tcl_Interp *otherInterp = info->interp; if (objc < 2) { @@ -782,28 +784,32 @@ InterpreterObjCmd( return TCL_ERROR; } - Tcl_Preserve((ClientData) otherInterp); + Tcl_Preserve(otherInterp); switch ((enum option) index) { case OTHER_EVAL: result = Tcl_GlobalEvalObj(otherInterp, objv[2]); + /* * TODO: Should exceptions be filtered here? */ + Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(otherInterp, result)); Tcl_SetObjResult(interp, Tcl_GetObjResult(otherInterp)); break; case OTHER_RECORD: Tcl_RecordAndEvalObj(otherInterp, objv[2], TCL_EVAL_GLOBAL); + /* - * By not setting result, we discard any exceptions or errors here - * and always return TCL_OK. All the caller wants is the - * interp result to display, whether that's result or error message. + * By not setting result, we discard any exceptions or errors here and + * always return TCL_OK. All the caller wants is the interp result to + * display, whether that's result or error message. */ + Tcl_SetObjResult(interp, Tcl_GetObjResult(otherInterp)); break; } - Tcl_Release((ClientData) otherInterp); + Tcl_Release(otherInterp); return result; } @@ -812,8 +818,8 @@ InterpreterObjCmd( * * DeleteConsoleInterp -- * - * Thread exit handler to destroy a console interp when the - * thread it lives in gets torn down. + * Thread exit handler to destroy a console interp when the thread it + * lives in gets torn down. * *---------------------------------------------------------------------- */ @@ -822,7 +828,8 @@ static void DeleteConsoleInterp( ClientData clientData) { - Tcl_Interp *interp = (Tcl_Interp *)clientData; + Tcl_Interp *interp = clientData; + Tcl_DeleteInterp(interp); } @@ -831,8 +838,8 @@ DeleteConsoleInterp( * * InterpDeleteProc -- * - * React when the interp in which the console is displayed is deleted - * for any reason. + * React when the interp in which the console is displayed is deleted for + * any reason. * * Results: * None. @@ -848,11 +855,10 @@ InterpDeleteProc( ClientData clientData, Tcl_Interp *interp) { - ConsoleInfo *info = (ConsoleInfo *) clientData; + ConsoleInfo *info = clientData; if (info->consoleInterp == interp) { - Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, - (ClientData) info->consoleInterp); + Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; } if (--info->refCount <= 0) { @@ -881,7 +887,7 @@ static void ConsoleDeleteProc( ClientData clientData) { - ConsoleInfo *info = (ConsoleInfo *) clientData; + ConsoleInfo *info = clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); @@ -916,7 +922,7 @@ ConsoleEventProc( XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { - ConsoleInfo *info = (ConsoleInfo *) clientData; + ConsoleInfo *info = clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 8837028..d4e112d 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.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: tkCursor.c,v 1.18 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkCursor.c,v 1.19 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -25,8 +25,8 @@ */ typedef struct { - CONST char *source; /* Cursor bits. */ - CONST char *mask; /* Mask bits. */ + const char *source; /* Cursor bits. */ + const char *mask; /* Mask bits. */ int width, height; /* Dimensions of cursor (and data and * mask). */ int xHot, yHot; /* Location of cursor hot-spot. */ @@ -43,8 +43,8 @@ static void DupCursorObjProc(Tcl_Obj *srcObjPtr, Tcl_Obj *dupObjPtr); static void FreeCursor(TkCursor *cursorPtr); static void FreeCursorObjProc(Tcl_Obj *objPtr); -static TkCursor * TkcGetCursor(Tcl_Interp *interp, - Tk_Window tkwin, CONST char *name); +static TkCursor * TkcGetCursor(Tcl_Interp *interp, Tk_Window tkwin, + const char *name); static TkCursor * GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); static void InitCursorObj(Tcl_Obj *objPtr); @@ -101,7 +101,7 @@ Tk_AllocCursorFromObj( if (objPtr->typePtr != &tkCursorObjType) { InitCursorObj(objPtr); } - cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we @@ -130,15 +130,15 @@ Tk_AllocCursorFromObj( */ if (cursorPtr != NULL) { - TkCursor *firstCursorPtr = (TkCursor *) - Tcl_GetHashValue(cursorPtr->hashPtr); + TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + FreeCursorObjProc(objPtr); for (cursorPtr = firstCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { cursorPtr->resourceRefCount++; cursorPtr->objRefCount++; - objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; + objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; return cursorPtr->cursor; } } @@ -149,7 +149,7 @@ Tk_AllocCursorFromObj( */ cursorPtr = TkcGetCursor(interp, tkwin, Tcl_GetString(objPtr)); - objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; + objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; if (cursorPtr == NULL) { return None; } @@ -189,6 +189,7 @@ Tk_GetCursor( * details on legal syntax. */ { TkCursor *cursorPtr = TkcGetCursor(interp, tkwin, string); + if (cursorPtr == NULL) { return None; } @@ -225,7 +226,7 @@ static TkCursor * TkcGetCursor( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ - CONST char *string) /* Description of cursor. See manual entry for + const char *string) /* Description of cursor. See manual entry for * details on legal syntax. */ { Tcl_HashEntry *nameHashPtr; @@ -241,7 +242,7 @@ TkcGetCursor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable, string, &isNew); if (!isNew) { - existingCursorPtr = (TkCursor *) Tcl_GetHashValue(nameHashPtr); + existingCursorPtr = Tcl_GetHashValue(nameHashPtr); for (cursorPtr = existingCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { @@ -311,8 +312,8 @@ Tk_Cursor Tk_GetCursorFromData( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ - CONST char *source, /* Bitmap data for cursor shape. */ - CONST char *mask, /* Bitmap data for cursor mask. */ + const char *source, /* Bitmap data for cursor shape. */ + const char *mask, /* Bitmap data for cursor mask. */ int width, int height, /* Dimensions of cursor. */ int xHot, int yHot, /* Location of hot-spot in cursor. */ Tk_Uid fg, /* Foreground color for cursor. */ @@ -341,7 +342,7 @@ Tk_GetCursorFromData( dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable, (char *) &dataKey, &isNew); if (!isNew) { - cursorPtr = (TkCursor *) Tcl_GetHashValue(dataHashPtr); + cursorPtr = Tcl_GetHashValue(dataHashPtr); cursorPtr->resourceRefCount++; return cursorPtr->cursor; } @@ -407,7 +408,7 @@ Tk_GetCursorFromData( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfCursor( Display *display, /* Display for which cursor was allocated. */ Tk_Cursor cursor) /* Identifier for cursor whose name is @@ -428,7 +429,7 @@ Tk_NameOfCursor( if (idHashPtr == NULL) { goto printid; } - cursorPtr = (TkCursor *) Tcl_GetHashValue(idHashPtr); + cursorPtr = Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } @@ -465,7 +466,7 @@ FreeCursor( } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); - prevPtr = (TkCursor *) Tcl_GetHashValue(cursorPtr->hashPtr); + prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); @@ -518,7 +519,7 @@ Tk_FreeCursor( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } - FreeCursor((TkCursor *) Tcl_GetHashValue(idHashPtr)); + FreeCursor(Tcl_GetHashValue(idHashPtr)); } /* @@ -575,7 +576,7 @@ static void FreeCursorObjProc( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkCursor *cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { cursorPtr->objRefCount--; @@ -610,10 +611,10 @@ DupCursorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkCursor *cursorPtr = (TkCursor *) srcObjPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; if (cursorPtr != NULL) { cursorPtr->objRefCount++; @@ -695,7 +696,7 @@ GetCursorFromObj( * cached is the one that is needed. */ - cursorPtr = (TkCursor *) objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { return cursorPtr; } @@ -710,11 +711,11 @@ GetCursorFromObj( if (hashPtr == NULL) { goto error; } - for (cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr); + for (cursorPtr = Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { FreeCursorObjProc(objPtr); - objPtr->internalRep.twoPtrValue.ptr1 = (void *) cursorPtr; + objPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; cursorPtr->objRefCount++; return cursorPtr; } @@ -845,7 +846,7 @@ TkDebugCursor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name); if (hashPtr != NULL) { - cursorPtr = (TkCursor *) Tcl_GetHashValue(hashPtr); + cursorPtr = Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 62b0806..25126bc 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.47 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.48 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -319,7 +319,7 @@ static const Tk_OptionSpec sbOptSpec[] = { * dispatch the entry widget command. */ -static CONST char *entryCmdNames[] = { +static const char *entryCmdNames[] = { "bbox", "cget", "configure", "delete", "get", "icursor", "index", "insert", "scan", "selection", "validate", "xview", NULL }; @@ -330,7 +330,7 @@ enum entryCmd { COMMAND_SCAN, COMMAND_SELECTION, COMMAND_VALIDATE, COMMAND_XVIEW }; -static CONST char *selCmdNames[] = { +static const char *selCmdNames[] = { "adjust", "clear", "from", "present", "range", "to", NULL }; @@ -345,7 +345,7 @@ enum selCmd { * dispatch the spinbox widget command. */ -static CONST char *sbCmdNames[] = { +static const char *sbCmdNames[] = { "bbox", "cget", "configure", "delete", "get", "icursor", "identify", "index", "insert", "invoke", "scan", "selection", "set", "validate", "xview", NULL @@ -358,7 +358,7 @@ enum sbCmd { SB_CMD_SET, SB_CMD_VALIDATE, SB_CMD_XVIEW }; -static CONST char *sbSelCmdNames[] = { +static const char *sbSelCmdNames[] = { "adjust", "clear", "element", "from", "present", "range", "to", NULL }; @@ -376,7 +376,7 @@ enum sbselCmd { * modify them, you must modify the strings here. */ -static CONST char *selElementNames[] = { +static const char *selElementNames[] = { "none", "buttondown", "buttonup", NULL, "entry" }; @@ -392,7 +392,7 @@ static CONST char *selElementNames[] = { */ static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr, - int objc, Tcl_Obj *CONST objv[], int flags); + int objc, Tcl_Obj *const objv[], int flags); static void DeleteChars(Entry *entryPtr, int index, int count); static void DestroyEntry(char *memPtr); static void DisplayEntry(ClientData clientData); @@ -407,25 +407,25 @@ static int EntryFetchSelection(ClientData clientData, int offset, static void EntryLostSelection(ClientData clientData); static void EventuallyRedraw(Entry *entryPtr); static void EntryScanTo(Entry *entryPtr, int y); -static void EntrySetValue(Entry *entryPtr, CONST char *value); +static void EntrySetValue(Entry *entryPtr, const char *value); static void EntrySelectTo(Entry *entryPtr, int index); static char * EntryTextVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static void EntryUpdateScrollbar(Entry *entryPtr); static int EntryValidate(Entry *entryPtr, char *cmd); static int EntryValidateChange(Entry *entryPtr, char *change, - CONST char *newStr, int index, int type); -static void ExpandPercents(Entry *entryPtr, CONST char *before, - CONST char *change, CONST char *newStr, int index, + const char *newStr, int index, int type); +static void ExpandPercents(Entry *entryPtr, const char *before, + const char *change, const char *newStr, int index, int type, Tcl_DString *dsPtr); static void EntryValueChanged(Entry *entryPtr, - CONST char *newValue); + const char *newValue); static void EntryVisibleRange(Entry *entryPtr, double *firstPtr, double *lastPtr); static int EntryWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void EntryWorldChanged(ClientData instanceData); static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr, char *string, int *indexPtr); @@ -437,7 +437,7 @@ static void InsertChars(Entry *entryPtr, int index, char *string); static int SpinboxWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int GetSpinboxElement(Spinbox *sbPtr, int x, int y); static int SpinboxInvoke(Tcl_Interp *interp, Spinbox *sbPtr, int element); @@ -476,7 +476,7 @@ Tk_EntryObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Entry *entryPtr; Tk_OptionTable optionTable; @@ -515,11 +515,11 @@ Tk_EntryObjCmd( entryPtr->display = Tk_Display(tkwin); entryPtr->interp = interp; entryPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(entryPtr->tkwin), EntryWidgetObjCmd, - (ClientData) entryPtr, EntryCmdDeletedProc); + Tk_PathName(entryPtr->tkwin), EntryWidgetObjCmd, entryPtr, + EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_ENTRY; - tmp = (char *) ckalloc(1); + tmp = ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -543,15 +543,15 @@ Tk_EntryObjCmd( * otherwise Tk might free it while we still need it. */ - Tcl_Preserve((ClientData) entryPtr->tkwin); + Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Entry"); - Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); + Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - EntryEventProc, (ClientData) entryPtr); + EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, - EntryFetchSelection, (ClientData) entryPtr, XA_STRING); + EntryFetchSelection, entryPtr, XA_STRING); if ((Tk_InitOptions(interp, (char *) entryPtr, optionTable, tkwin) != TCL_OK) || @@ -587,9 +587,9 @@ EntryWidgetObjCmd( ClientData clientData, /* Information about entry widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -603,13 +603,13 @@ EntryWidgetObjCmd( * valid command names. */ - result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames, - "option", 0, &cmdIndex); + result = Tcl_GetIndexFromObj(interp, objv[1], entryCmdNames, "option", 0, + &cmdIndex); if (result != TCL_OK) { return result; } - Tcl_Preserve((ClientData) entryPtr); + Tcl_Preserve(entryPtr); switch ((enum entryCmd) cmdIndex) { case COMMAND_BBOX: { int index, x, y, width, height; @@ -882,7 +882,7 @@ EntryWidgetObjCmd( if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, - EntryLostSelection, (ClientData) entryPtr); + EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } EventuallyRedraw(entryPtr); @@ -980,11 +980,11 @@ EntryWidgetObjCmd( } done: - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); return result; error: - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); return TCL_ERROR; } @@ -1021,7 +1021,7 @@ DestroyEntry( if (entryPtr->textVarName != NULL) { Tcl_UntraceVar(entryPtr->interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - EntryTextVarProc, (ClientData) entryPtr); + EntryTextVarProc, entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } if (entryPtr->textGC != None) { @@ -1048,7 +1048,7 @@ DestroyEntry( Tk_FreeTextLayout(entryPtr->textLayout); Tk_FreeConfigOptions((char *) entryPtr, entryPtr->optionTable, entryPtr->tkwin); - Tcl_Release((ClientData) entryPtr->tkwin); + Tcl_Release(entryPtr->tkwin); entryPtr->tkwin = NULL; ckfree((char *) entryPtr); @@ -1080,7 +1080,7 @@ ConfigureEntry( Entry *entryPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ + Tcl_Obj *const objv[], /* Argument objects. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; @@ -1105,7 +1105,7 @@ ConfigureEntry( && (entryPtr->flags & ENTRY_VAR_TRACED)) { Tcl_UntraceVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - EntryTextVarProc, (ClientData) entryPtr); + EntryTextVarProc, entryPtr); entryPtr->flags &= ~ENTRY_VAR_TRACED; } @@ -1266,7 +1266,7 @@ ConfigureEntry( && (entryPtr->selectFirst != -1) && !(entryPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, - (ClientData) entryPtr); + entryPtr); entryPtr->flags |= GOT_SELECTION; } @@ -1294,7 +1294,7 @@ ConfigureEntry( */ if (entryPtr->textVarName != NULL) { - CONST char *value; + const char *value; value = Tcl_GetVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY); if (value == NULL) { @@ -1355,11 +1355,11 @@ ConfigureEntry( && !(entryPtr->flags & ENTRY_VAR_TRACED)) { Tcl_TraceVar(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - EntryTextVarProc, (ClientData) entryPtr); + EntryTextVarProc, entryPtr); entryPtr->flags |= ENTRY_VAR_TRACED; } - EntryWorldChanged((ClientData) entryPtr); + EntryWorldChanged(entryPtr); if (error) { Tcl_SetObjResult(interp, errorResult); Tcl_DecrRefCount(errorResult); @@ -1548,7 +1548,7 @@ static void DisplayEntry( ClientData clientData) /* Information about window. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; Tk_Window tkwin = entryPtr->tkwin; int baseY, selStartX, selEndX, cursorX; int showSelection, xBound; @@ -1575,14 +1575,14 @@ DisplayEntry( * side-effect of destroying or unmapping the entry widget. */ - Tcl_Preserve((ClientData) entryPtr); + Tcl_Preserve(entryPtr); EntryUpdateScrollbar(entryPtr); if ((entryPtr->flags & ENTRY_DELETED) || !Tk_IsMapped(tkwin)) { - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); return; } - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); } #ifndef TK_NO_DOUBLE_BUFFERING @@ -2011,7 +2011,7 @@ InsertChars( ptrdiff_t byteIndex; size_t byteCount, newByteCount; int oldChars, charsAdded; - CONST char *string; + const char *string; char *newStr; string = entryPtr->string; @@ -2107,7 +2107,7 @@ DeleteChars( int count) /* How many characters to delete. */ { int byteIndex, byteCount, newByteCount; - CONST char *string; + const char *string; char *newStr, *toDelete; if ((index + count) > entryPtr->numChars) { @@ -2219,7 +2219,7 @@ DeleteChars( static void EntryValueChanged( Entry *entryPtr, /* Entry whose value just changed. */ - CONST char *newValue) /* If this value is not NULL, we first force + const char *newValue) /* If this value is not NULL, we first force * the value of the entry to this. */ { if (newValue != NULL) { @@ -2279,9 +2279,9 @@ EntryValueChanged( static void EntrySetValue( Entry *entryPtr, /* Entry whose value is to be changed. */ - CONST char *value) /* New text to display in entry. */ + const char *value) /* New text to display in entry. */ { - CONST char *oldSource; + const char *oldSource; int valueLen, malloced = 0; if (strcmp(value, entryPtr->string) == 0) { @@ -2387,10 +2387,10 @@ EntryEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) { - Spinbox *sbPtr = (Spinbox *) clientData; + Spinbox *sbPtr = clientData; int elem; elem = GetSpinboxElement(sbPtr, eventPtr->xmotion.x, @@ -2431,11 +2431,11 @@ EntryEventProc( } break; case ConfigureNotify: - Tcl_Preserve((ClientData) entryPtr); + Tcl_Preserve(entryPtr); entryPtr->flags |= UPDATE_SCROLLBAR; EntryComputeGeometry(entryPtr); EventuallyRedraw(entryPtr); - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); break; case FocusIn: case FocusOut: @@ -2468,7 +2468,7 @@ static void EntryCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; /* * This function could be invoked either because the window was destroyed @@ -2691,7 +2691,7 @@ EntrySelectTo( if (!(entryPtr->flags & GOT_SELECTION) && (entryPtr->exportSelection)) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, EntryLostSelection, - (ClientData) entryPtr); + entryPtr); entryPtr->flags |= GOT_SELECTION; } @@ -2751,10 +2751,10 @@ EntryFetchSelection( int maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NUL character. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; int byteCount; - CONST char *string; - CONST char *selStart, *selEnd; + const char *string; + const char *selStart, *selEnd; if ((entryPtr->selectFirst < 0) || !(entryPtr->exportSelection)) { return -1; @@ -2797,7 +2797,7 @@ static void EntryLostSelection( ClientData clientData) /* Information about entry widget. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; entryPtr->flags &= ~GOT_SELECTION; @@ -2851,7 +2851,7 @@ EventuallyRedraw( if (!(entryPtr->flags & REDRAW_PENDING)) { entryPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayEntry, (ClientData) entryPtr); + Tcl_DoWhenIdle(DisplayEntry, entryPtr); } } @@ -2938,7 +2938,7 @@ EntryUpdateScrollbar( } interp = entryPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); EntryVisibleRange(entryPtr, &first, &last); sprintf(args, " %g %g", first, last); code = Tcl_VarEval(interp, entryPtr->scrollCmd, args, NULL); @@ -2950,7 +2950,7 @@ EntryUpdateScrollbar( Tcl_BackgroundError(interp); } Tcl_SetResult(interp, NULL, TCL_STATIC); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* @@ -2975,7 +2975,7 @@ static void EntryBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - Entry *entryPtr = (Entry *) clientData; + Entry *entryPtr = clientData; if ((entryPtr->state == STATE_DISABLED) || (entryPtr->state == STATE_READONLY) || @@ -2985,11 +2985,11 @@ EntryBlinkProc( if (entryPtr->flags & CURSOR_ON) { entryPtr->flags &= ~CURSOR_ON; entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - entryPtr->insertOffTime, EntryBlinkProc, (ClientData) entryPtr); + entryPtr->insertOffTime, EntryBlinkProc, entryPtr); } else { entryPtr->flags |= CURSOR_ON; entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - entryPtr->insertOnTime, EntryBlinkProc, (ClientData) entryPtr); + entryPtr->insertOnTime, EntryBlinkProc, entryPtr); } EventuallyRedraw(entryPtr); } @@ -3023,23 +3023,22 @@ EntryFocusProc( entryPtr->flags |= GOT_FOCUS | CURSOR_ON; if (entryPtr->insertOffTime != 0) { entryPtr->insertBlinkHandler = Tcl_CreateTimerHandler( - entryPtr->insertOnTime, EntryBlinkProc, - (ClientData) entryPtr); + entryPtr->insertOnTime, EntryBlinkProc, entryPtr); } if (entryPtr->validate == VALIDATE_ALL || - entryPtr->validate == VALIDATE_FOCUS || - entryPtr->validate == VALIDATE_FOCUSIN) { - EntryValidateChange(entryPtr, NULL, - entryPtr->string, -1, VALIDATE_FOCUSIN); + entryPtr->validate == VALIDATE_FOCUS || + entryPtr->validate == VALIDATE_FOCUSIN) { + EntryValidateChange(entryPtr, NULL, entryPtr->string, -1, + VALIDATE_FOCUSIN); } } else { entryPtr->flags &= ~(GOT_FOCUS | CURSOR_ON); - entryPtr->insertBlinkHandler = (Tcl_TimerToken) NULL; + entryPtr->insertBlinkHandler = NULL; if (entryPtr->validate == VALIDATE_ALL || - entryPtr->validate == VALIDATE_FOCUS || - entryPtr->validate == VALIDATE_FOCUSOUT) { - EntryValidateChange(entryPtr, NULL, - entryPtr->string, -1, VALIDATE_FOCUSOUT); + entryPtr->validate == VALIDATE_FOCUS || + entryPtr->validate == VALIDATE_FOCUSOUT) { + EntryValidateChange(entryPtr, NULL, entryPtr->string, -1, + VALIDATE_FOCUSOUT); } } EventuallyRedraw(entryPtr); @@ -3067,12 +3066,12 @@ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* Not used. */ - CONST char *name2, /* Not used. */ + const char *name1, /* Not used. */ + const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - Entry *entryPtr = (Entry *) clientData; - CONST char *value; + Entry *entryPtr = clientData; + const char *value; if (entryPtr->flags & ENTRY_DELETED) { /* @@ -3197,7 +3196,7 @@ EntryValidateChange( register Entry *entryPtr, /* Entry that needs validation. */ char *change, /* Characters to be added/deleted * (NUL-terminated string). */ - CONST char *newValue, /* Potential new value of entry string */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete, -1 otherwise */ int type) /* forced, delete, insert, focusin or * focusout */ @@ -3331,12 +3330,12 @@ EntryValidateChange( static void ExpandPercents( register Entry *entryPtr, /* Entry that needs validation. */ - register CONST char *before, + register const char *before, /* Command containing percent expressions to * be replaced. */ - CONST char *change, /* Characters to added/deleted (NUL-terminated + const char *change, /* Characters to added/deleted (NUL-terminated * string). */ - CONST char *newValue, /* Potential new value of entry string */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete */ int type, /* INSERT or DELETE */ Tcl_DString *dsPtr) /* Dynamic string in which to append new @@ -3345,7 +3344,7 @@ ExpandPercents( int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; - register CONST char *string; + register const char *string; Tcl_UniChar ch; char numStorage[2*TCL_INTEGER_SPACE]; @@ -3498,7 +3497,7 @@ Tk_SpinboxObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Entry *entryPtr; register Spinbox *sbPtr; @@ -3539,11 +3538,11 @@ Tk_SpinboxObjCmd( entryPtr->display = Tk_Display(tkwin); entryPtr->interp = interp; entryPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(entryPtr->tkwin), SpinboxWidgetObjCmd, - (ClientData) sbPtr, EntryCmdDeletedProc); + Tk_PathName(entryPtr->tkwin), SpinboxWidgetObjCmd, sbPtr, + EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_SPINBOX; - tmp = (char *) ckalloc(1); + tmp = ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -3570,7 +3569,7 @@ Tk_SpinboxObjCmd( sbPtr->fromValue = 0.0; sbPtr->toValue = 100.0; sbPtr->increment = 1.0; - sbPtr->formatBuf = (char *) ckalloc(TCL_DOUBLE_SPACE); + sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE); sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; @@ -3579,15 +3578,15 @@ Tk_SpinboxObjCmd( * otherwise Tk might free it while we still need it. */ - Tcl_Preserve((ClientData) entryPtr->tkwin); + Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Spinbox"); - Tk_SetClassProcs(entryPtr->tkwin, &entryClass, (ClientData) entryPtr); + Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, PointerMotionMask|ExposureMask|StructureNotifyMask|FocusChangeMask, - EntryEventProc, (ClientData) entryPtr); + EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, - EntryFetchSelection, (ClientData) entryPtr, XA_STRING); + EntryFetchSelection, entryPtr, XA_STRING); if (Tk_InitOptions(interp, (char *) sbPtr, optionTable, tkwin) != TCL_OK) { @@ -3601,7 +3600,7 @@ Tk_SpinboxObjCmd( Tcl_SetResult(interp, Tk_PathName(entryPtr->tkwin), TCL_STATIC); return TCL_OK; - error: + error: Tk_DestroyWindow(entryPtr->tkwin); return TCL_ERROR; } @@ -3629,10 +3628,10 @@ SpinboxWidgetObjCmd( ClientData clientData, /* Information about spinbox widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = (Entry *) clientData; - Spinbox *sbPtr = (Spinbox *) clientData; + Entry *entryPtr = clientData; + Spinbox *sbPtr = clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -3652,7 +3651,7 @@ SpinboxWidgetObjCmd( return result; } - Tcl_Preserve((ClientData) entryPtr); + Tcl_Preserve(entryPtr); switch ((enum sbCmd) cmdIndex) { case SB_CMD_BBOX: { int index, x, y, width, height; @@ -3669,8 +3668,7 @@ SpinboxWidgetObjCmd( if ((index == entryPtr->numChars) && (index > 0)) { index--; } - Tk_CharBbox(entryPtr->textLayout, index, &x, &y, - &width, &height); + Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); sprintf(buf, "%d %d %d %d", x + entryPtr->layoutX, y + entryPtr->layoutY, width, height); Tcl_SetResult(interp, buf, TCL_VOLATILE); @@ -3695,8 +3693,7 @@ SpinboxWidgetObjCmd( case SB_CMD_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, (char *) entryPtr, - entryPtr->optionTable, - (objc == 3) ? objv[2] : NULL, + entryPtr->optionTable, (objc == 3) ? objv[2] : NULL, entryPtr->tkwin); if (objPtr == NULL) { goto error; @@ -3738,6 +3735,7 @@ SpinboxWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } + /* FIXME: modification of objresult */ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1); break; @@ -3766,6 +3764,7 @@ SpinboxWidgetObjCmd( } elem = GetSpinboxElement(sbPtr, x, y); if (elem != SEL_NONE) { + /* FIXME: modification of objresult */ Tcl_SetStringObj(Tcl_GetObjResult(interp), selElementNames[elem], -1); } @@ -3962,9 +3961,9 @@ SpinboxWidgetObjCmd( entryPtr->selectLast = index2; } if (!(entryPtr->flags & GOT_SELECTION) - && (entryPtr->exportSelection)) { + && entryPtr->exportSelection) { Tk_OwnSelection(entryPtr->tkwin, XA_PRIMARY, - EntryLostSelection, (ClientData) entryPtr); + EntryLostSelection, entryPtr); entryPtr->flags |= GOT_SELECTION; } EventuallyRedraw(entryPtr); @@ -3988,6 +3987,7 @@ SpinboxWidgetObjCmd( goto error; } if (objc == 3) { + /* FIXME: modification of objresult */ Tcl_SetStringObj(Tcl_GetObjResult(interp), selElementNames[sbPtr->selElement], -1); } else { @@ -4015,6 +4015,7 @@ SpinboxWidgetObjCmd( if (objc == 3) { EntryValueChanged(entryPtr, Tcl_GetString(objv[2])); } + /* FIXME: modification of objresult */ Tcl_SetStringObj(Tcl_GetObjResult(interp), entryPtr->string, -1); break; @@ -4032,6 +4033,7 @@ SpinboxWidgetObjCmd( if (entryPtr->validate != VALIDATE_NONE) { entryPtr->validate = selIndex; } + /* FIXME: modification of objresult */ Tcl_SetObjResult(interp, Tcl_NewBooleanObj((code == TCL_OK))); break; } @@ -4096,11 +4098,11 @@ SpinboxWidgetObjCmd( } done: - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); return result; error: - Tcl_Release((ClientData) entryPtr); + Tcl_Release(entryPtr); return TCL_ERROR; } diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 06e63d6..94cdbcd 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -9,19 +9,19 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFileFilter.c,v 1.10 2007/05/09 12:51:30 das Exp $ + * RCS: @(#) $Id: tkFileFilter.c,v 1.11 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" #include "tkFileFilter.h" -static int AddClause(Tcl_Interp *interp, - FileFilter *filterPtr, Tcl_Obj *patternsObj, - Tcl_Obj *ostypesObj, int isWindows); +static int AddClause(Tcl_Interp *interp, FileFilter *filterPtr, + Tcl_Obj *patternsObj, Tcl_Obj *ostypesObj, + int isWindows); static void FreeClauses(FileFilter *filterPtr); static void FreeGlobPatterns(FileFilterClause *clausePtr); static void FreeMacFileTypes(FileFilterClause *clausePtr); -static FileFilter * GetFilter(FileFilterList *flistPtr, CONST char *name); +static FileFilter * GetFilter(FileFilterList *flistPtr, const char *name); /* *---------------------------------------------------------------------- @@ -169,8 +169,8 @@ TkFreeFileFilters( toFree = filterPtr; filterPtr = filterPtr->next; FreeClauses(toFree); - ckfree((char*)toFree->name); - ckfree((char*)toFree); + ckfree(toFree->name); + ckfree((char *) toFree); } flistPtr->filters = NULL; } @@ -233,7 +233,7 @@ AddClause( for (i=0; i<ostypeCount; i++) { int len; - CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); + const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); /* * If len is < 4, it is definitely an error. If equal or longer, @@ -273,10 +273,10 @@ AddClause( * Add the clause into the list of clauses */ - clausePtr = (FileFilterClause*)ckalloc(sizeof(FileFilterClause)); - clausePtr->patterns = NULL; + clausePtr = (FileFilterClause *) ckalloc(sizeof(FileFilterClause)); + clausePtr->patterns = NULL; clausePtr->patternsTail = NULL; - clausePtr->macTypes = NULL; + clausePtr->macTypes = NULL; clausePtr->macTypesTail = NULL; if (filterPtr->clauses == NULL) { @@ -289,39 +289,39 @@ AddClause( if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { - GlobPattern *globPtr = (GlobPattern*)ckalloc(sizeof(GlobPattern)); + GlobPattern *globPtr = (GlobPattern *) + ckalloc(sizeof(GlobPattern)); int len; + const char *str = Tcl_GetStringFromObj(globList[i], &len); - CONST char *str = Tcl_GetStringFromObj(globList[i], &len); len = (len + 1) * sizeof(char); - if (str[0] && str[0] != '*') { /* * Prepend a "*" to patterns that do not have a leading "*" */ - globPtr->pattern = (char*)ckalloc((unsigned int) len+1); + globPtr->pattern = ckalloc((unsigned) len+1); globPtr->pattern[0] = '*'; strcpy(globPtr->pattern+1, str); } else if (isWindows) { if (strcmp(str, "*") == 0) { - globPtr->pattern = (char*)ckalloc(4 * sizeof(char)); + globPtr->pattern = ckalloc(4 * sizeof(char)); strcpy(globPtr->pattern, "*.*"); } else if (strcmp(str, "") == 0) { /* * An empty string means "match all files with no * extensions" - * BUG: "*." actually matches with all files on Win95 + * TODO: "*." actually matches with all files on Win95 */ - globPtr->pattern = (char *) ckalloc(3 * sizeof(char)); + globPtr->pattern = ckalloc(3 * sizeof(char)); strcpy(globPtr->pattern, "*."); } else { - globPtr->pattern = (char *) ckalloc((unsigned int) len); + globPtr->pattern = ckalloc((unsigned) len); strcpy(globPtr->pattern, str); } } else { - globPtr->pattern = (char *) ckalloc((unsigned int) len); + globPtr->pattern = ckalloc((unsigned) len); strcpy(globPtr->pattern, str); } @@ -346,7 +346,7 @@ AddClause( Tcl_DString osTypeDS; int len; MacFileType *mfPtr = (MacFileType *) ckalloc(sizeof(MacFileType)); - CONST char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); + const char *strType = Tcl_GetStringFromObj(ostypeList[i], &len); char *string; /* @@ -401,11 +401,12 @@ static FileFilter * GetFilter( FileFilterList *flistPtr, /* The FileFilterList that contains the newly * created filter */ - CONST char *name) /* Name of the filter. It is usually displayed + const char *name) /* Name of the filter. It is usually displayed * in the "File Types" listbox in the file * dialogs. */ { FileFilter *filterPtr = flistPtr->filters; + size_t len; for (; filterPtr; filterPtr=filterPtr->next) { if (strcmp(filterPtr->name, name) == 0) { @@ -416,8 +417,9 @@ GetFilter( filterPtr = (FileFilter *) ckalloc(sizeof(FileFilter)); filterPtr->clauses = NULL; filterPtr->clausesTail = NULL; - filterPtr->name = (char *) ckalloc((strlen(name)+1) * sizeof(char)); - strcpy(filterPtr->name, name); + len = (strlen(name) + 1) * sizeof(char); + filterPtr->name = ckalloc(len); + memcpy(filterPtr->name, name, len); if (flistPtr->filters == NULL) { flistPtr->filters = flistPtr->filtersTail = filterPtr; @@ -436,7 +438,7 @@ GetFilter( * * FreeClauses -- * - * Frees the malloc'ed file type clause + * Frees the malloc'ed file type clause. * * Results: * None. @@ -455,8 +457,8 @@ FreeClauses( while (clausePtr != NULL) { FileFilterClause *toFree = clausePtr; - clausePtr = clausePtr->next; + clausePtr = clausePtr->next; FreeGlobPatterns(toFree); FreeMacFileTypes(toFree); ckfree((char *) toFree); @@ -491,7 +493,7 @@ FreeGlobPatterns( GlobPattern *toFree = globPtr; globPtr = globPtr->next; - ckfree((char *) toFree->pattern); + ckfree(toFree->pattern); ckfree((char *) toFree); } clausePtr->patterns = NULL; @@ -516,12 +518,13 @@ FreeGlobPatterns( static void FreeMacFileTypes( FileFilterClause *clausePtr)/* The clause whose mac types are to be - * freed */ + * freed. */ { MacFileType *mfPtr = clausePtr->macTypes; while (mfPtr != NULL) { MacFileType *toFree = mfPtr; + mfPtr = mfPtr->next; ckfree((char *) toFree); } diff --git a/generic/tkFocus.c b/generic/tkFocus.c index e524c16..980a8e0 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.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: tkFocus.c,v 1.16 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkFocus.c,v 1.17 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -118,13 +118,13 @@ Tk_FocusObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *focusOptions[] = { + static const char *focusOptions[] = { "-displayof", "-force", "-lastfor", NULL }; - Tk_Window tkwin = (Tk_Window) clientData; - TkWindow *winPtr = (TkWindow *) clientData; + Tk_Window tkwin = clientData; + TkWindow *winPtr = clientData; TkWindow *newPtr, *focusWinPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; char *windowName; @@ -216,7 +216,7 @@ Tk_FocusObjCmd( return TCL_ERROR; } for (topLevelPtr = newPtr; topLevelPtr != NULL; - topLevelPtr = topLevelPtr->parentPtr) { + topLevelPtr = topLevelPtr->parentPtr) { if (!(topLevelPtr->flags & TK_TOP_HIERARCHY)) { continue; } @@ -393,7 +393,7 @@ TkFocusFilterEvent( * tree, then ignore the event. */ - if (TkGrabState(winPtr) == TK_GRAB_EXCLUDED) { + if (TkGrabState(winPtr) == TK_GRAB_EXCLUDED) { return retValue; } @@ -500,14 +500,14 @@ TkFocusFilterEvent( } else if (eventPtr->type == LeaveNotify) { /* * If the pointer just left a window for which we automatically - * claimed the focus on enter, move the focus back to the root - * window, where it was before we claimed it above. Note: + * claimed the focus on enter, move the focus back to the root window, + * where it was before we claimed it above. Note: * dispPtr->implicitWinPtr may not be the same as - * displayFocusPtr->focusWinPtr (e.g. because the "focus" command - * was used to redirect the focus after it arrived at - * dispPtr->implicitWinPtr)!! In addition, we generate events - * because the window manager won't give us a FocusOut event when - * we focus on the root. + * displayFocusPtr->focusWinPtr (e.g. because the "focus" command was + * used to redirect the focus after it arrived at + * dispPtr->implicitWinPtr)!! In addition, we generate events because + * the window manager won't give us a FocusOut event when we focus on + * the root. */ if ((dispPtr->implicitWinPtr != NULL) @@ -573,7 +573,7 @@ TkSetFocusWin( */ allMapped = 1; - for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) { + for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) { if (topLevelPtr == NULL) { /* * The window is being deleted. No point in worrying about giving @@ -599,16 +599,14 @@ TkSetFocusWin( */ if (displayFocusPtr->focusOnMapPtr != NULL) { - Tk_DeleteEventHandler( - (Tk_Window) displayFocusPtr->focusOnMapPtr, + Tk_DeleteEventHandler((Tk_Window) displayFocusPtr->focusOnMapPtr, StructureNotifyMask, FocusMapProc, - (ClientData) displayFocusPtr->focusOnMapPtr); + displayFocusPtr->focusOnMapPtr); displayFocusPtr->focusOnMapPtr = NULL; } if (!allMapped) { - Tk_CreateEventHandler((Tk_Window) winPtr, - VisibilityChangeMask, FocusMapProc, - (ClientData) winPtr); + Tk_CreateEventHandler((Tk_Window) winPtr, VisibilityChangeMask, + FocusMapProc, winPtr); displayFocusPtr->focusOnMapPtr = winPtr; displayFocusPtr->forceFocus = force; return; @@ -943,7 +941,7 @@ FocusMapProc( ClientData clientData, /* Toplevel window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = (TkWindow *) clientData; + TkWindow *winPtr = clientData; DisplayFocusInfo *displayFocusPtr; if (eventPtr->type == VisibilityNotify) { @@ -1048,8 +1046,8 @@ TkFocusFree( * * TkFocusSplit -- * - * Adjust focus window for a newly managed toplevel, thus splitting - * the toplevel into two toplevels. + * Adjust focus window for a newly managed toplevel, thus splitting the + * toplevel into two toplevels. * * Results: * None. @@ -1062,29 +1060,29 @@ TkFocusFree( void TkFocusSplit(winPtr) - TkWindow *winPtr; /* Window is the new toplevel - * Any focus point at or below window - * must be moved to this new toplevel */ + TkWindow *winPtr; /* Window is the new toplevel. Any focus point + * at or below window must be moved to this + * new toplevel. */ { ToplevelFocusInfo *tlFocusPtr; DisplayFocusInfo *displayFocusPtr; - TkWindow *topLevelPtr; - TkWindow *subWinPtr; + TkWindow *topLevelPtr, *subWinPtr; displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr); /* - * Find the top-level window for winPtr, then find (or create) - * a record for the top-level. Also see whether winPtr and all its - * ancestors are mapped. + * Find the top-level window for winPtr, then find (or create) a record + * for the top-level. Also see whether winPtr and all its ancestors are + * mapped. */ - for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) { + for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) { if (topLevelPtr == NULL) { /* - * The window is being deleted. No point in worrying about - * giving it the focus. + * The window is being deleted. No point in worrying about giving + * it the focus. */ + return; } if (topLevelPtr->flags & TK_TOP_HIERARCHY) { @@ -1092,37 +1090,58 @@ TkFocusSplit(winPtr) } } - /* Search all focus records to find child windows of winPtr */ + /* + * Search all focus records to find child windows of winPtr. + */ + for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL; - tlFocusPtr = tlFocusPtr->nextPtr) { + tlFocusPtr = tlFocusPtr->nextPtr) { if (tlFocusPtr->topLevelPtr == topLevelPtr) { break; } } if (tlFocusPtr == NULL) { - /* No focus record for this toplevel, nothing to do. */ + /* + * No focus record for this toplevel, nothing to do. + */ + return; } - /* See if current focusWin is child of the new toplevel */ + /* + * See if current focusWin is child of the new toplevel. + */ + for (subWinPtr = tlFocusPtr->focusWinPtr; - subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr; - subWinPtr = subWinPtr->parentPtr) {} + subWinPtr && subWinPtr != winPtr && subWinPtr != topLevelPtr; + subWinPtr = subWinPtr->parentPtr) { + /* EMPTY */ + } if (subWinPtr == winPtr) { - /* Move focus to new toplevel */ - ToplevelFocusInfo *newTlFocusPtr; + /* + * Move focus to new toplevel. + */ + + ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *) + ckalloc(sizeof(ToplevelFocusInfo)); - newTlFocusPtr = (ToplevelFocusInfo *) ckalloc(sizeof(ToplevelFocusInfo)); newTlFocusPtr->topLevelPtr = winPtr; newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr; newTlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = newTlFocusPtr; - /* Move old toplevel's focus to the toplevel itself */ + + /* + * Move old toplevel's focus to the toplevel itself. + */ + tlFocusPtr->focusWinPtr = topLevelPtr; } - /* If it's not, then let focus progress naturally */ + + /* + * If it's not, then let focus progress naturally. + */ } /* @@ -1142,25 +1161,25 @@ TkFocusSplit(winPtr) */ void -TkFocusJoin(winPtr) - TkWindow *winPtr; /* Window is no longer a toplevel */ +TkFocusJoin( + TkWindow *winPtr) /* Window is no longer a toplevel. */ { - ToplevelFocusInfo *tlFocusPtr; - ToplevelFocusInfo *tmpPtr; + ToplevelFocusInfo *tlFocusPtr, *tmpPtr; /* * Remove old toplevel record */ + if (winPtr && winPtr->mainPtr && winPtr->mainPtr->tlFocusPtr - && winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) { + && winPtr->mainPtr->tlFocusPtr->topLevelPtr == winPtr) { tmpPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tmpPtr->nextPtr; ckfree((char *)tmpPtr); } else { for (tlFocusPtr = winPtr->mainPtr->tlFocusPtr; tlFocusPtr != NULL; - tlFocusPtr = tlFocusPtr->nextPtr) { + tlFocusPtr = tlFocusPtr->nextPtr) { if (tlFocusPtr->nextPtr && - tlFocusPtr->nextPtr->topLevelPtr == winPtr) { + tlFocusPtr->nextPtr->topLevelPtr == winPtr) { tmpPtr = tlFocusPtr->nextPtr; tlFocusPtr->nextPtr = tmpPtr->nextPtr; ckfree((char *)tmpPtr); diff --git a/generic/tkFont.c b/generic/tkFont.c index f2d2441..a168919 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.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: tkFont.c,v 1.42 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.43 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -378,9 +378,8 @@ void TkFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - TkFontInfo *fiPtr; + TkFontInfo *fiPtr = (TkFontInfo *) ckalloc(sizeof(TkFontInfo)); - fiPtr = (TkFontInfo *) ckalloc(sizeof(TkFontInfo)); Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS); Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS); fiPtr->mainPtr = mainPtr; @@ -412,13 +411,11 @@ void TkFontPkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { - TkFontInfo *fiPtr; + TkFontInfo *fiPtr = mainPtr->fontInfoPtr; Tcl_HashEntry *hPtr, *searchPtr; Tcl_HashSearch search; int fontsLeft; - fiPtr = mainPtr->fontInfoPtr; - fontsLeft = 0; for (searchPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); searchPtr != NULL; @@ -445,7 +442,7 @@ TkFontPkgFree( } Tcl_DeleteHashTable(&fiPtr->namedTable); if (fiPtr->updatePending != 0) { - Tcl_CancelIdleCall(TheWorldHasChanged, (ClientData) fiPtr); + Tcl_CancelIdleCall(TheWorldHasChanged, fiPtr); } ckfree((char *) fiPtr); } @@ -621,7 +618,7 @@ Tk_FontObjCmd( namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string); nfPtr = NULL; /* lint. */ if (namedHashPtr != NULL) { - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); } if ((namedHashPtr == NULL) || (nfPtr->deletePending != 0)) { Tcl_AppendResult(interp, "named font \"", string, @@ -804,7 +801,7 @@ Tk_FontObjCmd( resultPtr = Tcl_GetObjResult(interp); namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search); while (namedHashPtr != NULL) { - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); if (nfPtr->deletePending == 0) { string = Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr); strPtr = Tcl_NewStringObj(string, -1); @@ -848,7 +845,7 @@ UpdateDependentFonts( TkFont *fontPtr; NamedFont *nfPtr; - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount == 0) { /* * Well nobody's using this named font, so don't have to tell any @@ -860,13 +857,13 @@ UpdateDependentFonts( cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); while (cacheHashPtr != NULL) { - for (fontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr); + for (fontPtr = Tcl_GetHashValue(cacheHashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (fontPtr->namedHashPtr == namedHashPtr) { TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa); if (fiPtr->updatePending == 0) { fiPtr->updatePending = 1; - Tcl_DoWhenIdle(TheWorldHasChanged, (ClientData) fiPtr); + Tcl_DoWhenIdle(TheWorldHasChanged, fiPtr); } } } @@ -878,11 +875,9 @@ static void TheWorldHasChanged( ClientData clientData) /* Info about application's fonts. */ { - TkFontInfo *fiPtr; + TkFontInfo *fiPtr = clientData; - fiPtr = (TkFontInfo *) clientData; fiPtr->updatePending = 0; - RecomputeWidgets(fiPtr->mainPtr->winPtr); } @@ -890,8 +885,9 @@ static void RecomputeWidgets( TkWindow *winPtr) /* Window to which command is sent. */ { - Tk_ClassWorldChangedProc *proc; - proc = Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc); + Tk_ClassWorldChangedProc *proc = + Tk_GetClassProc(winPtr->classProcsPtr, worldChangedProc); + if (proc != NULL) { (*proc)(winPtr->instanceData); } @@ -961,7 +957,7 @@ TkCreateNamedFont( namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew); if (!isNew) { - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); if (nfPtr->deletePending == 0) { if (interp) { Tcl_AppendResult(interp, "named font \"", name, @@ -1006,7 +1002,7 @@ int TkDeleteNamedFont( Tcl_Interp *interp, /* Interp for error return (can be NULL). */ Tk_Window tkwin, /* A window associated with interp. */ - CONST char *name) /* Name for the new named font. */ + const char *name) /* Name for the new named font. */ { TkFontInfo *fiPtr; NamedFont *nfPtr; @@ -1022,7 +1018,7 @@ TkDeleteNamedFont( } return TCL_ERROR; } - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount != 0) { nfPtr->deletePending = 1; } else { @@ -1111,7 +1107,7 @@ Tk_AllocFontFromObj( SetFontFromAny(interp, objPtr); } - oldFontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1; + oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (oldFontPtr != NULL) { if (oldFontPtr->resourceRefCount == 0) { @@ -1141,13 +1137,13 @@ Tk_AllocFontFromObj( cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr), &isNew); } - firstFontPtr = (TkFont *) Tcl_GetHashValue(cacheHashPtr); + firstFontPtr = Tcl_GetHashValue(cacheHashPtr); for (fontPtr = firstFontPtr; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { fontPtr->resourceRefCount++; fontPtr->objRefCount++; - objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr; + objPtr->internalRep.twoPtrValue.ptr1 = fontPtr; return (Tk_Font) fontPtr; } } @@ -1163,7 +1159,7 @@ Tk_AllocFontFromObj( * Construct a font based on a named font. */ - nfPtr = (NamedFont *) Tcl_GetHashValue(namedHashPtr); + nfPtr = Tcl_GetHashValue(namedHashPtr); nfPtr->refCount++; fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa); @@ -1242,7 +1238,7 @@ Tk_AllocFontFromObj( } } - objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr; + objPtr->internalRep.twoPtrValue.ptr1 = fontPtr; return (Tk_Font) fontPtr; } @@ -1278,7 +1274,7 @@ Tk_GetFontFromObj( SetFontFromAny(NULL, objPtr); } - fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1; + fontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if (fontPtr->resourceRefCount == 0) { @@ -1306,11 +1302,11 @@ Tk_GetFontFromObj( hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr)); } if (hashPtr != NULL) { - for (fontPtr = (TkFont *) Tcl_GetHashValue(hashPtr); fontPtr != NULL; + for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { fontPtr->objRefCount++; - objPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr; + objPtr->internalRep.twoPtrValue.ptr1 = fontPtr; return (Tk_Font) fontPtr; } } @@ -1427,7 +1423,7 @@ Tk_FreeFont( * the named font and free it if no-one else is using it. */ - nfPtr = (NamedFont *) Tcl_GetHashValue(fontPtr->namedHashPtr); + nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr); nfPtr->refCount--; if ((nfPtr->refCount == 0) && (nfPtr->deletePending != 0)) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); @@ -1435,7 +1431,7 @@ Tk_FreeFont( } } - prevPtr = (TkFont *) Tcl_GetHashValue(fontPtr->cacheHashPtr); + prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr); if (prevPtr == fontPtr) { if (fontPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(fontPtr->cacheHashPtr); @@ -1505,7 +1501,7 @@ static void FreeFontObjProc( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkFont *fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { fontPtr->objRefCount--; @@ -1539,10 +1535,10 @@ DupFontObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkFont *fontPtr = (TkFont *) srcObjPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.twoPtrValue.ptr1 = (void *) fontPtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr; if (fontPtr != NULL) { fontPtr->objRefCount++; @@ -1606,9 +1602,8 @@ Tk_GetFontMetrics( Tk_FontMetrics *fmPtr) /* Pointer to structure in which font metrics * for tkfont will be stored. */ { - TkFont *fontPtr; + TkFont *fontPtr = (TkFont *) tkfont; - fontPtr = (TkFont *) tkfont; fmPtr->ascent = fontPtr->fm.ascent; fmPtr->descent = fontPtr->fm.descent; fmPtr->linespace = fontPtr->fm.ascent + fontPtr->fm.descent; @@ -1891,8 +1886,8 @@ TkUnderlineCharsInContext( &endX); XFillRectangle(display, drawable, gc, x + startX, - y + fontPtr->underlinePos, (unsigned int) (endX - startX), - (unsigned int) fontPtr->underlineHeight); + y + fontPtr->underlinePos, (unsigned) (endX - startX), + (unsigned) fontPtr->underlineHeight); } /* @@ -2232,9 +2227,8 @@ void Tk_FreeTextLayout( Tk_TextLayout textLayout) /* The text layout to be released. */ { - TextLayout *layoutPtr; + TextLayout *layoutPtr = (TextLayout *) textLayout; - layoutPtr = (TextLayout *) textLayout; if (layoutPtr != NULL) { ckfree((char *) layoutPtr); } @@ -2276,13 +2270,11 @@ Tk_DrawTextLayout( * draw from the given text item. A number < 0 * means to draw all characters. */ { - TextLayout *layoutPtr; + TextLayout *layoutPtr = (TextLayout *) layout; int i, numDisplayChars, drawX; - const char *firstByte; - const char *lastByte; + const char *firstByte, *lastByte; LayoutChunk *chunkPtr; - layoutPtr = (TextLayout *) layout; if (layoutPtr == NULL) { return; } @@ -2307,9 +2299,8 @@ Tk_DrawTextLayout( numDisplayChars = lastChar; } lastByte = Tcl_UtfAtIndex(chunkPtr->start, numDisplayChars); - Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, - firstByte, lastByte - firstByte, - x + chunkPtr->x + drawX, y + chunkPtr->y); + Tk_DrawChars(display, drawable, gc, layoutPtr->tkfont, firstByte, + lastByte - firstByte, x+chunkPtr->x+drawX, y+chunkPtr->y); } firstChar -= chunkPtr->numChars; lastChar -= chunkPtr->numChars; @@ -2355,18 +2346,16 @@ Tk_UnderlineTextLayout( int underline) /* Index of the single character to underline, * or -1 for no underline. */ { - TextLayout *layoutPtr; - TkFont *fontPtr; int xx, yy, width, height; if ((Tk_CharBbox(layout, underline, &xx, &yy, &width, &height) != 0) && (width != 0)) { - layoutPtr = (TextLayout *) layout; - fontPtr = (TkFont *) layoutPtr->tkfont; + TextLayout *layoutPtr = (TextLayout *) layout; + TkFont *fontPtr = (TkFont *) layoutPtr->tkfont; XFillRectangle(display, drawable, gc, x + xx, y + yy + fontPtr->fm.ascent + fontPtr->underlinePos, - (unsigned int) width, (unsigned int) fontPtr->underlineHeight); + (unsigned) width, (unsigned) fontPtr->underlineHeight); } } @@ -2475,8 +2464,7 @@ Tk_PointToChar( return numChars; } n = Tk_MeasureChars((Tk_Font) fontPtr, chunkPtr->start, - chunkPtr->numBytes, x - chunkPtr->x, - 0, &dummy); + chunkPtr->numBytes, x - chunkPtr->x, 0, &dummy); return numChars + Tcl_NumUtfChars(chunkPtr->start, n); } numChars += chunkPtr->numChars; @@ -3804,7 +3792,7 @@ TkDebugFont( hashPtr = Tcl_FindHashEntry( &((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name); if (hashPtr != NULL) { - fontPtr = (TkFont *) Tcl_GetHashValue(hashPtr); + fontPtr = Tcl_GetHashValue(hashPtr); if (fontPtr == NULL) { Tcl_Panic("TkDebugFont found empty hash table entry"); } @@ -3850,7 +3838,7 @@ TkFontGetFirstTextLayout( LayoutChunk *chunkPtr; int numBytesInChunk; - layoutPtr = (TextLayout *)layout; + layoutPtr = (TextLayout *) layout; if ((layoutPtr==NULL) || (layoutPtr->numChunks==0) || (layoutPtr->chunks->numDisplayChars <= 0)) { dst[0] = '\0'; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 372cbda..1a751ed 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.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: tkFrame.c,v 1.31 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.32 2008/04/27 22:38:56 dkf Exp $ */ #include "default.h" @@ -290,7 +290,7 @@ static char *classNames[] = {"Frame", "Toplevel", "Labelframe"}; * class of widgets. */ -static const Tk_OptionSpec * const optionSpecs[] = { +static const Tk_OptionSpec *const optionSpecs[] = { frameOptSpec, toplevelOptSpec, labelframeOptSpec, @@ -302,9 +302,9 @@ static const Tk_OptionSpec * const optionSpecs[] = { static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST argv[], + int objc, Tcl_Obj *const argv[], enum FrameType type, char *appName); static void DestroyFrame(char *memPtr); static void DestroyFramePartly(Frame *framePtr); @@ -320,7 +320,7 @@ static void FrameStructureProc(ClientData clientData, XEvent *eventPtr); static int FrameWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void FrameWorldChanged(ClientData instanceData); static void MapFrame(ClientData clientData); @@ -369,7 +369,7 @@ Tk_FrameObjCmd( ClientData clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { return CreateFrame(clientData, interp, objc, objv, TYPE_FRAME, NULL); } @@ -379,7 +379,7 @@ Tk_ToplevelObjCmd( ClientData clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { return CreateFrame(clientData, interp, objc, objv, TYPE_TOPLEVEL, NULL); } @@ -389,7 +389,7 @@ Tk_LabelframeObjCmd( ClientData clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { return CreateFrame(clientData, interp, objc, objv, TYPE_LABELFRAME, NULL); } @@ -448,7 +448,7 @@ CreateFrame( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ + Tcl_Obj *const objv[], /* Argument objects. */ enum FrameType type, /* What widget type to create. */ char *appName) /* Should only be non-NULL if there are no * Main window associated with the @@ -459,7 +459,8 @@ CreateFrame( Frame *framePtr; Tk_OptionTable optionTable; Tk_Window newWin; - CONST char *className, *screenName, *visualName, *colormapName, *arg, *useOption; + const char *className, *screenName, *visualName, *colormapName; + const char *arg, *useOption; int i, c, length, depth; unsigned int mask; Colormap colormap; @@ -614,17 +615,17 @@ CreateFrame( if (type == TYPE_LABELFRAME) { framePtr = (Frame *) ckalloc(sizeof(Labelframe)); - memset((void *) framePtr, 0, (sizeof(Labelframe))); + memset(framePtr, 0, sizeof(Labelframe)); } else { framePtr = (Frame *) ckalloc(sizeof(Frame)); - memset((void *) framePtr, 0, (sizeof(Frame))); + memset(framePtr, 0, sizeof(Frame)); } framePtr->tkwin = newWin; framePtr->display = Tk_Display(newWin); framePtr->interp = interp; framePtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(newWin), FrameWidgetObjCmd, - (ClientData) framePtr, FrameCmdDeletedProc); + Tk_PathName(newWin), FrameWidgetObjCmd, framePtr, + FrameCmdDeletedProc); framePtr->optionTable = optionTable; framePtr->type = type; framePtr->colormap = colormap; @@ -633,6 +634,7 @@ CreateFrame( if (framePtr->type == TYPE_LABELFRAME) { Labelframe *labelframePtr = (Labelframe *) framePtr; + labelframePtr->labelAnchor = LABELANCHOR_NW; labelframePtr->textGC = None; } @@ -641,13 +643,13 @@ CreateFrame( * Store backreference to frame widget in window structure. */ - Tk_SetClassProcs(newWin, &frameClass, (ClientData) framePtr); + Tk_SetClassProcs(newWin, &frameClass, framePtr); mask = ExposureMask | StructureNotifyMask | FocusChangeMask; if (type == TYPE_TOPLEVEL) { mask |= ActivateMask; } - Tk_CreateEventHandler(newWin, mask, FrameEventProc, (ClientData) framePtr); + Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr); if ((Tk_InitOptions(interp, (char *) framePtr, optionTable, newWin) != TCL_OK) || (ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) { @@ -663,7 +665,7 @@ CreateFrame( } } if (type == TYPE_TOPLEVEL) { - Tcl_DoWhenIdle(MapFrame, (ClientData) framePtr); + Tcl_DoWhenIdle(MapFrame, framePtr); } Tcl_SetResult(interp, Tk_PathName(newWin), TCL_STATIC); return TCL_OK; @@ -698,15 +700,15 @@ FrameWidgetObjCmd( ClientData clientData, /* Information about frame widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *frameOptions[] = { + static const char *frameOptions[] = { "cget", "configure", NULL }; enum options { FRAME_CGET, FRAME_CONFIGURE }; - register Frame *framePtr = (Frame *) clientData; + register Frame *framePtr = clientData; int result = TCL_OK, index; int c, i, length; Tcl_Obj *objPtr; @@ -719,7 +721,7 @@ FrameWidgetObjCmd( &index) != TCL_OK) { return TCL_ERROR; } - Tcl_Preserve((ClientData) framePtr); + Tcl_Preserve(framePtr); switch ((enum options) index) { case FRAME_CGET: if (objc != 3) { @@ -732,22 +734,19 @@ FrameWidgetObjCmd( if (objPtr == NULL) { result = TCL_ERROR; goto done; - } else { - Tcl_SetObjResult(interp, objPtr); } + Tcl_SetObjResult(interp, objPtr); break; case FRAME_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, (char *) framePtr, - framePtr->optionTable, - (objc == 3) ? objv[2] : NULL, + framePtr->optionTable, (objc == 3) ? objv[2] : NULL, framePtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; - } else { - Tcl_SetObjResult(interp, objPtr); } + Tcl_SetObjResult(interp, objPtr); } else { /* * Don't allow the options -class, -colormap, -container, -screen, @@ -773,9 +772,9 @@ FrameWidgetObjCmd( || ((c == 'v') && (strncmp(arg, "-visual", (unsigned)length) == 0))) { - #ifdef SUPPORT_CONFIG_EMBEDDED +#ifdef SUPPORT_CONFIG_EMBEDDED if (c == 'u') { - CONST char *string = Tcl_GetString(objv[i+1]); + const char *string = Tcl_GetString(objv[i+1]); if (TkpUseWindow(interp, framePtr->tkwin, string) != TCL_OK) { result = TCL_ERROR; @@ -787,12 +786,12 @@ FrameWidgetObjCmd( result = TCL_ERROR; goto done; } - #else +#else Tcl_AppendResult(interp, "can't modify ", arg, " option after widget is created", NULL); result = TCL_ERROR; goto done; - #endif +#endif } } result = ConfigureFrame(interp, framePtr, objc-2, objv+2); @@ -801,7 +800,7 @@ FrameWidgetObjCmd( } done: - Tcl_Release((ClientData) framePtr); + Tcl_Release(framePtr); return result; } @@ -868,8 +867,8 @@ DestroyFramePartly( if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, - FrameStructureProc, (ClientData) framePtr); - Tk_ManageGeometry(labelframePtr->labelWin, NULL, (ClientData) NULL); + FrameStructureProc, framePtr); + Tk_ManageGeometry(labelframePtr->labelWin, NULL, NULL); if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) { Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin); } @@ -907,7 +906,7 @@ ConfigureFrame( register Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments. */ + Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; char *oldMenuName; @@ -947,7 +946,7 @@ ConfigureFrame( || ((oldMenuName != NULL) && (framePtr->menuName == NULL)) || ((oldMenuName != NULL) && (framePtr->menuName != NULL) && strcmp(oldMenuName, framePtr->menuName) != 0)) - && framePtr->type == TYPE_TOPLEVEL) { + && framePtr->type == TYPE_TOPLEVEL) { TkSetWindowMenuBar(interp, framePtr->tkwin, oldMenuName, framePtr->menuName); } @@ -981,7 +980,7 @@ ConfigureFrame( if (oldWindow != labelframePtr->labelWin) { if (oldWindow != NULL) { Tk_DeleteEventHandler(oldWindow, StructureNotifyMask, - FrameStructureProc, (ClientData) framePtr); + FrameStructureProc, framePtr); Tk_ManageGeometry(oldWindow, NULL, (ClientData) NULL); Tk_UnmaintainGeometry(oldWindow, framePtr->tkwin); Tk_UnmapWindow(oldWindow); @@ -1003,7 +1002,7 @@ ConfigureFrame( } sibling = ancestor; if (Tk_IsTopLevel(ancestor)) { - badWindow: + badWindow: Tcl_AppendResult(interp, "can't use ", Tk_PathName(labelframePtr->labelWin), " as label in this frame", NULL); @@ -1018,10 +1017,9 @@ ConfigureFrame( goto badWindow; } Tk_CreateEventHandler(labelframePtr->labelWin, - StructureNotifyMask, FrameStructureProc, - (ClientData) framePtr); + StructureNotifyMask, FrameStructureProc, framePtr); Tk_ManageGeometry(labelframePtr->labelWin, &frameGeomType, - (ClientData) framePtr); + framePtr); /* * If the frame is not parent to the label, make sure the @@ -1035,8 +1033,7 @@ ConfigureFrame( } } - FrameWorldChanged((ClientData) framePtr); - + FrameWorldChanged(framePtr); return TCL_OK; } @@ -1062,8 +1059,8 @@ static void FrameWorldChanged( ClientData instanceData) /* Information about widget. */ { - Frame *framePtr = (Frame *) instanceData; - Labelframe *labelframePtr = (Labelframe *) framePtr; + Frame *framePtr = instanceData; + Labelframe *labelframePtr = instanceData; Tk_Window tkwin = framePtr->tkwin; XGCValues gcValues; GC gc; @@ -1102,14 +1099,17 @@ FrameWorldChanged( if (anyTextLabel) { labelText = Tcl_GetString(labelframePtr->textPtr); Tk_FreeTextLayout(labelframePtr->textLayout); - labelframePtr->textLayout = Tk_ComputeTextLayout(labelframePtr->tkfont, + labelframePtr->textLayout = + Tk_ComputeTextLayout(labelframePtr->tkfont, labelText, -1, 0, TK_JUSTIFY_CENTER, 0, - &labelframePtr->labelReqWidth, &labelframePtr->labelReqHeight); + &labelframePtr->labelReqWidth, + &labelframePtr->labelReqHeight); labelframePtr->labelReqWidth += 2 * LABELSPACING; labelframePtr->labelReqHeight += 2 * LABELSPACING; } else if (anyWindowLabel) { labelframePtr->labelReqWidth = Tk_ReqWidth(labelframePtr->labelWin); - labelframePtr->labelReqHeight = Tk_ReqHeight(labelframePtr->labelWin); + labelframePtr->labelReqHeight = + Tk_ReqHeight(labelframePtr->labelWin); } /* @@ -1202,7 +1202,7 @@ FrameWorldChanged( if (Tk_IsMapped(tkwin)) { if (!(framePtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayFrame, (ClientData) framePtr); + Tcl_DoWhenIdle(DisplayFrame, framePtr); } framePtr->flags |= REDRAW_PENDING; } @@ -1239,7 +1239,9 @@ ComputeFrameGeometry( * We have nothing to do here unless there is a label. */ - if (framePtr->type != TYPE_LABELFRAME) return; + if (framePtr->type != TYPE_LABELFRAME) { + return; + } if (labelframePtr->textPtr == NULL && labelframePtr->labelWin == NULL) { return; } @@ -1371,7 +1373,7 @@ static void DisplayFrame( ClientData clientData) /* Information about widget. */ { - register Frame *framePtr = (Frame *) clientData; + register Frame *framePtr = clientData; register Tk_Window tkwin = framePtr->tkwin; int bdX1, bdY1, bdX2, bdY2, hlWidth; Pixmap pixmap; @@ -1408,7 +1410,9 @@ DisplayFrame( * If -background is set to "", no interior is drawn. */ - if (framePtr->border == NULL) return; + if (framePtr->border == NULL) { + return; + } if (framePtr->type != TYPE_LABELFRAME) { /* @@ -1539,7 +1543,8 @@ DisplayFrame( || (labelframePtr->labelBox.height != Tk_Height(labelframePtr->labelWin))) { Tk_MoveResizeWindow(labelframePtr->labelWin, - labelframePtr->labelBox.x, labelframePtr->labelBox.y, + labelframePtr->labelBox.x, + labelframePtr->labelBox.y, labelframePtr->labelBox.width, labelframePtr->labelBox.height); } @@ -1552,7 +1557,6 @@ DisplayFrame( } } - #ifndef TK_NO_DOUBLE_BUFFERING /* * Everything's been redisplayed; now copy the pixmap onto the screen @@ -1594,7 +1598,7 @@ FrameEventProc( ClientData clientData, /* Information about window. */ register XEvent *eventPtr) /* Information about event. */ { - register Frame *framePtr = (Frame *) clientData; + register Frame *framePtr = clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; @@ -1628,15 +1632,15 @@ FrameEventProc( Tk_DeleteEventHandler(framePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - FrameEventProc, (ClientData) framePtr); + FrameEventProc, framePtr); framePtr->tkwin = NULL; Tcl_DeleteCommandFromToken(framePtr->interp, framePtr->widgetCmd); } if (framePtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayFrame, (ClientData) framePtr); + Tcl_CancelIdleCall(DisplayFrame, framePtr); } - Tcl_CancelIdleCall(MapFrame, (ClientData) framePtr); - Tcl_EventuallyFree((ClientData) framePtr, DestroyFrame); + Tcl_CancelIdleCall(MapFrame, framePtr); + Tcl_EventuallyFree(framePtr, DestroyFrame); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { framePtr->flags |= GOT_FOCUS; @@ -1659,7 +1663,7 @@ FrameEventProc( redraw: if ((framePtr->tkwin != NULL) && !(framePtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayFrame, (ClientData) framePtr); + Tcl_DoWhenIdle(DisplayFrame, framePtr); framePtr->flags |= REDRAW_PENDING; } } @@ -1686,7 +1690,7 @@ static void FrameCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Frame *framePtr = (Frame *) clientData; + Frame *framePtr = clientData; Tk_Window tkwin = framePtr->tkwin; if (framePtr->menuName != NULL) { @@ -1737,7 +1741,7 @@ static void MapFrame( ClientData clientData) /* Pointer to frame structure. */ { - Frame *framePtr = (Frame *) clientData; + Frame *framePtr = clientData; /* * Wait for all other background events to be processed before mapping @@ -1746,7 +1750,7 @@ MapFrame( * doesn't get a false idea of its desired geometry. */ - Tcl_Preserve((ClientData) framePtr); + Tcl_Preserve(framePtr); while (1) { if (Tcl_DoOneEvent(TCL_IDLE_EVENTS) == 0) { break; @@ -1758,12 +1762,12 @@ MapFrame( */ if (framePtr->tkwin == NULL) { - Tcl_Release((ClientData) framePtr); + Tcl_Release(framePtr); return; } } Tk_MapWindow(framePtr->tkwin); - Tcl_Release((ClientData) framePtr); + Tcl_Release(framePtr); } /* @@ -1792,8 +1796,8 @@ TkInstallFrameMenu( TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->mainPtr != NULL) { - Frame *framePtr; - framePtr = (Frame*) winPtr->instanceData; + Frame *framePtr = (Frame *) winPtr->instanceData; + if (framePtr == NULL) { Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer"); } @@ -1825,7 +1829,7 @@ FrameStructureProc( ClientData clientData, /* Pointer to record describing frame. */ XEvent *eventPtr) /* Describes what just happened. */ { - Labelframe *labelframePtr = (Labelframe *) clientData; + Labelframe *labelframePtr = clientData; if (eventPtr->type == DestroyNotify) { /* @@ -1835,7 +1839,7 @@ FrameStructureProc( if (labelframePtr->frame.type == TYPE_LABELFRAME) { labelframePtr->labelWin = NULL; - FrameWorldChanged((ClientData) labelframePtr); + FrameWorldChanged(labelframePtr); } } } @@ -1863,9 +1867,9 @@ FrameRequestProc( ClientData clientData, /* Pointer to record for frame. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Frame *framePtr = (Frame *) clientData; + Frame *framePtr = clientData; - FrameWorldChanged((ClientData) framePtr); + FrameWorldChanged(framePtr); } /* @@ -1891,8 +1895,8 @@ FrameLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - Frame *framePtr = (Frame *) clientData; - Labelframe *labelframePtr = (Labelframe *) clientData; + Frame *framePtr = clientData; + Labelframe *labelframePtr = clientData; /* * This should only happen in a labelframe but it doesn't hurt to be @@ -1901,14 +1905,14 @@ FrameLostSlaveProc( if (labelframePtr->frame.type == TYPE_LABELFRAME) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, - FrameStructureProc, (ClientData) labelframePtr); + FrameStructureProc, labelframePtr); if (framePtr->tkwin != Tk_Parent(labelframePtr->labelWin)) { Tk_UnmaintainGeometry(labelframePtr->labelWin, framePtr->tkwin); } Tk_UnmapWindow(labelframePtr->labelWin); labelframePtr->labelWin = NULL; } - FrameWorldChanged((ClientData) framePtr); + FrameWorldChanged(framePtr); } void @@ -1917,24 +1921,31 @@ TkMapTopFrame (tkwin) { Frame *framePtr = ((TkWindow*)tkwin)->instanceData; Tk_OptionTable optionTable; + if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) { framePtr->type = TYPE_TOPLEVEL; - Tcl_DoWhenIdle(MapFrame, (ClientData)framePtr); + Tcl_DoWhenIdle(MapFrame, framePtr); if (framePtr->menuName != NULL) { TkSetWindowMenuBar(framePtr->interp, framePtr->tkwin, NULL, - framePtr->menuName); + framePtr->menuName); } } else if (!Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_TOPLEVEL) { framePtr->type = TYPE_FRAME; } else { - /* Not a frame or toplevel, skip it */ + /* + * Not a frame or toplevel, skip it. + */ + return; } + /* - * The option table has already been created so - * the cached pointer will be returned. + * The option table has already been created so the cached pointer will be + * returned. */ - optionTable = Tk_CreateOptionTable(framePtr->interp, optionSpecs[framePtr->type]); + + optionTable = Tk_CreateOptionTable(framePtr->interp, + optionSpecs[framePtr->type]); framePtr->optionTable = optionTable; } @@ -1961,7 +1972,7 @@ TkMapTopFrame (tkwin) Tk_Window TkToplevelWindowForCommand( Tcl_Interp *interp, - CONST char *cmdName) + const char *cmdName) { Tcl_CmdInfo cmdInfo; Frame *framePtr; @@ -1972,7 +1983,7 @@ TkToplevelWindowForCommand( if (cmdInfo.objProc != FrameWidgetObjCmd) { return NULL; } - framePtr = (Frame *) cmdInfo.objClientData; + framePtr = cmdInfo.objClientData; if (framePtr->type != TYPE_TOPLEVEL) { return NULL; } diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index f6f5150..2bd9ea7 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.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: tkGeometry.c,v 1.12 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkGeometry.c,v 1.13 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -86,7 +86,7 @@ void Tk_ManageGeometry( Tk_Window tkwin, /* Window whose geometry is to be managed by * proc. */ - CONST Tk_GeomMgr *mgrPtr, /* Static structure describing the geometry + const Tk_GeomMgr *mgrPtr, /* Static structure describing the geometry * manager. This structure must never go * away. */ ClientData clientData) /* Arbitrary one-word argument to pass to @@ -381,7 +381,7 @@ Tk_MaintainGeometry( hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, (char *) master, &isNew); if (!isNew) { - masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); } else { masterPtr = (MaintainMaster *) ckalloc(sizeof(MaintainMaster)); masterPtr->ancestor = master; @@ -407,7 +407,7 @@ Tk_MaintainGeometry( slavePtr->nextPtr = masterPtr->slavePtr; masterPtr->slavePtr = slavePtr; Tk_CreateEventHandler(slave, StructureNotifyMask, MaintainSlaveProc, - (ClientData) slavePtr); + slavePtr); /* * Make sure that there are event handlers registered for all the windows @@ -420,7 +420,7 @@ Tk_MaintainGeometry( ancestor = Tk_Parent(ancestor)) { if (ancestor == masterPtr->ancestor) { Tk_CreateEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, (ClientData) masterPtr); + MaintainMasterProc, masterPtr); masterPtr->ancestor = Tk_Parent(ancestor); } } @@ -511,7 +511,7 @@ Tk_UnmaintainGeometry( if (hPtr == NULL) { return; } - masterPtr = (MaintainMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); slavePtr = masterPtr->slavePtr; if (slavePtr->slave == slave) { masterPtr->slavePtr = slavePtr->nextPtr; @@ -528,20 +528,20 @@ Tk_UnmaintainGeometry( } } Tk_DeleteEventHandler(slavePtr->slave, StructureNotifyMask, - MaintainSlaveProc, (ClientData) slavePtr); + MaintainSlaveProc, slavePtr); ckfree((char *) slavePtr); if (masterPtr->slavePtr == NULL) { if (masterPtr->ancestor != NULL) { for (ancestor = master; ; ancestor = Tk_Parent(ancestor)) { Tk_DeleteEventHandler(ancestor, StructureNotifyMask, - MaintainMasterProc, (ClientData) masterPtr); + MaintainMasterProc, masterPtr); if (ancestor == masterPtr->ancestor) { break; } } } if (masterPtr->checkScheduled) { - Tcl_CancelIdleCall(MaintainCheckProc, (ClientData) masterPtr); + Tcl_CancelIdleCall(MaintainCheckProc, masterPtr); } Tcl_DeleteHashEntry(hPtr); ckfree((char *) masterPtr); @@ -575,7 +575,7 @@ MaintainMasterProc( * master window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = (MaintainMaster *) clientData; + MaintainMaster *masterPtr = clientData; MaintainSlave *slavePtr; int done; @@ -584,7 +584,7 @@ MaintainMasterProc( || (eventPtr->type == UnmapNotify)) { if (!masterPtr->checkScheduled) { masterPtr->checkScheduled = 1; - Tcl_DoWhenIdle(MaintainCheckProc, (ClientData) masterPtr); + Tcl_DoWhenIdle(MaintainCheckProc, masterPtr); } } else if (eventPtr->type == DestroyNotify) { /* @@ -629,7 +629,7 @@ MaintainSlaveProc( * master-slave pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = (MaintainSlave *) clientData; + MaintainSlave *slavePtr = clientData; if (eventPtr->type == DestroyNotify) { Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); @@ -661,7 +661,7 @@ MaintainCheckProc( ClientData clientData) /* Pointer to MaintainMaster structure for the * master window. */ { - MaintainMaster *masterPtr = (MaintainMaster *) clientData; + MaintainMaster *masterPtr = clientData; MaintainSlave *slavePtr; Tk_Window ancestor, parent; int x, y, map; diff --git a/generic/tkGet.c b/generic/tkGet.c index e6b19e2..807f9c2 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.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: tkGet.c,v 1.13 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkGet.c,v 1.14 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -37,10 +37,10 @@ static void FreeUidThreadExitProc(ClientData clientData); * used by Tk_GetAnchorFromObj and Tk_GetJustifyFromObj. */ -static CONST char *anchorStrings[] = { +static const char *anchorStrings[] = { "n", "ne", "e", "se", "s", "sw", "w", "nw", "center", NULL }; -static CONST char *justifyStrings[] = { +static const char *justifyStrings[] = { "left", "right", "center", NULL }; @@ -103,7 +103,7 @@ Tk_GetAnchorFromObj( int Tk_GetAnchor( Tcl_Interp *interp, /* Use this for error reporting. */ - CONST char *string, /* String describing a direction. */ + const char *string, /* String describing a direction. */ Tk_Anchor *anchorPtr) /* Where to store Tk_Anchor corresponding to * string. */ { @@ -175,7 +175,7 @@ Tk_GetAnchor( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfAnchor( Tk_Anchor anchor) /* Anchor for which identifying string is * desired. */ @@ -216,7 +216,7 @@ Tk_NameOfAnchor( int Tk_GetJoinStyle( Tcl_Interp *interp, /* Use this for error reporting. */ - CONST char *string, /* String describing a justification style. */ + const char *string, /* String describing a justification style. */ int *joinPtr) /* Where to store join style corresponding to * string. */ { @@ -260,7 +260,7 @@ Tk_GetJoinStyle( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfJoinStyle( int join) /* Join style for which identifying string is * desired. */ @@ -295,7 +295,7 @@ Tk_NameOfJoinStyle( int Tk_GetCapStyle( Tcl_Interp *interp, /* Use this for error reporting. */ - CONST char *string, /* String describing a justification style. */ + const char *string, /* String describing a justification style. */ int *capPtr) /* Where to store cap style corresponding to * string. */ { @@ -339,7 +339,7 @@ Tk_GetCapStyle( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfCapStyle( int cap) /* Cap style for which identifying string is * desired. */ @@ -411,7 +411,7 @@ Tk_GetJustifyFromObj( int Tk_GetJustify( Tcl_Interp *interp, /* Use this for error reporting. */ - CONST char *string, /* String describing a justification style. */ + const char *string, /* String describing a justification style. */ Tk_Justify *justifyPtr) /* Where to store Tk_Justify corresponding to * string. */ { @@ -456,7 +456,7 @@ Tk_GetJustify( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfJustify( Tk_Justify justify) /* Justification style for which identifying * string is desired. */ @@ -491,6 +491,7 @@ FreeUidThreadExitProc( { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + Tcl_DeleteHashTable(&tsdPtr->uidTable); tsdPtr->initialized = 0; } @@ -519,7 +520,7 @@ FreeUidThreadExitProc( Tk_Uid Tk_GetUid( - CONST char *string) /* String to convert. */ + const char *string) /* String to convert. */ { int dummy; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -561,7 +562,7 @@ Tk_GetScreenMM( Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string, /* String describing a screen distance. */ + const char *string, /* String describing a screen distance. */ double *doublePtr) /* Place to store converted result. */ { char *end; @@ -635,7 +636,7 @@ Tk_GetPixels( Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string, /* String describing a number of pixels. */ + const char *string, /* String describing a number of pixels. */ int *intPtr) /* Place to store converted result. */ { double d; @@ -660,7 +661,6 @@ Tk_GetPixels( * string. * * Results: - * The return value is a standard Tcl return result. If TCL_OK is * returned, then everything went well and the pixel distance is stored * at *doublePtr; otherwise TCL_ERROR is returned and an error message is @@ -678,7 +678,7 @@ TkGetDoublePixels( Tk_Window tkwin, /* Window whose screen determines conversion * from centimeters and other absolute * units. */ - CONST char *string, /* String describing a number of pixels. */ + const char *string, /* String describing a number of pixels. */ double *doublePtr) /* Place to store converted result. */ { char *end; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 1369f7c..17e5289 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.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: tkGrab.c,v 1.13 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkGrab.c,v 1.14 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -183,7 +183,7 @@ Tk_GrabObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int globalGrab; Tk_Window tkwin; @@ -191,10 +191,10 @@ Tk_GrabObjCmd( char *arg; int index; int len; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "current", "release", "set", "status", NULL }; - static CONST char *flagStrings[] = { + static const char *flagStrings[] = { "-global", NULL }; enum options { @@ -229,7 +229,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, arg, (Tk_Window) clientData); + tkwin = Tk_NameToWindow(interp, arg, clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -245,8 +245,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - (Tk_Window) clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -272,7 +271,7 @@ Tk_GrabObjCmd( } if (objc == 3) { tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - (Tk_Window) clientData); + clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -298,8 +297,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "release window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - (Tk_Window) clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); if (tkwin == NULL) { Tcl_ResetResult(interp); } else { @@ -316,7 +314,7 @@ Tk_GrabObjCmd( if (objc == 3) { globalGrab = 0; tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - (Tk_Window) clientData); + clientData); } else { globalGrab = 1; @@ -332,7 +330,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]), - (Tk_Window) clientData); + clientData); } if (tkwin == NULL) { return TCL_ERROR; @@ -348,7 +346,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - (Tk_Window) clientData); + clientData); if (winPtr == NULL) { return TCL_ERROR; } @@ -1246,8 +1244,9 @@ EatGrabEvents( info.display = dispPtr->display; info.serial = serial; TkpSync(info.display); - oldProc = Tk_RestrictEvents(GrabRestrictProc, (ClientData)&info, &oldArg); + oldProc = Tk_RestrictEvents(GrabRestrictProc, &info, &oldArg); while (Tcl_ServiceEvent(TCL_WINDOW_EVENTS)) { + /* EMPTY */ } Tk_RestrictEvents(oldProc, oldArg, &dummy); } @@ -1276,7 +1275,7 @@ GrabRestrictProc( ClientData arg, XEvent *eventPtr) { - GrabInfo *info = (GrabInfo *) arg; + GrabInfo *info = arg; int mode, diff; /* diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 29848a8..1400030 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.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: tkGrid.c,v 1.47 2007/05/15 17:01:43 dgp Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.48 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -259,31 +259,31 @@ static void ArrangeGrid(ClientData clientData); static int CheckSlotData(Gridder *masterPtr, int slot, int slotType, int checkOnly); static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DestroyGrid(char *memPtr); static Gridder * GetGrid(Tk_Window tkwin); static int GridAnchorCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int GridBboxCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int GridForgetRemoveCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int GridInfoCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int GridLocationCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int GridPropagateCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int GridRowColumnConfigureCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int GridSlavesCommand(Tk_Window tkwin, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); static void GridLostSlaveProc(ClientData clientData, @@ -331,10 +331,10 @@ Tk_GridObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; - static CONST char *optionStrings[] = { + Tk_Window tkwin = clientData; + static const char *optionStrings[] = { "anchor", "bbox", "columnconfigure", "configure", "forget", "info", "location", "propagate", "remove", "rowconfigure", "size", "slaves", NULL @@ -426,7 +426,7 @@ GridAnchorCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; @@ -467,7 +467,7 @@ GridAnchorCommand( } if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } } return TCL_OK; @@ -494,7 +494,7 @@ GridBboxCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; /* master grid record */ @@ -624,7 +624,7 @@ GridForgetRemoveCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window slave; Gridder *slavePtr; @@ -656,7 +656,7 @@ GridForgetRemoveCommand( slavePtr->iPadY = 0; slavePtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; if (slavePtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, (ClientData) slavePtr); + Tcl_CancelIdleCall(ArrangeGrid, slavePtr); } slavePtr->flags = 0; slavePtr->sticky = 0; @@ -695,7 +695,7 @@ GridInfoCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Gridder *slavePtr; Tk_Window slave; @@ -751,7 +751,7 @@ GridLocationCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; /* Master grid record. */ @@ -791,8 +791,8 @@ GridLocationCommand( */ while (masterPtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, (ClientData) masterPtr); - ArrangeGrid((ClientData) masterPtr); + Tcl_CancelIdleCall(ArrangeGrid, masterPtr); + ArrangeGrid(masterPtr); } SetGridSize(masterPtr); endX = MAX(gridPtr->columnEnd, gridPtr->columnMax); @@ -844,7 +844,7 @@ GridPropagateCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; @@ -890,7 +890,7 @@ GridPropagateCommand( } if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } } return TCL_OK; @@ -918,7 +918,7 @@ GridRowColumnConfigureCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master, slave; Gridder *masterPtr, *slavePtr; @@ -931,7 +931,7 @@ GridRowColumnConfigureCommand( int ok; /* temporary TCL result code */ int i, j, first, last; char *string; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL }; enum options { @@ -1117,7 +1117,7 @@ GridRowColumnConfigureCommand( Tcl_GetString(objv[1]), ": \"", Tcl_GetString(lObjv[j]), "\" is out of range", NULL); - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } slotPtr = (slotType == COLUMN) ? @@ -1132,13 +1132,13 @@ GridRowColumnConfigureCommand( for (i = 4; i < objc; i += 2) { if (Tcl_GetIndexFromObj(interp, objv[i], optionStrings, "option", 0, &index) != TCL_OK) { - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { if (Tk_GetPixelsFromObj(interp, master, objv[i+1], &size) != TCL_OK) { - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } else { slotPtr[slot].minSize = size; @@ -1147,13 +1147,13 @@ GridRowColumnConfigureCommand( int wt; if (Tcl_GetIntFromObj(interp,objv[i+1],&wt)!=TCL_OK) { - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } else if (wt < 0) { Tcl_AppendResult(interp, "invalid arg \"", Tcl_GetString(objv[i]), "\": should be non-negative", NULL); - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } else { slotPtr[slot].weight = wt; @@ -1168,13 +1168,13 @@ GridRowColumnConfigureCommand( } else if (index == ROWCOL_PAD) { if (Tk_GetPixelsFromObj(interp, master, objv[i+1], &size) != TCL_OK) { - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } else if (size < 0) { Tcl_AppendResult(interp, "invalid arg \"", Tcl_GetString(objv[i]), "\": should be non-negative", NULL); - Tcl_DecrRefCount(listCopy); + Tcl_DecrRefCount(listCopy); return TCL_ERROR; } else { slotPtr[slot].pad = size; @@ -1221,7 +1221,7 @@ GridRowColumnConfigureCommand( } if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } return TCL_OK; } @@ -1248,7 +1248,7 @@ GridSizeCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; @@ -1299,14 +1299,14 @@ GridSlavesCommand( Tk_Window tkwin, /* Main window of the application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window master; Gridder *masterPtr; /* master grid record */ Gridder *slavePtr; int i, value, index; int row = -1, column = -1; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-column", "-row", NULL }; enum options { SLAVES_COLUMN, SLAVES_ROW }; @@ -1385,12 +1385,12 @@ GridReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = (Gridder *) clientData; + register Gridder *gridPtr = clientData; gridPtr = gridPtr->masterPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr); + Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } @@ -1417,7 +1417,7 @@ GridLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Gridder *slavePtr = (Gridder *) clientData; + register Gridder *slavePtr = clientData; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -1675,7 +1675,7 @@ ArrangeGrid( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Gridder *masterPtr = (Gridder *) clientData; + register Gridder *masterPtr = clientData; register Gridder *slavePtr; GridMaster *slotPtr = masterPtr->masterDataPtr; int abort; @@ -1711,7 +1711,7 @@ ArrangeGrid( } masterPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve((ClientData) masterPtr); + Tcl_Preserve(masterPtr); /* * Call the constraint engine to fill in the row and column offsets. @@ -1738,10 +1738,10 @@ ArrangeGrid( Tk_GeometryRequest(masterPtr->tkwin, width, height); if (width>1 && height>1) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } masterPtr->abortPtr = NULL; - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); return; } @@ -1827,7 +1827,7 @@ ArrangeGrid( } masterPtr->abortPtr = NULL; - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); } /* @@ -2415,7 +2415,7 @@ GetGrid( gridPtr->padTop = 0; gridPtr->iPadX = 0; gridPtr->iPadY = 0; - gridPtr->doubleBw = 2*Tk_Changes(tkwin)->border_width; + gridPtr->doubleBw = 2 * Tk_Changes(tkwin)->border_width; gridPtr->abortPtr = NULL; gridPtr->flags = 0; gridPtr->sticky = 0; @@ -2423,7 +2423,7 @@ GetGrid( gridPtr->masterDataPtr = NULL; Tcl_SetHashValue(hPtr, gridPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, - GridStructureProc, (ClientData) gridPtr); + GridStructureProc, gridPtr); return gridPtr; } @@ -2717,7 +2717,7 @@ Unlink( } if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } if (masterPtr->abortPtr != NULL) { *masterPtr->abortPtr = 1; @@ -2789,21 +2789,21 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = (Gridder *) clientData; + register Gridder *gridPtr = clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { if ((gridPtr->slavePtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr); + Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } if ((gridPtr->masterPtr != NULL) && (gridPtr->doubleBw != 2*Tk_Changes(gridPtr->tkwin)->border_width)) { if (!(gridPtr->masterPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->doubleBw = 2*Tk_Changes(gridPtr->tkwin)->border_width; gridPtr->masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr->masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, gridPtr->masterPtr); } } } else if (eventPtr->type == DestroyNotify) { @@ -2822,15 +2822,15 @@ GridStructureProc( Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, (char *) gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { - Tcl_CancelIdleCall(ArrangeGrid, (ClientData) gridPtr); + Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; - Tcl_EventuallyFree((ClientData) gridPtr, DestroyGrid); + Tcl_EventuallyFree(gridPtr, DestroyGrid); } else if (eventPtr->type == MapNotify) { if ((gridPtr->slavePtr != NULL) && !(gridPtr->flags & REQUESTED_RELAYOUT)) { gridPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) gridPtr); + Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { register Gridder *gridPtr2; @@ -2868,7 +2868,7 @@ ConfigureSlaves( Tk_Window tkwin, /* Any window in application containing * slaves. Used to look up slave names. */ int objc, /* Number of elements in argv. */ - Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more + Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ @@ -2885,7 +2885,7 @@ ConfigureSlaves( char *lastWindow; /* Use this window to base current row/col * on */ int numSkip; /* Number of 'x' found */ - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-column", "-columnspan", "-in", "-ipadx", "-ipady", "-padx", "-pady", "-row", "-rowspan", "-sticky", NULL }; @@ -3136,7 +3136,7 @@ ConfigureSlaves( "positive screen distance", NULL); return TCL_ERROR; } - slavePtr->iPadX = tmp*2; + slavePtr->iPadX = tmp * 2; break; case CONF_IPADY: if ((Tk_GetPixelsFromObj(NULL, slave, objv[i+1], @@ -3146,7 +3146,7 @@ ConfigureSlaves( "positive screen distance", NULL); return TCL_ERROR; } - slavePtr->iPadY = tmp*2; + slavePtr->iPadY = tmp * 2; break; case CONF_PADX: if (TkParsePadAmount(interp, tkwin, objv[i+1], @@ -3261,7 +3261,7 @@ ConfigureSlaves( return TCL_ERROR; } - Tk_ManageGeometry(slave, &gridMgrType, (ClientData) slavePtr); + Tk_ManageGeometry(slave, &gridMgrType, slavePtr); /* * Assign default position information. @@ -3294,7 +3294,7 @@ ConfigureSlaves( } if (!(masterPtr->flags & REQUESTED_RELAYOUT)) { masterPtr->flags |= REQUESTED_RELAYOUT; - Tcl_DoWhenIdle(ArrangeGrid, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangeGrid, masterPtr); } } diff --git a/generic/tkImage.c b/generic/tkImage.c index 4dd3010..f0f914d 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.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: tkImage.c,v 1.35 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.36 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -154,9 +154,9 @@ Tk_ImageObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { - static CONST char *imageOptions[] = { + static const char *imageOptions[] = { "create", "delete", "height", "inuse", "names", "type", "types", "width", NULL }; @@ -164,7 +164,7 @@ Tk_ImageObjCmd( IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES, IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH }; - TkWindow *winPtr = (TkWindow *) clientData; + TkWindow *winPtr = clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; ImageMaster *masterPtr; @@ -271,7 +271,7 @@ Tk_ImageObjCmd( masterPtr->instancePtr = NULL; masterPtr->deleted = 0; masterPtr->winPtr = winPtr->mainPtr->winPtr; - Tcl_Preserve((ClientData) masterPtr->winPtr); + Tcl_Preserve(masterPtr->winPtr); Tcl_SetHashValue(hPtr, masterPtr); } else { /* @@ -279,7 +279,7 @@ Tk_ImageObjCmd( * from the master. */ - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->typePtr != NULL) { for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { @@ -313,17 +313,17 @@ Tk_ImageObjCmd( } args[objc] = NULL; } - Tcl_Preserve((ClientData) masterPtr); + Tcl_Preserve(masterPtr); if ((*typePtr->createProc)(interp, name, objc, args, typePtr, (Tk_ImageMaster)masterPtr, &masterPtr->masterData) != TCL_OK) { EventuallyDeleteImage(masterPtr, 0); - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); if (oldimage) { ckfree((char *) args); } return TCL_ERROR; } - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); if (oldimage) { ckfree((char *) args); } @@ -345,7 +345,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -359,7 +359,7 @@ Tk_ImageObjCmd( } hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { continue; } @@ -402,7 +402,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -500,7 +500,7 @@ Tk_ImageChanged( *---------------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfImage( Tk_ImageMaster imageMaster) /* Token for image. */ { @@ -540,7 +540,7 @@ Tk_GetImage( * be found. */ Tk_Window tkwin, /* Token for window in which image will be * used. */ - CONST char *name, /* Name of desired image. */ + const char *name, /* Name of desired image. */ Tk_ImageChangedProc *changeProc, /* Function to invoke when redisplay is needed * because image's pixels or size changed. */ @@ -554,7 +554,7 @@ Tk_GetImage( if (hPtr == NULL) { goto noSuchImage; } - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->typePtr == NULL) { goto noSuchImage; } @@ -635,7 +635,7 @@ Tk_FreeImage( if (masterPtr->hPtr != NULL) { Tcl_DeleteHashEntry(masterPtr->hPtr); } - Tcl_Release((ClientData) masterPtr->winPtr); + Tcl_Release(masterPtr->winPtr); ckfree((char *) masterPtr); } } @@ -855,7 +855,7 @@ void Tk_DeleteImage( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ - CONST char *name) /* Name of image. */ + const char *name) /* Name of image. */ { Tcl_HashEntry *hPtr; TkWindow *winPtr; @@ -868,7 +868,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr)); + DeleteImage(Tcl_GetHashValue(hPtr)); } /* @@ -913,7 +913,7 @@ DeleteImage( if (masterPtr->hPtr != NULL) { Tcl_DeleteHashEntry(masterPtr->hPtr); } - Tcl_Release((ClientData) masterPtr->winPtr); + Tcl_Release(masterPtr->winPtr); ckfree((char *) masterPtr); } else { masterPtr->deleted = 1; @@ -949,8 +949,7 @@ EventuallyDeleteImage( } if (!masterPtr->deleted) { masterPtr->deleted = 1; - Tcl_EventuallyFree((ClientData) masterPtr, - (Tcl_FreeProc *)DeleteImage); + Tcl_EventuallyFree(masterPtr, (Tcl_FreeProc *) DeleteImage); } } @@ -982,7 +981,7 @@ TkDeleteAllImages( for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - EventuallyDeleteImage((ImageMaster *) Tcl_GetHashValue(hPtr), 1); + EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1); } Tcl_DeleteHashTable(&mainPtr->imageTable); } @@ -1011,7 +1010,7 @@ ClientData Tk_GetImageMasterData( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ - CONST char *name, /* Name of image. */ + const char *name, /* Name of image. */ Tk_ImageType **typePtrPtr) /* Points to location to fill in with pointer * to type information for image. */ { @@ -1025,7 +1024,7 @@ Tk_GetImageMasterData( *typePtrPtr = NULL; return NULL; } - masterPtr = (ImageMaster *) Tcl_GetHashValue(hPtr); + masterPtr = Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { *typePtrPtr = NULL; return NULL; diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index fc051d9..324ccc4 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.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: tkImgBmap.c,v 1.22 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkImgBmap.c,v 1.23 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -77,7 +77,7 @@ typedef struct BitmapInstance { static int GetByte(Tcl_Channel chan); static int ImgBmapCreate(Tcl_Interp *interp, - char *name, int argc, Tcl_Obj *CONST objv[], + char *name, int argc, Tcl_Obj *const objv[], Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *clientDataPtr); static ClientData ImgBmapGet(Tk_Window tkwin, ClientData clientData); @@ -147,11 +147,11 @@ typedef struct ParseInfo { */ static int ImgBmapCmd(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST objv[]); + int argc, Tcl_Obj *const objv[]); static void ImgBmapCmdDeletedProc(ClientData clientData); static void ImgBmapConfigureInstance(BitmapInstance *instancePtr); static int ImgBmapConfigureMaster(BitmapMaster *masterPtr, - int argc, Tcl_Obj *CONST objv[], int flags); + int argc, Tcl_Obj *const objv[], int flags); static int NextBitmapWord(ParseInfo *parseInfoPtr); /* @@ -177,7 +177,7 @@ ImgBmapCreate( * image. */ char *name, /* Name to use for image. */ int argc, /* Number of arguments. */ - Tcl_Obj *CONST argv[], /* Argument objects for options (doesn't + Tcl_Obj *const argv[], /* Argument objects for options (doesn't * include image name or type). */ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ Tk_ImageMaster master, /* Token for image, to be used by us in later @@ -191,7 +191,7 @@ ImgBmapCreate( masterPtr->tkMaster = master; masterPtr->interp = interp; masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgBmapCmd, - (ClientData) masterPtr, ImgBmapCmdDeletedProc); + masterPtr, ImgBmapCmdDeletedProc); masterPtr->width = masterPtr->height = 0; masterPtr->data = NULL; masterPtr->maskData = NULL; @@ -203,10 +203,10 @@ ImgBmapCreate( masterPtr->maskDataString = NULL; masterPtr->instancePtr = NULL; if (ImgBmapConfigureMaster(masterPtr, argc, argv, 0) != TCL_OK) { - ImgBmapDelete((ClientData) masterPtr); + ImgBmapDelete(masterPtr); return TCL_ERROR; } - *clientDataPtr = (ClientData) masterPtr; + *clientDataPtr = masterPtr; return TCL_OK; } @@ -235,22 +235,21 @@ ImgBmapConfigureMaster( BitmapMaster *masterPtr, /* Pointer to data structure describing * overall bitmap image to (reconfigure). */ int objc, /* Number of entries in objv. */ - Tcl_Obj *CONST objv[], /* Pairs of configuration options for image. */ + Tcl_Obj *const objv[], /* Pairs of configuration options for image. */ int flags) /* Flags to pass to Tk_ConfigureWidget, such * as TK_CONFIG_ARGV_ONLY. */ { BitmapInstance *instancePtr; int maskWidth, maskHeight, dummy1, dummy2; - CONST char **argv = (CONST char **) ckalloc((objc+1) * sizeof(char *)); + const char **argv = (const char **) ckalloc((objc+1) * sizeof(char *)); for (dummy1 = 0; dummy1 < objc; dummy1++) { argv[dummy1]=Tcl_GetString(objv[dummy1]); } argv[objc] = NULL; if (Tk_ConfigureWidget(masterPtr->interp, Tk_MainWindow(masterPtr->interp), - configSpecs, objc, argv, (char *) masterPtr, flags) - != TCL_OK) { + configSpecs, objc, argv, (char *) masterPtr, flags) != TCL_OK) { ckfree((char *) argv); return TCL_ERROR; } @@ -484,7 +483,7 @@ TkGetBitmapData( int *hotXPtr, int *hotYPtr) /* Position of hot spot or -1,-1. */ { int width, height, numBytes, hotX, hotY; - CONST char *expandedFileName; + const char *expandedFileName; char *p, *end; ParseInfo pi; char *data = NULL; @@ -613,7 +612,7 @@ TkGetBitmapData( goto error; } numBytes = ((width+7)/8) * height; - data = (char *) ckalloc((unsigned) numBytes); + data = ckalloc((unsigned) numBytes); for (p = data; numBytes > 0; p++, numBytes--) { if (NextBitmapWord(&pi) != TCL_OK) { goto error; @@ -744,10 +743,10 @@ ImgBmapCmd( ClientData clientData, /* Information about the image master. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *bmapOptions[] = {"cget", "configure", NULL}; - BitmapMaster *masterPtr = (BitmapMaster *) clientData; + static const char *bmapOptions[] = {"cget", "configure", NULL}; + BitmapMaster *masterPtr = clientData; int index; if (objc < 2) { @@ -809,7 +808,7 @@ ImgBmapGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - BitmapMaster *masterPtr = (BitmapMaster *) masterData; + BitmapMaster *masterPtr = masterData; BitmapInstance *instancePtr; /* @@ -821,7 +820,7 @@ ImgBmapGet( instancePtr = instancePtr->nextPtr) { if (instancePtr->tkwin == tkwin) { instancePtr->refCount++; - return (ClientData) instancePtr; + return instancePtr; } } @@ -852,7 +851,7 @@ ImgBmapGet( masterPtr->height); } - return (ClientData) instancePtr; + return instancePtr; } /* @@ -884,7 +883,7 @@ ImgBmapDisplay( /* Coordinates within drawable that correspond * to imageX and imageY. */ { - BitmapInstance *instancePtr = (BitmapInstance *) clientData; + BitmapInstance *instancePtr = clientData; int masking; /* @@ -938,7 +937,7 @@ ImgBmapFree( * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { - BitmapInstance *instancePtr = (BitmapInstance *) clientData; + BitmapInstance *instancePtr = clientData; BitmapInstance *prevPtr; instancePtr->refCount--; @@ -1000,7 +999,7 @@ ImgBmapDelete( ClientData masterData) /* Pointer to BitmapMaster structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = (BitmapMaster *) masterData; + BitmapMaster *masterPtr = masterData; if (masterPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); @@ -1041,7 +1040,7 @@ ImgBmapCmdDeletedProc( ClientData clientData) /* Pointer to BitmapMaster structure for * image. */ { - BitmapMaster *masterPtr = (BitmapMaster *) clientData; + BitmapMaster *masterPtr = clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -1205,7 +1204,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = (BitmapMaster *) clientData; + BitmapMaster *masterPtr = clientData; char buffer[200]; if (prepass) { diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index 9a823bf..69a0c85 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -32,7 +32,7 @@ * This file also contains code from miGIF. See lower down in file for the * applicable copyright notice for that portion. * - * RCS: @(#) $Id: tkImgGIF.c,v 1.43 2008/04/09 21:00:54 nijtmans Exp $ + * RCS: @(#) $Id: tkImgGIF.c,v 1.44 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -1647,7 +1647,8 @@ color( int x = (statePtr->alphaOffset != 0); for (; x<=MAXCOLORMAPSIZE ; x++) { - if ((statePtr->mapa[x][CM_RED] == red) && (statePtr->mapa[x][CM_GREEN] == green) && + if ((statePtr->mapa[x][CM_RED] == red) && + (statePtr->mapa[x][CM_GREEN] == green) && (statePtr->mapa[x][CM_BLUE] == blue)) { return x; } @@ -1663,7 +1664,8 @@ nuevo( int x = (statePtr->alphaOffset != 0); for (; x<=statePtr->num ; x++) { - if ((statePtr->mapa[x][CM_RED] == red) && (statePtr->mapa[x][CM_GREEN] == green) && + if ((statePtr->mapa[x][CM_RED] == red) && + (statePtr->mapa[x][CM_GREEN] == green) && (statePtr->mapa[x][CM_BLUE] == blue)) { return 0; } @@ -1739,7 +1741,6 @@ ReadValue( } /* - * * GIF Image compression - modified 'compress' * * Based on: compress.c - File compression ala IEEE Computer, June 1984. @@ -1750,55 +1751,54 @@ ReadValue( * Ken Turkowski (decvax!decwrl!turtlevax!ken) * James A. Woods (decvax!ihnp4!ames!jaw) * Joe Orost (decvax!vax135!petsd!joe) - * */ #define MAXCODE(n_bits) (((long) 1 << (n_bits)) - 1) typedef struct { - int n_bits; /* number of bits/code */ + int n_bits; /* number of bits/code */ long maxcode; /* maximum code, given n_bits */ - int htab[HSIZE]; - unsigned int codetab[HSIZE]; + int htab[HSIZE]; + unsigned int codetab[HSIZE]; + long hsize; /* for dynamic table sizing */ - long hsize; /* for dynamic table sizing */ + /* + * To save much memory, we overlay the table used by compress() with those + * used by decompress(). The tab_prefix table is the same size and type as + * the codetab. The tab_suffix table needs 2**GIFBITS characters. We get + * this from the beginning of htab. The output stack uses the rest of + * htab, and contains characters. There is plenty of room for any possible + * stack (stack used to be 8000 characters). + */ -/* - * To save much memory, we overlay the table used by compress() with those - * used by decompress(). The tab_prefix table is the same size and type - * as the codetab. The tab_suffix table needs 2**GIFBITS characters. We - * get this from the beginning of htab. The output stack uses the rest - * of htab, and contains characters. There is plenty of room for any - * possible stack (stack used to be 8000 characters). - */ + int free_ent; /* first unused entry */ - int free_ent; /* first unused entry */ + /* + * block compression parameters -- after all codes are used up, + * and compression rate changes, start over. + */ -/* - * block compression parameters -- after all codes are used up, - * and compression rate changes, start over. - */ int clear_flg; int offset; - unsigned int in_count; /* length of input */ - unsigned int out_count; /* # of codes output (for debugging) */ + unsigned int in_count; /* length of input */ + unsigned int out_count; /* # of codes output (for debugging) */ -/* - * compress stdin to stdout - * - * Algorithm: use open addressing double hashing (no chaining) on the - * prefix code / next character combination. We do a variant of Knuth's - * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime - * secondary probe. Here, the modular division first probe is gives way - * to a faster exclusive-or manipulation. Also do block compression with - * an adaptive reset, whereby the code table is cleared when the compression - * ratio decreases, but after the table fills. The variable-length output - * codes are re-sized at this point, and a special CLEAR code is generated - * for the decompressor. Late addition: construct the table according to - * file size for noticeable speed improvement on small files. Please direct - * questions about this implementation to ames!jaw. - */ + /* + * compress stdin to stdout + * + * Algorithm: use open addressing double hashing (no chaining) on the + * prefix code / next character combination. We do a variant of Knuth's + * algorithm D (vol. 3, sec. 6.4) along with G. Knott's relatively-prime + * secondary probe. Here, the modular division first probe is gives way to + * a faster exclusive-or manipulation. Also do block compression with an + * adaptive reset, whereby the code table is cleared when the compression + * ratio decreases, but after the table fills. The variable-length output + * codes are re-sized at this point, and a special CLEAR code is generated + * for the decompressor. Late addition: construct the table according to + * file size for noticeable speed improvement on small files. Please + * direct questions about this implementation to ames!jaw. + */ int g_init_bits; Tcl_Channel g_outfile; @@ -1807,34 +1807,36 @@ typedef struct { int EOFCode; unsigned long cur_accum; - int cur_bits; + int cur_bits; + + /* + * Number of characters so far in this 'packet' + */ -/* - * Number of characters so far in this 'packet' - */ int a_count; -/* - * Define the storage for the packet accumulator - */ + /* + * Define the storage for the packet accumulator + */ + unsigned char accum[256]; } GIFState_t; -static void output _ANSI_ARGS_((GIFState_t *statePtr, long code)); -static void cl_block _ANSI_ARGS_((GIFState_t *statePtr)); -static void cl_hash _ANSI_ARGS_((GIFState_t *statePtr, int hsize)); -static void char_init _ANSI_ARGS_((GIFState_t *statePtr)); -static void char_out _ANSI_ARGS_((GIFState_t *statePtr, int c)); -static void flush_char _ANSI_ARGS_((GIFState_t *statePtr)); - +static void output(GIFState_t *statePtr, long code); +static void cl_block(GIFState_t *statePtr); +static void cl_hash(GIFState_t *statePtr, int hsize); +static void char_init(GIFState_t *statePtr); +static void char_out(GIFState_t *statePtr, int c); +static void flush_char(GIFState_t *statePtr); static void compress(int initBits, Tcl_Channel handle, ifunptr readValue, GifWriterState *statePtr); - -static void compress(init_bits, handle, readValue, statePtr) - int init_bits; - Tcl_Channel handle; - ifunptr readValue; - GifWriterState *statePtr; + +static void +compress( + int init_bits, + Tcl_Channel handle, + ifunptr readValue, + GifWriterState *statePtr) { register long fcode; register long i = 0; @@ -1846,16 +1848,19 @@ static void compress(init_bits, handle, readValue, statePtr) GIFState_t state; memset(&state, 0, sizeof(state)); + /* * Set up the globals: g_init_bits - initial number of bits - * g_outfile - pointer to output file + * g_outfile - pointer to output file */ + state.g_init_bits = init_bits; state.g_outfile = handle; /* - * Set up the necessary values + * Set up the necessary values. */ + state.offset = 0; state.hsize = HSIZE; state.out_count = 0; @@ -1872,95 +1877,111 @@ static void compress(init_bits, handle, readValue, statePtr) ent = readValue(statePtr); hshift = 0; - for ( fcode = (long) state.hsize; fcode < 65536L; fcode *= 2L ) - hshift++; - hshift = 8 - hshift; /* set hash code range bound */ + for (fcode = (long) state.hsize; fcode < 65536L; fcode *= 2L) { + hshift++; + } + hshift = 8 - hshift; /* set hash code range bound */ hsize_reg = state.hsize; - cl_hash(&state, (int) hsize_reg); /* clear hash table */ + cl_hash(&state, (int) hsize_reg); /* clear hash table */ - output(&state, (long)state.ClearCode); + output(&state, (long) state.ClearCode); #ifdef SIGNED_COMPARE_SLOW - while ( (c = readValue(statePtr) ) != (unsigned) EOF ) { + while ((c = readValue(statePtr)) != (unsigned) EOF) #else - while ( (c = readValue(statePtr)) != EOF ) { + while ((c = readValue(statePtr)) != EOF) #endif + { + state.in_count++; + + fcode = (long) (((long) c << GIFBITS) + ent); + i = (((long)c << hshift) ^ ent); /* xor hashing */ + + if (state.htab[i] == fcode) { + ent = state.codetab[i]; + continue; + } else if ((long) state.htab[i] < 0) { /* empty slot */ + goto nomatch; + } + + disp = hsize_reg - i; /* secondary hash (after G. + * Knott) */ + if (i == 0) { + disp = 1; + } + + probe: + if ((i -= disp) < 0) { + i += hsize_reg; + } - state.in_count++; - - fcode = (long) (((long) c << GIFBITS) + ent); - i = (((long)c << hshift) ^ ent); /* xor hashing */ - - if (state.htab[i] == fcode) { - ent = state.codetab[i]; - continue; - } else if ( (long) state.htab[i] < 0 ) /* empty slot */ - goto nomatch; - disp = hsize_reg - i; /* secondary hash (after G. Knott) */ - if ( i == 0 ) - disp = 1; -probe: - if ( (i -= disp) < 0 ) - i += hsize_reg; - - if (state.htab[i] == fcode) { - ent = state.codetab[i]; - continue; - } - if ( (long) state.htab[i] > 0 ) - goto probe; -nomatch: - output (&state, (long) ent); - state.out_count++; - ent = c; + if (state.htab[i] == fcode) { + ent = state.codetab[i]; + continue; + } + if ((long) state.htab[i] > 0) { + goto probe; + } + + nomatch: + output(&state, (long) ent); + state.out_count++; + ent = c; #ifdef SIGNED_COMPARE_SLOW - if ( (unsigned) free_ent < (unsigned) ((long)1 << GIFBITS)) { + if ((unsigned) free_ent < (unsigned) ((long)1 << GIFBITS)) #else - if (state.free_ent < ((long)1 << GIFBITS)) { + if (state.free_ent < ((long)1 << GIFBITS)) #endif - state.codetab[i] = state.free_ent++; /* code -> hashtable */ - state.htab[i] = fcode; - } else - cl_block(&state); + { + state.codetab[i] = state.free_ent++; /* code -> hashtable */ + state.htab[i] = fcode; + } else { + cl_block(&state); + } } + /* * Put out the final code. */ + output(&state, (long)ent); state.out_count++; output(&state, (long) state.EOFCode); return; } - + /***************************************************************** * TAG( output ) * * Output the given code. * Inputs: - * code: A n_bits-bit integer. If == -1, then EOF. This assumes - * that n_bits =< (long) wordsize - 1. + * code: A n_bits-bit integer. If == -1, then EOF. This assumes that + * n_bits =< (long) wordsize - 1. * Outputs: - * Outputs code to the file. + * Outputs code to the file. * Assumptions: - * Chars are 8 bits long. + * Chars are 8 bits long. * Algorithm: - * Maintain a GIFBITS character long buffer (so that 8 codes will - * fit in it exactly). Use the VAX insv instruction to insert each + * Maintain a GIFBITS character long buffer (so that 8 codes will + * fit in it exactly). Use the VAX insv instruction to insert each * code in turn. When the buffer fills up empty it and start over. */ static const -unsigned long masks[] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000F, - 0x001F, 0x003F, 0x007F, 0x00FF, - 0x01FF, 0x03FF, 0x07FF, 0x0FFF, - 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF }; +unsigned long masks[] = { + 0x0000, + 0x0001, 0x0003, 0x0007, 0x000F, + 0x001F, 0x003F, 0x007F, 0x00FF, + 0x01FF, 0x03FF, 0x07FF, 0x0FFF, + 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF +}; static void -output(statePtr, code) - GIFState_t *statePtr; - long code; +output( + GIFState_t *statePtr, + long code) { statePtr->cur_accum &= masks[statePtr->cur_bits]; @@ -1973,7 +1994,7 @@ output(statePtr, code) statePtr->cur_bits += statePtr->n_bits; while (statePtr->cur_bits >= 8 ) { - char_out(statePtr, (unsigned int)(statePtr->cur_accum & 0xff)); + char_out(statePtr, (unsigned) (statePtr->cur_accum & 0xff)); statePtr->cur_accum >>= 8; statePtr->cur_bits -= 8; } @@ -1985,7 +2006,8 @@ output(statePtr, code) if ((statePtr->free_ent > statePtr->maxcode)|| statePtr->clear_flg ) { if (statePtr->clear_flg) { - statePtr->maxcode = MAXCODE(statePtr->n_bits = statePtr->g_init_bits); + statePtr->maxcode = MAXCODE( + statePtr->n_bits = statePtr->g_init_bits); statePtr->clear_flg = 0; } else { statePtr->n_bits++; @@ -2001,41 +2023,42 @@ output(statePtr, code) /* * At EOF, write the rest of the buffer. */ - while (statePtr->cur_bits > 0) { - char_out(statePtr, (unsigned int)(statePtr->cur_accum & 0xff)); + + while (statePtr->cur_bits > 0) { + char_out(statePtr, (unsigned) (statePtr->cur_accum & 0xff)); statePtr->cur_accum >>= 8; statePtr->cur_bits -= 8; } flush_char(statePtr); } } - + /* * Clear out the hash table */ + static void -cl_block(statePtr) /* table clear for block compress */ - GIFState_t *statePtr; +cl_block( /* table clear for block compress */ + GIFState_t *statePtr) { + cl_hash(statePtr, (int) statePtr->hsize); + statePtr->free_ent = statePtr->ClearCode + 2; + statePtr->clear_flg = 1; - cl_hash (statePtr, (int) statePtr->hsize); - statePtr->free_ent = statePtr->ClearCode + 2; - statePtr->clear_flg = 1; - - output(statePtr, (long) statePtr->ClearCode); + output(statePtr, (long) statePtr->ClearCode); } - + static void -cl_hash(statePtr, hsize) /* reset code table */ - GIFState_t *statePtr; - int hsize; +cl_hash( /* reset code table */ + GIFState_t *statePtr, + int hsize) { - register int *htab_p = statePtr->htab+hsize; + register int *htab_p = statePtr->htab + hsize; register long i; register long m1 = -1; i = hsize - 16; - do { /* might use Sys V memset(3) here */ + do { /* might use Sys V memset(3) here */ *(htab_p-16) = m1; *(htab_p-15) = m1; *(htab_p-14) = m1; @@ -2059,53 +2082,59 @@ cl_hash(statePtr, hsize) /* reset code table */ *--htab_p = m1; } } - - -/****************************************************************************** + +/* + ***************************************************************************** * * GIF Specific routines * - ******************************************************************************/ + ***************************************************************************** + */ /* * Set up the 'byte output' routine */ + static void -char_init(statePtr) - GIFState_t *statePtr; +char_init( + GIFState_t *statePtr) { statePtr->a_count = 0; statePtr->cur_accum = 0; statePtr->cur_bits = 0; } - + /* * Add a character to the end of the current packet, and if it is 254 * characters, flush the packet to disk. */ + static void -char_out(statePtr, c) - GIFState_t *statePtr; - int c; +char_out( + GIFState_t *statePtr, + int c) { statePtr->accum[statePtr->a_count++] = c; if (statePtr->a_count >= 254) { flush_char(statePtr); } } - + /* * Flush the packet to disk, and reset the accumulator */ + static void -flush_char(statePtr) - GIFState_t *statePtr; +flush_char( + GIFState_t *statePtr) { unsigned char c; + if (statePtr->a_count > 0) { c = statePtr->a_count; - Tcl_Write(statePtr->g_outfile, (CONST char *) &c, 1); - Tcl_Write(statePtr->g_outfile, (CONST char *) statePtr->accum, statePtr->a_count); + Tcl_Write(statePtr->g_outfile, (const char *) &c, 1); + Tcl_Write(statePtr->g_outfile, (const char *) statePtr->accum, + statePtr->a_count); statePtr->a_count = 0; } } diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index 7aeeade..6419072 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -13,7 +13,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPPM.c,v 1.21 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkImgPPM.c,v 1.22 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -36,14 +36,14 @@ * The format record for the PPM file format: */ -static int FileMatchPPM(Tcl_Channel chan, CONST char *fileName, +static int FileMatchPPM(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int FileReadPPM(Tcl_Interp *interp, Tcl_Channel chan, - CONST char *fileName, Tcl_Obj *format, + const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); -static int FileWritePPM(Tcl_Interp *interp, CONST char *fileName, +static int FileWritePPM(Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); static int StringWritePPM(Tcl_Interp *interp, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr); @@ -95,7 +95,7 @@ static int ReadPPMStringHeader(Tcl_Obj *dataObj, int *widthPtr, static int FileMatchPPM( Tcl_Channel chan, /* The image file, open for reading. */ - CONST char *fileName, /* The name of the image file. */ + const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format string, or NULL. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned @@ -131,7 +131,7 @@ static int FileReadPPM( Tcl_Interp *interp, /* Interpreter to use for reporting errors. */ Tcl_Channel chan, /* The image file, open for reading. */ - CONST char *fileName, /* The name of the image file. */ + const char *fileName, /* The name of the image file. */ Tcl_Obj *format, /* User-specified format string, or NULL. */ Tk_PhotoHandle imageHandle, /* The photo image to write into. */ int destX, int destY, /* Coordinates of top-left pixel in photo @@ -267,7 +267,7 @@ FileReadPPM( static int FileWritePPM( Tcl_Interp *interp, - CONST char *fileName, + const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) { diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index eff0fde..3d7b017 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -17,7 +17,7 @@ * Department of Computer Science, * Australian National University. * - * RCS: @(#) $Id: tkImgPhoto.c,v 1.76 2007/12/13 15:24:14 dgp Exp $ + * RCS: @(#) $Id: tkImgPhoto.c,v 1.77 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -302,7 +302,7 @@ static char *optionNames[] = { */ static int ImgPhotoCreate(Tcl_Interp *interp, char *name, - int objc, Tcl_Obj *CONST objv[], + int objc, Tcl_Obj *const objv[], Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *clientDataPtr); static ClientData ImgPhotoGet(Tk_Window tkwin, ClientData clientData); @@ -395,7 +395,7 @@ static int imgPhotoColorHashInitialized; static void PhotoFormatThreadExitProc(ClientData clientData); static int ImgPhotoCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ParseSubcommandOptions( struct SubcommandOptions *optPtr, Tcl_Interp *interp, int allowedOptions, @@ -579,7 +579,7 @@ ImgPhotoCreate( * image. */ char *name, /* Name to use for image. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects for options (doesn't + Tcl_Obj *const objv[], /* Argument objects for options (doesn't * include image name or type). */ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ Tk_ImageMaster master, /* Token for image, to be used by us in later @@ -598,7 +598,7 @@ ImgPhotoCreate( masterPtr->tkMaster = master; masterPtr->interp = interp; masterPtr->imageCmd = Tcl_CreateObjCommand(interp, name, ImgPhotoCmd, - (ClientData) masterPtr, ImgPhotoCmdDeletedProc); + masterPtr, ImgPhotoCmdDeletedProc); masterPtr->palette = NULL; masterPtr->pix32 = NULL; masterPtr->instancePtr = NULL; @@ -609,11 +609,11 @@ ImgPhotoCreate( */ if (ImgPhotoConfigureMaster(interp, masterPtr, objc, objv, 0) != TCL_OK) { - ImgPhotoDelete((ClientData) masterPtr); + ImgPhotoDelete(masterPtr); return TCL_ERROR; } - *clientDataPtr = (ClientData) masterPtr; + *clientDataPtr = masterPtr; return TCL_OK; } @@ -640,7 +640,7 @@ ImgPhotoCmd( ClientData clientData, /* Information about photo master. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *photoOptions[] = { "blank", "cget", "configure", "copy", "data", "get", "put", @@ -652,7 +652,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = (PhotoMaster *) clientData; + PhotoMaster *masterPtr = clientData; int result, index, x, y, width, height, dataWidth, dataHeight, listObjc; struct SubcommandOptions options; Tcl_Obj **listObjv, **srcObjv; @@ -1206,7 +1206,7 @@ ImgPhotoCmd( block.offset[1] = 1; block.offset[2] = 2; block.offset[3] = 0; - result = Tk_PhotoPutBlock(interp, (ClientData)masterPtr, &block, + result = Tk_PhotoPutBlock(interp, masterPtr, &block, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, TK_PHOTO_COMPOSITE_SET); @@ -2328,7 +2328,7 @@ ImgPhotoGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) masterData; + PhotoMaster *masterPtr = masterData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -2378,14 +2378,14 @@ ImgPhotoGet( * We are resurrecting this instance. */ - Tcl_CancelIdleCall(DisposeInstance, (ClientData) instancePtr); + Tcl_CancelIdleCall(DisposeInstance, instancePtr); if (instancePtr->colorTablePtr != NULL) { FreeColorTable(instancePtr->colorTablePtr, 0); } GetColorTable(instancePtr); } instancePtr->refCount++; - return (ClientData) instancePtr; + return instancePtr; } } @@ -2489,7 +2489,7 @@ ImgPhotoGet( masterPtr->width, masterPtr->height); } - return (ClientData) instancePtr; + return instancePtr; } /* @@ -2760,7 +2760,7 @@ ImgPhotoDisplay( int drawableX,int drawableY)/* Coordinates within drawable that correspond * to imageX and imageY. */ { - PhotoInstance *instancePtr = (PhotoInstance *) clientData; + PhotoInstance *instancePtr = clientData; XVisualInfo visInfo = instancePtr->visualInfo; /* @@ -2783,8 +2783,7 @@ ImgPhotoDisplay( * not properly constrained, which can cause an X error. [Bug 979239] */ - handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, - (ClientData) NULL); + handler = Tk_CreateErrorHandler(display, -1, -1, -1, NULL, NULL); /* * Pull the current background from the display to blend with @@ -2855,7 +2854,7 @@ ImgPhotoFree( Display *display) /* Display containing window that used * image. */ { - PhotoInstance *instancePtr = (PhotoInstance *) clientData; + PhotoInstance *instancePtr = clientData; ColorTable *colorPtr; instancePtr->refCount -= 1; @@ -2875,7 +2874,7 @@ ImgPhotoFree( colorPtr->liveRefCount -= 1; } - Tcl_DoWhenIdle(DisposeInstance, (ClientData) instancePtr); + Tcl_DoWhenIdle(DisposeInstance, instancePtr); } /* @@ -2900,15 +2899,15 @@ ImgPhotoDelete( ClientData masterData) /* Pointer to PhotoMaster structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = (PhotoMaster *) masterData; + PhotoMaster *masterPtr = masterData; PhotoInstance *instancePtr; while ((instancePtr = masterPtr->instancePtr) != NULL) { if (instancePtr->refCount > 0) { Tcl_Panic("tried to delete photo image when instances still exist"); } - Tcl_CancelIdleCall(DisposeInstance, (ClientData) instancePtr); - DisposeInstance((ClientData) instancePtr); + Tcl_CancelIdleCall(DisposeInstance, instancePtr); + DisposeInstance(instancePtr); } masterPtr->tkMaster = NULL; if (masterPtr->imageCmd != NULL) { @@ -2952,7 +2951,7 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoMaster structure for * image. */ { - PhotoMaster *masterPtr = (PhotoMaster *) clientData; + PhotoMaster *masterPtr = clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -3350,7 +3349,7 @@ IsValidPalette( case StaticColor: numColors = nRed; if (!mono) { - numColors *= nGreen*nBlue; + numColors *= nGreen * nBlue; } if (numColors > (1 << instancePtr->visualInfo.depth)) { return 0; @@ -3447,7 +3446,7 @@ GetColorTable( * Re-use the existing entry. */ - colorPtr = (ColorTable *) Tcl_GetHashValue(entry); + colorPtr = Tcl_GetHashValue(entry); } else { /* * No color table currently available; need to make one. @@ -3480,7 +3479,7 @@ GetColorTable( colorPtr->liveRefCount++; instancePtr->colorTablePtr = colorPtr; if (colorPtr->flags & DISPOSE_PENDING) { - Tcl_CancelIdleCall(DisposeColorTable, (ClientData) colorPtr); + Tcl_CancelIdleCall(DisposeColorTable, colorPtr); colorPtr->flags &= ~DISPOSE_PENDING; } @@ -3525,12 +3524,12 @@ FreeColorTable( if (force) { if ((colorPtr->flags & DISPOSE_PENDING) != 0) { - Tcl_CancelIdleCall(DisposeColorTable, (ClientData) colorPtr); + Tcl_CancelIdleCall(DisposeColorTable, colorPtr); colorPtr->flags &= ~DISPOSE_PENDING; } - DisposeColorTable((ClientData) colorPtr); + DisposeColorTable(colorPtr); } else if ((colorPtr->flags & DISPOSE_PENDING) == 0) { - Tcl_DoWhenIdle(DisposeColorTable, (ClientData) colorPtr); + Tcl_DoWhenIdle(DisposeColorTable, colorPtr); colorPtr->flags |= DISPOSE_PENDING; } } @@ -3840,7 +3839,7 @@ DisposeColorTable( ClientData clientData) /* Pointer to the ColorTable whose * colors are to be released. */ { - ColorTable *colorPtr = (ColorTable *) clientData; + ColorTable *colorPtr = clientData; Tcl_HashEntry *entry; if (colorPtr->pixelMap != NULL) { @@ -3900,7 +3899,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while (entry != NULL) { - colorPtr = (ColorTable *) Tcl_GetHashValue(entry); + colorPtr = Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0) @@ -3929,7 +3928,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while ((entry != NULL) && (numColors > 0)) { - colorPtr = (ColorTable *) Tcl_GetHashValue(entry); + colorPtr = Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0) @@ -3974,7 +3973,7 @@ DisposeInstance( ClientData clientData) /* Pointer to the instance whose resources are * to be released. */ { - PhotoInstance *instancePtr = (PhotoInstance *) clientData; + PhotoInstance *instancePtr = clientData; PhotoInstance *prevPtr; if (instancePtr->pixels != None) { @@ -4273,16 +4272,16 @@ Tk_PhotoHandle Tk_FindPhoto( Tcl_Interp *interp, /* Interpreter (application) in which image * exists. */ - CONST char *imageName) /* Name of the desired photo image. */ + const char *imageName) /* Name of the desired photo image. */ { - ClientData clientData; Tk_ImageType *typePtr; + ClientData clientData = + Tk_GetImageMasterData(interp, imageName, &typePtr); - clientData = Tk_GetImageMasterData(interp, imageName, &typePtr); if (typePtr != &tkPhotoImageType) { return NULL; } - return (Tk_PhotoHandle) clientData; + return clientData; } /* @@ -4617,7 +4616,7 @@ Tk_PhotoPutBlock( if (!sourceIsSimplePhoto && (width == 1) && (height == 1)) { /* * Optimize the single pixel case if we can. This speeds up code that - * builds up large simple-alpha images by single pixels. We don't + * builds up large simple-alpha images by single pixels. We don't * negate COMPLEX_ALPHA in this case. [Bug 1409140] */ @@ -4634,7 +4633,7 @@ Tk_PhotoPutBlock( } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or - * rescan if we already knew such pixels existed. To restrict this + * rescan if we already knew such pixels existed. To restrict this * Toggle to only checking the changed pixels requires knowing where * the alpha pixels are. */ @@ -4743,7 +4742,7 @@ Tk_PhotoPutZoomedBlock( } if ((y < masterPtr->ditherY) || ((y == masterPtr->ditherY) - && (x < masterPtr->ditherX))) { + && (x < masterPtr->ditherX))) { /* * The dithering isn't correct past the start of this block. */ @@ -4917,7 +4916,7 @@ Tk_PhotoPutZoomedBlock( if (!sourceIsSimplePhoto && (width == 1) && (height == 1)) { /* * Optimize the single pixel case if we can. This speeds up code that - * builds up large simple-alpha images by single pixels. We don't + * builds up large simple-alpha images by single pixels. We don't * negate COMPLEX_ALPHA in this case. [Bug 1409140] */ if (!(masterPtr->flags & COMPLEX_ALPHA)) { @@ -4933,7 +4932,7 @@ Tk_PhotoPutZoomedBlock( } else if ((alphaOffset != 0) || (masterPtr->flags & COMPLEX_ALPHA)) { /* * Check for partial transparency if alpha pixels are specified, or - * rescan if we already knew such pixels existed. To restrict this + * rescan if we already knew such pixels existed. To restrict this * Toggle to only checking the changed pixels requires knowing where * the alpha pixels are. */ @@ -5246,7 +5245,7 @@ DitherInstance( for (x = xStart; x < xEnd; ++x) { c = (x > 0) ? errPtr[-1] * 7: 0; if (y > 0) { - if (x > 0) { + if (x > 0) { c += errPtr[-lineLength-1]; } c += errPtr[-lineLength] * 5; @@ -5259,7 +5258,7 @@ DitherInstance( if ((masterPtr->flags & COLOR_IMAGE) == 0) { c += srcPtr[0]; } else { - c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16 + c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16 + srcPtr[2] * 5 + 16) >> 5; } srcPtr += 4; @@ -5900,8 +5899,7 @@ PhotoOptionFind( char *name = Tcl_GetStringFromObj(obj, &length); char *prevname = NULL; Tcl_ObjCmdProc *proc = NULL; - OptionAssocData *list = (OptionAssocData *) Tcl_GetAssocData(interp, - "photoOption", NULL); + OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL); while (list != NULL) { if (strncmp(name, list->name, (unsigned) length) == 0) { @@ -5951,7 +5949,7 @@ PhotoOptionCleanupProc( * interpreter. */ Tcl_Interp *interp) /* Interpreter that is being deleted. */ { - OptionAssocData *list = (OptionAssocData *) clientData; + OptionAssocData *list = clientData; while (list != NULL) { register OptionAssocData *ptr; @@ -5981,12 +5979,11 @@ PhotoOptionCleanupProc( MODULE_SCOPE void Tk_CreatePhotoOption( Tcl_Interp *interp, /* Interpreter. */ - CONST char *name, /* Option name. */ + const char *name, /* Option name. */ Tcl_ObjCmdProc *proc) /* Function to execute command. */ { OptionAssocData *typePtr2, *prevPtr, *ptr; - OptionAssocData *list = (OptionAssocData *) - Tcl_GetAssocData(interp, "photoOption", NULL); + OptionAssocData *list = Tcl_GetAssocData(interp, "photoOption", NULL); /* * If there's already a photo option with the given name, remove it. @@ -6008,8 +6005,7 @@ Tk_CreatePhotoOption( strcpy(&(ptr->name[0]), name); ptr->command = proc; ptr->nextPtr = list; - Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc, - (ClientData) ptr); + Tcl_SetAssocData(interp, "photoOption", PhotoOptionCleanupProc, ptr); } /* @@ -6041,7 +6037,7 @@ ImgPhotoPostscript( { Tk_PhotoImageBlock block; - Tk_PhotoGetImage((Tk_PhotoHandle) clientData, &block); + Tk_PhotoGetImage(clientData, &block); block.pixelPtr += y * block.pitch + x * block.pixelSize; return Tk_PostscriptPhoto(interp, &block, psInfo, width, height); diff --git a/generic/tkMain.c b/generic/tkMain.c index 9f6a73c..396c93f 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMain.c,v 1.29 2008/04/01 16:30:54 dgp Exp $ + * RCS: @(#) $Id: tkMain.c,v 1.30 2008/04/27 22:38:56 dkf Exp $ */ #include <ctype.h> @@ -56,7 +56,7 @@ static Tcl_ThreadDataKey dataKey; #if !defined(__WIN32__) && !defined(_WIN32) extern int isatty(int fd); -extern char * strrchr(CONST char *string, int c); +extern char * strrchr(const char *string, int c); #endif /* @@ -96,7 +96,7 @@ Tk_MainEx( Tcl_Interp *interp) { Tcl_Obj *path, *argvPtr; - CONST char *encodingName; + const char *encodingName; int code, nullStdin = 0; Tcl_Channel inChannel, outChannel; ThreadSpecificData *tsdPtr; @@ -114,12 +114,11 @@ Tk_MainEx( abort(); } - tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_FindExecutable(argv[0]); tsdPtr->interp = interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); #if defined(__WIN32__) Tk_InitConsoleChannels(interp); @@ -176,7 +175,7 @@ Tk_MainEx( Tcl_ExternalToUtfDString(NULL, argv[0], -1, &appName); } else { int numBytes; - CONST char *pathName = Tcl_GetStringFromObj(path, &numBytes); + const char *pathName = Tcl_GetStringFromObj(path, &numBytes); Tcl_ExternalToUtfDString(NULL, pathName, numBytes, &appName); path = Tcl_NewStringObj(Tcl_DStringValue(&appName), -1); @@ -298,7 +297,7 @@ Tk_MainEx( inChannel = Tcl_GetStdChannel(TCL_STDIN); if (inChannel) { Tcl_CreateChannelHandler(inChannel, TCL_READABLE, StdinProc, - (ClientData) inChannel); + inChannel); } if (tsdPtr->tty) { Prompt(interp, 0); @@ -320,7 +319,7 @@ Tk_MainEx( Tk_MainLoop(); Tcl_DeleteInterp(interp); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); Tcl_SetStartupScript(NULL, NULL); Tcl_Exit(0); } @@ -353,8 +352,8 @@ StdinProc( static int gotPartial = 0; char *cmd; int code, count; - Tcl_Channel chan = (Tcl_Channel) clientData; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_Channel chan = clientData; + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *interp = tsdPtr->interp; @@ -364,13 +363,12 @@ StdinProc( if (tsdPtr->tty) { Tcl_Exit(0); } else { - Tcl_DeleteChannelHandler(chan, StdinProc, (ClientData) chan); + Tcl_DeleteChannelHandler(chan, StdinProc, chan); } return; } - (void) Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue( - &tsdPtr->line), -1); + Tcl_DStringAppend(&tsdPtr->command, Tcl_DStringValue(&tsdPtr->line), -1); cmd = Tcl_DStringAppend(&tsdPtr->command, "\n", -1); Tcl_DStringFree(&tsdPtr->line); if (!Tcl_CommandComplete(cmd)) { @@ -386,13 +384,12 @@ StdinProc( * things, this will trash the text of the command being evaluated. */ - Tcl_CreateChannelHandler(chan, 0, StdinProc, (ClientData) chan); + Tcl_CreateChannelHandler(chan, 0, StdinProc, chan); code = Tcl_RecordAndEval(interp, cmd, TCL_EVAL_GLOBAL); chan = Tcl_GetStdChannel(TCL_STDIN); if (chan) { - Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, - (ClientData) chan); + Tcl_CreateChannelHandler(chan, TCL_READABLE, StdinProc, chan); } Tcl_DStringFree(&tsdPtr->command); if (Tcl_GetStringResult(interp)[0] != '\0') { diff --git a/generic/tkMenu.c b/generic/tkMenu.c index a402fc3..1f18cc3 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.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: tkMenu.c,v 1.41 2007/12/13 15:24:15 dgp Exp $ + * RCS: @(#) $Id: tkMenu.c,v 1.42 2008/04/27 22:38:56 dkf Exp $ */ /* @@ -101,7 +101,7 @@ TCL_DECLARE_MUTEX(menuMutex) char *tkMenuStateStrings[] = {"active", "normal", "disabled", NULL}; -static CONST char *menuEntryTypeStrings[] = { +static const char *menuEntryTypeStrings[] = { "cascade", "checkbutton", "command", "radiobutton", "separator", NULL }; @@ -310,7 +310,7 @@ static const Tk_OptionSpec tkMenuConfigSpecs[] = { * with MenuWidgetObjCmd. */ -static CONST char *menuOptions[] = { +static const char *menuOptions[] = { "activate", "add", "cget", "clone", "configure", "delete", "entrycget", "entryconfigure", "index", "insert", "invoke", "post", "postcascade", "type", "unpost", "xposition", "yposition", NULL @@ -329,12 +329,12 @@ enum options { static int CloneMenu(TkMenu *menuPtr, Tcl_Obj *newMenuName, Tcl_Obj *newMenuTypeString); static int ConfigureMenu(Tcl_Interp *interp, TkMenu *menuPtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ConfigureMenuCloneEntries(Tcl_Interp *interp, TkMenu *menuPtr, int index, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int ConfigureMenuEntry(TkMenuEntry *mePtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DeleteMenuCloneEntries(TkMenu *menuPtr, int first, int last); static void DestroyMenuHashTable(ClientData clientData, @@ -349,17 +349,17 @@ static int MenuDoXPosition(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr); static int MenuAddOrInsert(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int MenuCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void MenuCmdDeletedProc(ClientData clientData); static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, int index, int type); static char * MenuVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static int MenuWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void MenuWorldChanged(ClientData instanceData); static int PostProcessEntry(TkMenuEntry *mePtr); static void RecursivelyDeleteMenu(TkMenu *menuPtr); @@ -416,8 +416,7 @@ TkCreateMenuCmd( optionTablesPtr->entryOptionTables[CHECK_BUTTON_ENTRY] = Tk_CreateOptionTable(interp, specsArray[CHECK_BUTTON_ENTRY]); - Tcl_CreateObjCommand(interp, "menu", MenuCmd, - (ClientData) optionTablesPtr, NULL); + Tcl_CreateObjCommand(interp, "menu", MenuCmd, optionTablesPtr, NULL); if (Tcl_IsSafe(interp)) { Tcl_HideCommand(interp, "menu", "menu"); @@ -448,7 +447,7 @@ MenuCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = Tk_MainWindow(interp); Tk_Window newWin; @@ -456,8 +455,8 @@ MenuCmd( TkMenuReferences *menuRefPtr; int i, index, toplevel; char *windowName; - static CONST char *typeStringList[] = {"-type", NULL}; - TkMenuOptionTables *optionTablesPtr = (TkMenuOptionTables *) clientData; + static const char *typeStringList[] = {"-type", NULL}; + TkMenuOptionTables *optionTablesPtr = clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?options?"); @@ -497,8 +496,8 @@ MenuCmd( menuPtr->display = Tk_Display(newWin); menuPtr->interp = interp; menuPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, - (ClientData) menuPtr, MenuCmdDeletedProc); + Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, + MenuCmdDeletedProc); menuPtr->active = -1; menuPtr->cursorPtr = None; menuPtr->masterMenuPtr = menuPtr; @@ -507,10 +506,10 @@ MenuCmd( TkMenuInitializeDrawingFields(menuPtr); Tk_SetClass(menuPtr->tkwin, "Menu"); - Tk_SetClassProcs(menuPtr->tkwin, &menuClass, (ClientData) menuPtr); + Tk_SetClassProcs(menuPtr->tkwin, &menuClass, menuPtr); Tk_CreateEventHandler(newWin, ExposureMask|StructureNotifyMask|ActivateMask, - TkMenuEventProc, (ClientData) menuPtr); + TkMenuEventProc, menuPtr); if (Tk_InitOptions(interp, (char *) menuPtr, menuPtr->optionTablesPtr->menuOptionTable, menuPtr->tkwin) != TCL_OK) { @@ -661,9 +660,9 @@ MenuWidgetObjCmd( ClientData clientData, /* Information about menu widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkMenu *menuPtr = (TkMenu *) clientData; + register TkMenu *menuPtr = clientData; register TkMenuEntry *mePtr; int result = TCL_OK; int option; @@ -676,7 +675,7 @@ MenuWidgetObjCmd( &option) != TCL_OK) { return TCL_ERROR; } - Tcl_Preserve((ClientData) menuPtr); + Tcl_Preserve(menuPtr); switch ((enum options) option) { case MENU_ACTIVATE: { @@ -808,10 +807,10 @@ MenuWidgetObjCmd( goto done; } mePtr = menuPtr->entries[index]; - Tcl_Preserve((ClientData) mePtr); + Tcl_Preserve(mePtr); resultPtr = Tk_GetOptionValue(interp, (char *) mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); - Tcl_Release((ClientData) mePtr); + Tcl_Release(mePtr); if (resultPtr == NULL) { goto error; } @@ -833,7 +832,7 @@ MenuWidgetObjCmd( goto done; } mePtr = menuPtr->entries[index]; - Tcl_Preserve((ClientData) mePtr); + Tcl_Preserve(mePtr); if (objc == 3) { resultPtr = Tk_GetOptionInfo(interp, (char *) mePtr, mePtr->optionTable, NULL, menuPtr->tkwin); @@ -856,7 +855,7 @@ MenuWidgetObjCmd( result = ConfigureMenuCloneEntries(interp, menuPtr, index, objc-3, objv+3); } - Tcl_Release((ClientData) mePtr); + Tcl_Release(mePtr); break; } case MENU_INDEX: { @@ -989,11 +988,11 @@ MenuWidgetObjCmd( break; } done: - Tcl_Release((ClientData) menuPtr); + Tcl_Release(menuPtr); return result; error: - Tcl_Release((ClientData) menuPtr); + Tcl_Release(menuPtr); return TCL_ERROR; } @@ -1032,9 +1031,11 @@ TkInvokeMenu( if (mePtr->state == ENTRY_DISABLED) { goto done; } - Tcl_Preserve((ClientData) mePtr); + + Tcl_Preserve(mePtr); if (mePtr->type == TEAROFF_ENTRY) { Tcl_DString ds; + Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "tk::TearOffMenu ", -1); Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), -1); @@ -1087,7 +1088,8 @@ TkInvokeMenu( result = Tcl_EvalObjEx(interp, commandPtr, TCL_EVAL_GLOBAL); Tcl_DecrRefCount(commandPtr); } - Tcl_Release((ClientData) mePtr); + Tcl_Release(mePtr); + done: return result; } @@ -1469,7 +1471,7 @@ DestroyMenuEntry( Tcl_UntraceVar(menuPtr->interp, varName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuVarProc, (ClientData) mePtr); + MenuVarProc, mePtr); } TkpDestroyMenuEntry(mePtr); TkMenuEntryFreeDrawOptions(mePtr); @@ -1499,7 +1501,7 @@ static void MenuWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkMenu *menuPtr = (TkMenu *) instanceData; + TkMenu *menuPtr = instanceData; int i; TkMenuConfigureDrawOptions(menuPtr); @@ -1536,7 +1538,7 @@ ConfigureMenu( register TkMenu *menuPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[]) /* Arguments. */ + Tcl_Obj *const objv[]) /* Arguments. */ { int i; TkMenu *menuListPtr, *cleanupPtr; @@ -1620,8 +1622,7 @@ ConfigureMenu( && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { int i; - Tcl_EventuallyFree((ClientData) menuListPtr->entries[0], - DestroyMenuEntry); + Tcl_EventuallyFree(menuListPtr->entries[0], DestroyMenuEntry); for (i = 0; i < menuListPtr->numEntries - 1; i++) { menuListPtr->entries[i] = menuListPtr->entries[i + 1]; @@ -1789,7 +1790,7 @@ PostProcessEntry( char *imageString = Tcl_GetString(mePtr->imagePtr); image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, imageString, - TkMenuImageProc, (ClientData) mePtr); + TkMenuImageProc, mePtr); if (image == NULL) { return TCL_ERROR; } @@ -1804,7 +1805,7 @@ PostProcessEntry( char *selectImageString = Tcl_GetString(mePtr->selectImagePtr); image = Tk_GetImage(menuPtr->interp, menuPtr->tkwin, selectImageString, - TkMenuSelectImageProc, (ClientData) mePtr); + TkMenuSelectImageProc, mePtr); if (image == NULL) { return TCL_ERROR; } @@ -1871,7 +1872,7 @@ PostProcessEntry( name = Tcl_GetString(mePtr->namePtr); Tcl_TraceVar(menuPtr->interp, name, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuVarProc, (ClientData) mePtr); + MenuVarProc, mePtr); } } @@ -1902,7 +1903,7 @@ ConfigureMenuEntry( register TkMenuEntry *mePtr,/* Information about menu entry; may or may * not already have values for some fields. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[]) /* Arguments. */ + Tcl_Obj *const objv[]) /* Arguments. */ { TkMenu *menuPtr = mePtr->menuPtr; Tk_SavedOptions errorStruct; @@ -1920,7 +1921,7 @@ ConfigureMenuEntry( Tcl_UntraceVar(menuPtr->interp, name, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuVarProc, (ClientData) mePtr); + MenuVarProc, mePtr); } result = TCL_OK; @@ -1967,7 +1968,7 @@ ConfigureMenuCloneEntries( TkMenu *menuPtr, /* Information about whole menu. */ int index, /* Index of mePtr within menuPtr's entries. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[]) /* Arguments. */ + Tcl_Obj *const objv[]) /* Arguments. */ { TkMenuEntry *mePtr; TkMenu *menuListPtr; @@ -2195,7 +2196,7 @@ static void MenuCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenu *menuPtr = (TkMenu *) clientData; + TkMenu *menuPtr = clientData; Tk_Window tkwin = menuPtr->tkwin; /* @@ -2336,7 +2337,7 @@ MenuAddOrInsert( Tcl_Obj *indexPtr, /* Object describing index at which to insert. * NULL means insert at end. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments to command: first arg is type of + Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of * entry, others are config options. */ { int type, index; @@ -2386,7 +2387,7 @@ MenuAddOrInsert( for (errorMenuPtr = menuPtr->masterMenuPtr; errorMenuPtr != NULL; errorMenuPtr = errorMenuPtr->nextInstancePtr) { - Tcl_EventuallyFree((ClientData) errorMenuPtr->entries[index], + Tcl_EventuallyFree(errorMenuPtr->entries[index], DestroyMenuEntry); for (i = index; i < errorMenuPtr->numEntries - 1; i++) { errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1]; @@ -2474,15 +2475,14 @@ static char * MenuVarProc( ClientData clientData, /* Information about menu entry. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* First part of variable's name. */ - CONST char *name2, /* Second part of variable's name. */ + const char *name1, /* First part of variable's name. */ + const char *name2, /* Second part of variable's name. */ int flags) /* Describes what just happened. */ { - TkMenuEntry *mePtr = (TkMenuEntry *) clientData; + TkMenuEntry *mePtr = clientData; TkMenu *menuPtr; - CONST char *value; - char *name; - char *onValue; + const char *value; + char *name, *onValue; if (flags & TCL_INTERP_DESTROYED) { /* @@ -2686,7 +2686,7 @@ CloneMenu( for (i = 0; i < 4; i++) { Tcl_IncrRefCount(menuDupCommandArray[i]); } - Tcl_Preserve((ClientData) menuPtr); + Tcl_Preserve(menuPtr); returnResult = Tcl_EvalObjv(menuPtr->interp, 4, menuDupCommandArray, 0); for (i = 0; i < 4; i++) { Tcl_DecrRefCount(menuDupCommandArray[i]); @@ -2732,8 +2732,8 @@ CloneMenu( newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), -1); Tcl_IncrRefCount(newObjv[0]); Tcl_IncrRefCount(newObjv[1]); - if (Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin, - newMenuPtr->interp, 2, newObjv) == TCL_OK) { + if (Tk_BindtagsObjCmd(newMenuPtr->tkwin, newMenuPtr->interp, 2, + newObjv) == TCL_OK) { char *windowName; Tcl_Obj *bindingsPtr = Tcl_DuplicateObj(Tcl_GetObjResult(newMenuPtr->interp)); @@ -2758,8 +2758,8 @@ CloneMenu( Tcl_ListObjReplace(menuPtr->interp, bindingsPtr, i + 1, 0, 1, &newElementPtr); newObjv[2] = bindingsPtr; - Tk_BindtagsObjCmd((ClientData)newMenuPtr->tkwin, - menuPtr->interp, 3, newObjv); + Tk_BindtagsObjCmd(newMenuPtr->tkwin, menuPtr->interp, 3, + newObjv); break; } } @@ -2811,7 +2811,7 @@ CloneMenu( } else { returnResult = TCL_ERROR; } - Tcl_Release((ClientData) menuPtr); + Tcl_Release(menuPtr); return returnResult; } @@ -3271,8 +3271,8 @@ DestroyMenuHashTable( ClientData clientData, /* The menu hash table we are destroying. */ Tcl_Interp *interp) /* The interpreter we are destroying. */ { - Tcl_DeleteHashTable((Tcl_HashTable *) clientData); - ckfree((char *) clientData); + Tcl_DeleteHashTable(clientData); + ckfree(clientData); } /* @@ -3305,7 +3305,7 @@ TkGetMenuHashTable( menuTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS); Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable, - (ClientData) menuTablePtr); + menuTablePtr); } return menuTablePtr; } @@ -3348,9 +3348,9 @@ TkCreateMenuReferences( menuRefPtr->topLevelListPtr = NULL; menuRefPtr->parentEntryPtr = NULL; menuRefPtr->hashEntryPtr = hashEntryPtr; - Tcl_SetHashValue(hashEntryPtr, (char *) menuRefPtr); + Tcl_SetHashValue(hashEntryPtr, menuRefPtr); } else { - menuRefPtr = (TkMenuReferences *) Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3387,7 +3387,7 @@ TkFindMenuReferences( menuTablePtr = TkGetMenuHashTable(interp); hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, pathName); if (hashEntryPtr != NULL) { - menuRefPtr = (TkMenuReferences *) Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3485,8 +3485,7 @@ DeleteMenuCloneEntries( for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { for (i = last; i >= first; i--) { - Tcl_EventuallyFree((ClientData) menuListPtr->entries[i], - DestroyMenuEntry); + Tcl_EventuallyFree(menuListPtr->entries[i], DestroyMenuEntry); } for (i = last + 1; i < menuListPtr->numEntries; i++) { j = i - numDeleted; @@ -3552,7 +3551,7 @@ TkMenuCleanup( void TkMenuInit(void) { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!menusInitialized) { diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 7d3622a..2113f8c 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.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: tkMenubutton.c,v 1.19 2007/12/13 23:08:43 hobbs Exp $ + * RCS: @(#) $Id: tkMenubutton.c,v 1.20 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -153,7 +153,7 @@ static const Tk_OptionSpec optionSpecs[] = { * dispatch the scale widget command. */ -static CONST char *commandNames[] = { +static const char *commandNames[] = { "cget", "configure", NULL }; @@ -172,14 +172,14 @@ static void MenuButtonImageProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static char * MenuButtonTextVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static int MenuButtonWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int ConfigureMenuButton(Tcl_Interp *interp, TkMenuButton *mbPtr, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void DestroyMenuButton(char *memPtr); /* @@ -205,7 +205,7 @@ Tk_MenubuttonObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register TkMenuButton *mbPtr; Tk_OptionTable optionTable; @@ -236,7 +236,7 @@ Tk_MenubuttonObjCmd( Tk_SetClass(tkwin, "Menubutton"); mbPtr = TkpCreateMenuButton(tkwin); - Tk_SetClassProcs(tkwin, &tkpMenubuttonClass, (ClientData) mbPtr); + Tk_SetClassProcs(tkwin, &tkpMenubuttonClass, mbPtr); /* * Initialize the data structure for the button. @@ -246,8 +246,8 @@ Tk_MenubuttonObjCmd( mbPtr->display = Tk_Display (tkwin); mbPtr->interp = interp; mbPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd, - (ClientData) mbPtr, MenuButtonCmdDeletedProc); + Tk_PathName(mbPtr->tkwin), MenuButtonWidgetObjCmd, mbPtr, + MenuButtonCmdDeletedProc); mbPtr->optionTable = optionTable; mbPtr->menuName = NULL; mbPtr->text = NULL; @@ -296,7 +296,7 @@ Tk_MenubuttonObjCmd( Tk_CreateEventHandler(mbPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - MenuButtonEventProc, (ClientData) mbPtr); + MenuButtonEventProc, mbPtr); if (Tk_InitOptions(interp, (char *) mbPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(mbPtr->tkwin); @@ -335,9 +335,9 @@ MenuButtonWidgetObjCmd( ClientData clientData, /* Information about button widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; + register TkMenuButton *mbPtr = clientData; int result, index; Tcl_Obj *objPtr; @@ -350,7 +350,7 @@ MenuButtonWidgetObjCmd( if (result != TCL_OK) { return result; } - Tcl_Preserve((ClientData) mbPtr); + Tcl_Preserve(mbPtr); switch (index) { case COMMAND_CGET: @@ -383,11 +383,11 @@ MenuButtonWidgetObjCmd( } break; } - Tcl_Release((ClientData) mbPtr); + Tcl_Release(mbPtr); return result; error: - Tcl_Release((ClientData) mbPtr); + Tcl_Release(mbPtr); return TCL_ERROR; } @@ -418,7 +418,7 @@ DestroyMenuButton( TkpDestroyMenuButton(mbPtr); if (mbPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(TkpDisplayMenuButton, (ClientData) mbPtr); + Tcl_CancelIdleCall(TkpDisplayMenuButton, mbPtr); } /* @@ -430,7 +430,7 @@ DestroyMenuButton( if (mbPtr->textVarName != NULL) { Tcl_UntraceVar(mbPtr->interp, mbPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuButtonTextVarProc, (ClientData) mbPtr); + MenuButtonTextVarProc, mbPtr); } if (mbPtr->image != NULL) { Tk_FreeImage(mbPtr->image); @@ -455,7 +455,7 @@ DestroyMenuButton( } Tk_FreeConfigOptions((char *) mbPtr, mbPtr->optionTable, mbPtr->tkwin); mbPtr->tkwin = NULL; - Tcl_EventuallyFree((ClientData) mbPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(mbPtr, TCL_DYNAMIC); } /* @@ -486,7 +486,7 @@ ConfigureMenuButton( /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments. */ + Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; Tcl_Obj *errorResult = NULL; @@ -500,7 +500,7 @@ ConfigureMenuButton( if (mbPtr->textVarName != NULL) { Tcl_UntraceVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuButtonTextVarProc, (ClientData) mbPtr); + MenuButtonTextVarProc, mbPtr); } /* @@ -563,8 +563,7 @@ ConfigureMenuButton( if (mbPtr->imageString != NULL) { image = Tk_GetImage(mbPtr->interp, mbPtr->tkwin, - mbPtr->imageString, MenuButtonImageProc, - (ClientData) mbPtr); + mbPtr->imageString, MenuButtonImageProc, mbPtr); if (image == NULL) { return TCL_ERROR; } @@ -616,7 +615,7 @@ ConfigureMenuButton( * Set up a trace to watch for any changes in it, create the variable * if it doesn't exist, and fetch its current value. */ - CONST char *value; + const char *value; value = Tcl_GetVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY); if (value == NULL) { @@ -631,10 +630,10 @@ ConfigureMenuButton( } Tcl_TraceVar(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MenuButtonTextVarProc, (ClientData) mbPtr); + MenuButtonTextVarProc, mbPtr); } - TkMenuButtonWorldChanged((ClientData) mbPtr); + TkMenuButtonWorldChanged(mbPtr); if (error) { Tcl_SetObjResult(interp, errorResult); Tcl_DecrRefCount(errorResult); @@ -668,9 +667,7 @@ TkMenuButtonWorldChanged( XGCValues gcValues; GC gc; unsigned long mask; - TkMenuButton *mbPtr; - - mbPtr = (TkMenuButton *) instanceData; + TkMenuButton *mbPtr = instanceData; gcValues.font = Tk_FontId(mbPtr->tkfont); gcValues.foreground = mbPtr->normalFg->pixel; @@ -743,7 +740,7 @@ TkMenuButtonWorldChanged( */ if (Tk_IsMapped(mbPtr->tkwin) && !(mbPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr); mbPtr->flags |= REDRAW_PENDING; } } @@ -771,7 +768,7 @@ MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenuButton *mbPtr = (TkMenuButton *) clientData; + TkMenuButton *mbPtr = clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { @@ -802,7 +799,7 @@ MenuButtonEventProc( redraw: if ((mbPtr->tkwin != NULL) && !(mbPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr); mbPtr->flags |= REDRAW_PENDING; } } @@ -829,7 +826,7 @@ static void MenuButtonCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenuButton *mbPtr = (TkMenuButton *) clientData; + TkMenuButton *mbPtr = clientData; Tk_Window tkwin = mbPtr->tkwin; /* @@ -867,12 +864,12 @@ static char * MenuButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* Name of variable. */ - CONST char *name2, /* Second part of variable name. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; - CONST char *value; + register TkMenuButton *mbPtr = clientData; + const char *value; unsigned len; /* @@ -905,7 +902,7 @@ MenuButtonTextVarProc( if ((mbPtr->tkwin != NULL) && Tk_IsMapped(mbPtr->tkwin) && !(mbPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr); mbPtr->flags |= REDRAW_PENDING; } return NULL; @@ -938,12 +935,12 @@ MenuButtonImageProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; + register TkMenuButton *mbPtr = clientData; if (mbPtr->tkwin != NULL) { TkpComputeMenuButtonGeometry(mbPtr); if (Tk_IsMapped(mbPtr->tkwin) && !(mbPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(TkpDisplayMenuButton, (ClientData) mbPtr); + Tcl_DoWhenIdle(TkpDisplayMenuButton, mbPtr); mbPtr->flags |= REDRAW_PENDING; } } diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 048bb5c..ff33d48 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.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: tkMessage.c,v 1.19 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkMessage.c,v 1.20 2008/04/27 22:38:56 dkf Exp $ */ #include "default.h" @@ -173,15 +173,15 @@ static void MessageCmdDeletedProc(ClientData clientData); static void MessageEventProc(ClientData clientData, XEvent *eventPtr); static char * MessageTextVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static int MessageWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void MessageWorldChanged(ClientData instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, - int objc, Tcl_Obj *CONST objv[], int flags); + int objc, Tcl_Obj *const objv[], int flags); static void DestroyMessage(char *memPtr); static void DisplayMessage(ClientData clientData); @@ -217,7 +217,7 @@ Tk_MessageObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { register Message *msgPtr; Tk_OptionTable optionTable; @@ -252,8 +252,8 @@ Tk_MessageObjCmd( msgPtr->display = Tk_Display(tkwin); msgPtr->interp = interp; msgPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd, - (ClientData) msgPtr, MessageCmdDeletedProc); + Tk_PathName(msgPtr->tkwin), MessageWidgetObjCmd, msgPtr, + MessageCmdDeletedProc); msgPtr->optionTable = optionTable; msgPtr->relief = TK_RELIEF_FLAT; msgPtr->textGC = None; @@ -263,10 +263,10 @@ Tk_MessageObjCmd( msgPtr->cursor = None; Tk_SetClass(msgPtr->tkwin, "Message"); - Tk_SetClassProcs(msgPtr->tkwin, &messageClass, (ClientData) msgPtr); + Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - MessageEventProc, (ClientData) msgPtr); + MessageEventProc, msgPtr); if (Tk_InitOptions(interp, (char *)msgPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(msgPtr->tkwin); return TCL_ERROR; @@ -304,10 +304,10 @@ MessageWidgetObjCmd( ClientData clientData, /* Information about message widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr = (Message *) clientData; - static CONST char *optionStrings[] = { "cget", "configure", NULL }; + register Message *msgPtr = clientData; + static const char *optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; int index; int result = TCL_OK; @@ -323,7 +323,7 @@ MessageWidgetObjCmd( return TCL_ERROR; } - Tcl_Preserve((ClientData) msgPtr); + Tcl_Preserve(msgPtr); switch ((enum options) index) { case MESSAGE_CGET: @@ -358,7 +358,7 @@ MessageWidgetObjCmd( break; } - Tcl_Release((ClientData) msgPtr); + Tcl_Release(msgPtr); return result; } @@ -390,7 +390,7 @@ DestroyMessage( Tcl_DeleteCommandFromToken(msgPtr->interp, msgPtr->widgetCmd); if (msgPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayMessage, (ClientData) msgPtr); + Tcl_CancelIdleCall(DisplayMessage, msgPtr); } /* @@ -407,7 +407,7 @@ DestroyMessage( if (msgPtr->textVarName != NULL) { Tcl_UntraceVar(msgPtr->interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } Tk_FreeConfigOptions((char *) msgPtr, msgPtr->optionTable, msgPtr->tkwin); msgPtr->tkwin = NULL; @@ -440,7 +440,7 @@ ConfigureMessage( register Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ - Tcl_Obj *CONST objv[], /* Arguments. */ + Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; @@ -452,7 +452,7 @@ ConfigureMessage( if (msgPtr->textVarName != NULL) { Tcl_UntraceVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } if (Tk_SetOptions(interp, (char *) msgPtr, msgPtr->optionTable, objc, objv, @@ -468,7 +468,7 @@ ConfigureMessage( */ if (msgPtr->textVarName != NULL) { - CONST char *value; + const char *value; value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY); if (value == NULL) { @@ -482,7 +482,7 @@ ConfigureMessage( } Tcl_TraceVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - MessageTextVarProc, (ClientData) msgPtr); + MessageTextVarProc, msgPtr); } /* @@ -498,7 +498,7 @@ ConfigureMessage( } Tk_FreeSavedOptions(&savedOptions); - MessageWorldChanged((ClientData) msgPtr); + MessageWorldChanged(msgPtr); return TCL_OK; } @@ -559,7 +559,7 @@ MessageWorldChanged( ComputeMessageGeometry(msgPtr); if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } } @@ -668,7 +668,7 @@ static void DisplayMessage( ClientData clientData) /* Information about window. */ { - register Message *msgPtr = (Message *) clientData; + register Message *msgPtr = clientData; register Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; @@ -744,13 +744,13 @@ MessageEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Message *msgPtr = (Message *) clientData; + Message *msgPtr = clientData; if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) || (eventPtr->type == ConfigureNotify)) { goto redraw; } else if (eventPtr->type == DestroyNotify) { - DestroyMessage((char *) clientData); + DestroyMessage(clientData); } else if (eventPtr->type == FocusIn) { if (eventPtr->xfocus.detail != NotifyInferior) { msgPtr->flags |= GOT_FOCUS; @@ -770,7 +770,7 @@ MessageEventProc( redraw: if ((msgPtr->tkwin != NULL) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } } @@ -797,7 +797,7 @@ static void MessageCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Message *msgPtr = (Message *) clientData; + Message *msgPtr = clientData; /* * This function could be invoked either because the window was destroyed @@ -833,12 +833,12 @@ static char * MessageTextVarProc( ClientData clientData, /* Information about message. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* Name of variable. */ - CONST char *name2, /* Second part of variable name. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register Message *msgPtr = (Message *) clientData; - CONST char *value; + register Message *msgPtr = clientData; + const char *value; /* * If the variable is unset, then immediately recreate it unless the whole @@ -870,7 +870,7 @@ MessageTextVarProc( if ((msgPtr->tkwin != NULL) && Tk_IsMapped(msgPtr->tkwin) && !(msgPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayMessage, (ClientData) msgPtr); + Tcl_DoWhenIdle(DisplayMessage, msgPtr); msgPtr->flags |= REDRAW_PENDING; } return NULL; diff --git a/generic/tkObj.c b/generic/tkObj.c index 15f01ac..ce1c649 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.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: tkObj.c,v 1.19 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkObj.c,v 1.20 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -36,7 +36,7 @@ typedef struct PixelRep { #define SET_COMPLEXPIXEL(objPtr, repPtr) \ (objPtr)->internalRep.twoPtrValue.ptr1 = 0; \ - (objPtr)->internalRep.twoPtrValue.ptr2 = (VOID *) repPtr + (objPtr)->internalRep.twoPtrValue.ptr2 = (void *) repPtr #define GET_COMPLEXPIXEL(objPtr) \ ((PixelRep *) (objPtr)->internalRep.twoPtrValue.ptr2) @@ -476,7 +476,7 @@ DupMMInternalRep( newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; newPtr->returnValue = oldPtr->returnValue; - copyPtr->internalRep.otherValuePtr = (VOID *) newPtr; + copyPtr->internalRep.otherValuePtr = (void *) newPtr; } /* @@ -639,7 +639,7 @@ SetMMFromAny( mmPtr->tkwin = NULL; mmPtr->returnValue = d; - objPtr->internalRep.otherValuePtr = (VOID *) mmPtr; + objPtr->internalRep.otherValuePtr = (void *) mmPtr; return TCL_OK; } @@ -747,7 +747,7 @@ SetWindowFromAny( winPtr->mainPtr = NULL; winPtr->epoch = 0; - objPtr->internalRep.otherValuePtr = (VOID*)winPtr; + objPtr->internalRep.otherValuePtr = (void *) winPtr; objPtr->typePtr = &windowObjType; return TCL_OK; @@ -783,7 +783,7 @@ DupWindowInternalRep( newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; - copyPtr->internalRep.otherValuePtr = (VOID *)newPtr; + copyPtr->internalRep.otherValuePtr = (void *) newPtr; copyPtr->typePtr = srcPtr->typePtr; } diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 8a46c58..37d278d 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.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: tkOldConfig.c,v 1.23 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkOldConfig.c,v 1.24 2008/04/27 22:38:56 dkf Exp $ */ #include "tkPort.h" @@ -35,11 +35,11 @@ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, Tk_Uid value, int valueIsUid, char *widgRec); static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, - Tk_ConfigSpec *specs, CONST char *argvName, + Tk_ConfigSpec *specs, const char *argvName, int needFlags, int hateFlags); static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, char *widgRec); -static CONST char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, +static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, char *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, @@ -76,7 +76,7 @@ Tk_ConfigureWidget( * X resources). */ Tk_ConfigSpec *specs, /* Describes legal options. */ int argc, /* Number of elements in argv. */ - CONST char **argv, /* Command-line options. */ + const char **argv, /* Command-line options. */ char *widgRec, /* Record whose fields are to be modified. * Values must be properly initialized. */ int flags) /* Used to specify additional flags that must @@ -120,7 +120,7 @@ Tk_ConfigureWidget( */ for ( ; argc > 0; argc -= 2, argv += 2) { - CONST char *arg; + const char *arg; if (flags & TK_CONFIG_OBJS) { arg = Tcl_GetStringFromObj((Tcl_Obj *) *argv, NULL); @@ -242,7 +242,7 @@ FindConfigSpec( Tcl_Interp *interp, /* Used for reporting errors. */ Tk_ConfigSpec *specs, /* Pointer to table of configuration * specifications for a widget. */ - CONST char *argvName, /* Name (suitable for use in a "config" + const char *argvName, /* Name (suitable for use in a "config" * command) identifying particular option. */ int needFlags, /* Flags that must be present in matching * entry. */ @@ -597,7 +597,7 @@ Tk_ConfigureInfo( Tk_ConfigSpec *specs, /* Describes legal options. */ char *widgRec, /* Record whose fields contain current values * for options. */ - CONST char *argvName, /* If non-NULL, indicates a single option + const char *argvName, /* If non-NULL, indicates a single option * whose info is to be returned. Otherwise * info is returned for all options. */ int flags) /* Used to specify additional flags that must @@ -692,7 +692,7 @@ FormatConfigInfo( char *widgRec) /* Pointer to record holding current values of * info for widget. */ { - CONST char *argv[6]; + const char *argv[6]; char *result; char buffer[200]; Tcl_FreeProc *freeProc = NULL; @@ -721,9 +721,9 @@ FormatConfigInfo( result = Tcl_Merge(5, argv); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { - ckfree((char *)argv[4]); + ckfree((char *) argv[4]); } else { - (*freeProc)((char *)argv[4]); + (*freeProc)((char *) argv[4]); } } return result; @@ -749,7 +749,7 @@ FormatConfigInfo( *---------------------------------------------------------------------- */ -static CONST char * +static const char * FormatConfigValue( Tcl_Interp *interp, /* Interpreter for use in real conversions. */ Tk_Window tkwin, /* Window corresponding to widget. */ @@ -763,7 +763,7 @@ FormatConfigValue( * function to free the result, or NULL if * result is static. */ { - CONST char *ptr, *result; + const char *ptr, *result; *freeProcPtr = NULL; ptr = widgRec + specPtr->offset; @@ -909,7 +909,7 @@ Tk_ConfigureValue( Tk_ConfigSpec *specs, /* Describes legal options. */ char *widgRec, /* Record whose fields contain current values * for options. */ - CONST char *argvName, /* Gives the command-line name for the option + const char *argvName, /* Gives the command-line name for the option * whose value is to be returned. */ int flags) /* Used to specify additional flags that must * be present in config specs for them to be @@ -918,7 +918,7 @@ Tk_ConfigureValue( Tk_ConfigSpec *specPtr; int needFlags, hateFlags; Tcl_FreeProc *freeProc; - CONST char *result; + const char *result; char buffer[200]; needFlags = flags & ~(TK_CONFIG_USER_BIT - 1); @@ -943,9 +943,9 @@ Tk_ConfigureValue( Tcl_SetResult(interp, (char *) result, TCL_VOLATILE); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { - ckfree((char *)result); + ckfree((char *) result); } else { - (*freeProc)((char *)result); + (*freeProc)((char *) result); } } return TCL_OK; @@ -1072,13 +1072,13 @@ GetCachedSpecs( * self-initializing code. */ - specCacheTablePtr = (Tcl_HashTable *) + specCacheTablePtr = Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL); if (specCacheTablePtr == NULL) { specCacheTablePtr = (Tcl_HashTable *) ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "tkConfigSpec.threadTable", - DeleteSpecCacheTable, (ClientData) specCacheTablePtr); + DeleteSpecCacheTable, specCacheTablePtr); } /* @@ -1110,7 +1110,7 @@ GetCachedSpecs( cachedSpecs = (Tk_ConfigSpec *) ckalloc(entrySpace); memcpy(cachedSpecs, staticSpecs, entrySpace); - Tcl_SetHashValue(entryPtr, (ClientData) cachedSpecs); + Tcl_SetHashValue(entryPtr, cachedSpecs); /* * Finally, go through and replace database names, database classes @@ -1133,7 +1133,7 @@ GetCachedSpecs( specPtr->specFlags &= ~TK_CONFIG_OPTION_SPECIFIED; } } else { - cachedSpecs = (Tk_ConfigSpec *) Tcl_GetHashValue(entryPtr); + cachedSpecs = Tcl_GetHashValue(entryPtr); } return cachedSpecs; @@ -1161,7 +1161,7 @@ DeleteSpecCacheTable( ClientData clientData, Tcl_Interp *interp) { - Tcl_HashTable *tablePtr = (Tcl_HashTable *) clientData; + Tcl_HashTable *tablePtr = clientData; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; @@ -1171,7 +1171,7 @@ DeleteSpecCacheTable( * Someone else deallocates the Tk_Uids themselves. */ - ckfree((char *) Tcl_GetHashValue(entryPtr)); + ckfree(Tcl_GetHashValue(entryPtr)); } Tcl_DeleteHashTable(tablePtr); ckfree((char *) tablePtr); diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 473d92c..cd7ae5b 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkOldTest.c,v 1.1 2007/05/14 20:58:27 dgp Exp $ + * RCS: @(#) $Id: tkOldTest.c,v 1.2 2008/04/27 22:38:56 dkf Exp $ */ #define USE_OLD_IMAGE @@ -77,7 +77,7 @@ static Tk_ImageType imageType = { */ static int ImageCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); MODULE_SCOPE int TkOldTestInit(Tcl_Interp *interp); @@ -171,8 +171,8 @@ ImageCreate( strcpy(timPtr->imageName, name); timPtr->varName = (char *) ckalloc((unsigned) (strlen(varName) + 1)); strcpy(timPtr->varName, varName); - Tcl_CreateCommand(interp, name, ImageCmd, (ClientData) timPtr, NULL); - *clientDataPtr = (ClientData) timPtr; + Tcl_CreateCommand(interp, name, ImageCmd, timPtr, NULL); + *clientDataPtr = timPtr; Tk_ImageChanged(master, 0, 0, 30, 15, 30, 15); return TCL_OK; } @@ -200,9 +200,9 @@ ImageCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; int x, y, width, height; if (argc < 2) { @@ -258,7 +258,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -272,7 +272,7 @@ ImageGet( instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; instPtr->gc = Tk_GetGC(tkwin, GCForeground, &gcValues); - return (ClientData) instPtr; + return instPtr; } /* @@ -305,7 +305,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", @@ -350,7 +350,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = (TImageInstance *) clientData; + TImageInstance *instPtr = clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -384,7 +384,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = (TImageMaster *) clientData; + TImageMaster *timPtr = clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkOption.c b/generic/tkOption.c index 1fac8b4..06b67f9 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.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: tkOption.c,v 1.24 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkOption.c,v 1.25 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -248,8 +248,8 @@ void Tk_AddOption( Tk_Window tkwin, /* Window token; option will be associated * with main window for this window. */ - CONST char *name, /* Multi-element name of option. */ - CONST char *value, /* String value for option. */ + const char *name, /* Multi-element name of option. */ + const char *value, /* String value for option. */ int priority) /* Overall priority level to use for this * option, such as TK_USER_DEFAULT_PRIO or * TK_INTERACTIVE_PRIO. Must be between 0 and @@ -259,13 +259,13 @@ Tk_AddOption( register ElArray **arrayPtrPtr; register Element *elPtr; Element newEl; - register CONST char *p; - CONST char *field; + register const char *p; + const char *field; int count, firstField; ptrdiff_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->mainPtr->optionRootPtr == NULL) { @@ -402,8 +402,8 @@ Tk_Uid Tk_GetOption( Tk_Window tkwin, /* Token for window that option is associated * with. */ - CONST char *name, /* Name of option. */ - CONST char *className) /* Class of option. NULL means there is no + const char *name, /* Name of option. */ + const char *className) /* Class of option. NULL means there is no * class for this option: just check for * name. */ { @@ -413,7 +413,7 @@ Tk_GetOption( register int count; StackLevel *levelPtr; int stackDepth[NUM_STACKS]; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -477,16 +477,16 @@ Tk_GetOption( */ for (elPtr = tsdPtr->stacks[EXACT_LEAF_NAME]->els, - count = stackDepth[EXACT_LEAF_NAME]; count > 0; - elPtr++, count--) { + count = stackDepth[EXACT_LEAF_NAME]; count > 0; + elPtr++, count--) { if ((elPtr->nameUid == nameId) && (elPtr->priority > bestPtr->priority)) { bestPtr = elPtr; } } for (elPtr = tsdPtr->stacks[WILDCARD_LEAF_NAME]->els, - count = stackDepth[WILDCARD_LEAF_NAME]; count > 0; - elPtr++, count--) { + count = stackDepth[WILDCARD_LEAF_NAME]; count > 0; + elPtr++, count--) { if ((elPtr->nameUid == nameId) && (elPtr->priority > bestPtr->priority)) { bestPtr = elPtr; @@ -496,16 +496,16 @@ Tk_GetOption( if (className != NULL) { classId = Tk_GetUid(className); for (elPtr = tsdPtr->stacks[EXACT_LEAF_CLASS]->els, - count = stackDepth[EXACT_LEAF_CLASS]; count > 0; - elPtr++, count--) { + count = stackDepth[EXACT_LEAF_CLASS]; count > 0; + elPtr++, count--) { if ((elPtr->nameUid == classId) && (elPtr->priority > bestPtr->priority)) { bestPtr = elPtr; } } for (elPtr = tsdPtr->stacks[WILDCARD_LEAF_CLASS]->els, - count = stackDepth[WILDCARD_LEAF_CLASS]; count > 0; - elPtr++, count--) { + count = stackDepth[WILDCARD_LEAF_CLASS]; count > 0; + elPtr++, count--) { if ((elPtr->nameUid == classId) && (elPtr->priority > bestPtr->priority)) { bestPtr = elPtr; @@ -535,7 +535,7 @@ Tk_GetOption( * Extract the masquerade class name from the name field. */ - classNameLength = (unsigned int)(masqName - name); + classNameLength = (unsigned) (masqName - name); masqClass = (char *) ckalloc(classNameLength + 1); strncpy(masqClass, name, classNameLength); masqClass[classNameLength] = '\0'; @@ -614,14 +614,14 @@ Tk_OptionObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of Tcl_Obj arguments. */ - Tcl_Obj *CONST objv[]) /* Tcl_Obj arguments. */ + Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; int index, result; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - static CONST char *optionCmds[] = { + static const char *optionCmds[] = { "add", "clear", "get", "readfile", NULL }; @@ -644,6 +644,7 @@ Tk_OptionObjCmd( switch ((enum optionVals) index) { case OPTION_ADD: { int priority; + if ((objc != 4) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "pattern value ?priority?"); return TCL_ERROR; @@ -693,7 +694,7 @@ Tk_OptionObjCmd( value = Tk_GetOption(window, Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); if (value != NULL) { - Tcl_SetResult(interp, (char *)value, TCL_STATIC); + Tcl_SetResult(interp, (char *) value, TCL_STATIC); } break; } @@ -743,7 +744,7 @@ void TkOptionDeadWindow( register TkWindow *winPtr) /* Window to be cleaned up. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -799,7 +800,7 @@ TkOptionClassChanged( { int i, j, *basePtr; ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->optionLevel == -1) { @@ -930,7 +931,6 @@ AddFromString( src = string; lineNum = 1; while (1) { - /* * Skip leading white space and empty lines and comment lines, and * check for the end of the spec. @@ -1073,7 +1073,7 @@ ReadOptionFile( * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { - CONST char *realName; + const char *realName; char *buffer; int result, bufferSize; Tcl_Channel chan; @@ -1108,7 +1108,7 @@ ReadOptionFile( */ bufferSize = (int) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_END); - (void) Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_SET); + Tcl_Seek(chan, (Tcl_WideInt) 0, SEEK_SET); if (bufferSize < 0) { Tcl_AppendResult(interp, "error seeking to end of file \"", @@ -1117,7 +1117,7 @@ ReadOptionFile( return TCL_ERROR; } - buffer = (char *) ckalloc((unsigned) bufferSize+1); + buffer = ckalloc((unsigned) bufferSize+1); bufferSize = Tcl_Read(chan, buffer, bufferSize); if (bufferSize < 0) { Tcl_AppendResult(interp, "error reading file \"", fileName, "\":", @@ -1153,9 +1153,8 @@ static ElArray * NewArray( int numEls) /* How many elements of space to allocate. */ { - register ElArray *arrayPtr; + register ElArray *arrayPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(numEls)); - arrayPtr = (ElArray *) ckalloc(EL_ARRAY_SIZE(numEls)); arrayPtr->arraySize = numEls; arrayPtr->numUsed = 0; arrayPtr->nextToUse = arrayPtr->els; @@ -1236,7 +1235,7 @@ SetupStacks( int level, i, *iPtr; register StackLevel *levelPtr; register ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1313,10 +1312,8 @@ SetupStacks( */ if (tsdPtr->curLevel >= tsdPtr->numLevels) { - StackLevel *newLevels; - - newLevels = (StackLevel *) ckalloc((unsigned) - (tsdPtr->numLevels * 2 * sizeof(StackLevel))); + StackLevel *newLevels = (StackLevel *) + ckalloc((unsigned) (tsdPtr->numLevels*2*sizeof(StackLevel))); memcpy(newLevels, tsdPtr->levels, tsdPtr->numLevels * sizeof(StackLevel)); ckfree((char *) tsdPtr->levels); @@ -1398,7 +1395,7 @@ ExtendStacks( { register int count; register Element *elPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (elPtr = arrayPtr->els, count = arrayPtr->numUsed; @@ -1431,7 +1428,7 @@ static void OptionThreadExitProc( ClientData clientData) /* not used */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->initialized) { @@ -1469,7 +1466,7 @@ OptionInit( { int i; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Element *defaultMatchPtr = &tsdPtr->defaultMatch; @@ -1505,7 +1502,7 @@ OptionInit( mainPtr->optionRootPtr = NewArray(20); interp = Tcl_CreateInterp(); - (void) GetDefaultOptions(interp, mainPtr->winPtr); + GetDefaultOptions(interp, mainPtr->winPtr); Tcl_DeleteInterp(interp); } diff --git a/generic/tkPack.c b/generic/tkPack.c index 0733d86..a266fba 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -10,20 +10,20 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkPack.c,v 1.27 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.28 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" typedef enum {TOP, BOTTOM, LEFT, RIGHT} Side; -static CONST char *sideNames[] = { +static const char *sideNames[] = { "top", "bottom", "left", "right", NULL }; -/* For each window that the packer cares about (either because - * the window is managed by the packer or because the window - * has slaves that are managed by the packer), there is a - * structure of the following type: +/* + * For each window that the packer cares about (either because the window is + * managed by the packer or because the window has slaves that are managed by + * the packer), there is a structure of the following type: */ typedef struct Packer { @@ -34,9 +34,9 @@ typedef struct Packer { struct Packer *masterPtr; /* Master window within which this window is * packed (NULL means this window isn't * managed by the packer). */ - struct Packer *nextPtr; /* Next window packed within same master. - * List is priority-ordered: first on list - * gets packed first. */ + struct Packer *nextPtr; /* Next window packed within same master. List + * is priority-ordered: first on list gets + * packed first. */ struct Packer *slavePtr; /* First in list of slaves packed inside this * window (NULL means no packed slaves). */ Side side; /* Side of master against which this window is @@ -118,11 +118,11 @@ static const Tk_GeomMgr packerType = { static void ArrangePacking(ClientData clientData); static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DestroyPacker(char *memPtr); static Packer * GetPacker(Tk_Window tkwin); static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, - Packer *masterPtr, int objc,Tcl_Obj *CONST objv[]); + Packer *masterPtr, int objc,Tcl_Obj *const objv[]); static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); @@ -130,7 +130,7 @@ static int XExpansion(Packer *slavePtr, int cavityWidth); static int YExpansion(Packer *slavePtr, int cavityHeight); /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * TkPrintPadAmount -- * @@ -144,7 +144,7 @@ static int YExpansion(Packer *slavePtr, int cavityHeight); * Side effects: * None. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ void @@ -166,7 +166,7 @@ TkPrintPadAmount( } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * Tk_PackCmd -- * @@ -179,7 +179,7 @@ TkPrintPadAmount( * Side effects: * See the user documentation. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ int @@ -187,11 +187,11 @@ Tk_PackObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; char *argv2; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { /* after, append, before and unpack are deprecated */ "after", "append", "before", "unpack", "configure", "forget", "info", "propagate", "slaves", NULL }; @@ -202,6 +202,7 @@ Tk_PackObjCmd( if (objc >= 2) { char *string = Tcl_GetString(objv[1]); + if (string[0] == '.') { return ConfigureSlaves(interp, tkwin, objc-1, objv+1); } @@ -307,8 +308,7 @@ Tk_PackObjCmd( } slavePtr = GetPacker(slave); if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { - Tk_ManageGeometry(slave, NULL, - (ClientData) NULL); + Tk_ManageGeometry(slave, NULL, NULL); if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -397,7 +397,7 @@ Tk_PackObjCmd( } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangePacking, masterPtr); } } else { masterPtr->flags |= DONT_PROPAGATE; @@ -435,8 +435,7 @@ Tk_PackObjCmd( } packPtr = GetPacker(tkwin2); if ((packPtr != NULL) && (packPtr->masterPtr != NULL)) { - Tk_ManageGeometry(tkwin2, NULL, - (ClientData) NULL); + Tk_ManageGeometry(tkwin2, NULL, NULL); if (packPtr->masterPtr->tkwin != Tk_Parent(packPtr->tkwin)) { Tk_UnmaintainGeometry(packPtr->tkwin, packPtr->masterPtr->tkwin); @@ -452,7 +451,7 @@ Tk_PackObjCmd( } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * PackReqProc -- * @@ -466,7 +465,7 @@ Tk_PackObjCmd( * Arranges for tkwin, and all its managed siblings, to be re-packed at * the next idle point. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ /* ARGSUSED */ @@ -477,17 +476,17 @@ PackReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = (Packer *) clientData; + register Packer *packPtr = clientData; packPtr = packPtr->masterPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr); + Tcl_DoWhenIdle(ArrangePacking, packPtr); } } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * PackLostSlaveProc -- * @@ -500,7 +499,7 @@ PackReqProc( * Side effects: * Forgets all packer-related information about the slave. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ /* ARGSUSED */ @@ -510,7 +509,7 @@ PackLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Packer *slavePtr = (Packer *) clientData; + register Packer *slavePtr = clientData; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -520,7 +519,7 @@ PackLostSlaveProc( } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * ArrangePacking -- * @@ -535,7 +534,7 @@ PackLostSlaveProc( * Side effects: * The packed slaves of masterPtr may get resized or moved. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ static void @@ -543,7 +542,7 @@ ArrangePacking( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Packer *masterPtr = (Packer *) clientData; + register Packer *masterPtr = clientData; register Packer *slavePtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the @@ -583,7 +582,7 @@ ArrangePacking( } masterPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve((ClientData) masterPtr); + Tcl_Preserve(masterPtr); /* * Pass #1: scan all the slaves to figure out the total amount of space @@ -652,7 +651,7 @@ ArrangePacking( && !(masterPtr->flags & DONT_PROPAGATE)) { Tk_GeometryRequest(masterPtr->tkwin, maxWidth, maxHeight); masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangePacking, masterPtr); goto done; } @@ -843,7 +842,7 @@ ArrangePacking( done: masterPtr->abortPtr = NULL; - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); } /* @@ -964,7 +963,7 @@ YExpansion( } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * GetPacker -- * @@ -979,7 +978,7 @@ YExpansion( * A new packer structure may be created. If so, then a callback is set * up to clean things up when the window is deleted. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ static Packer * @@ -1005,7 +1004,7 @@ GetPacker( hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin, &isNew); if (!isNew) { - return (Packer *) Tcl_GetHashValue(hPtr); + return Tcl_GetHashValue(hPtr); } packPtr = (Packer *) ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; @@ -1022,12 +1021,12 @@ GetPacker( packPtr->flags = 0; Tcl_SetHashValue(hPtr, packPtr); Tk_CreateEventHandler(tkwin, StructureNotifyMask, - PackStructureProc, (ClientData) packPtr); + PackStructureProc, packPtr); return packPtr; } /* - *-------------------------------------------------------------- + *------------------------------------------------------------------------ * * PackAfter -- * @@ -1041,7 +1040,7 @@ GetPacker( * The geometry of the specified windows may change, both now and again * in the future. * - *-------------------------------------------------------------- + *------------------------------------------------------------------------ */ static int @@ -1052,7 +1051,7 @@ PackAfter( * masterPtr. */ Packer *masterPtr, /* Master in which to pack windows. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[]) /* Array of lists, each containing 2 elements: + Tcl_Obj *const objv[]) /* Array of lists, each containing 2 elements: * window name and side against which to * pack. */ { @@ -1227,7 +1226,7 @@ PackAfter( packPtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = packPtr; } - Tk_ManageGeometry(tkwin, &packerType, (ClientData) packPtr); + Tk_ManageGeometry(tkwin, &packerType, packPtr); } } @@ -1240,7 +1239,7 @@ PackAfter( } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangePacking, masterPtr); } return TCL_OK; } @@ -1286,7 +1285,7 @@ Unlink( } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangePacking, masterPtr); } if (masterPtr->abortPtr != NULL) { *masterPtr->abortPtr = 1; @@ -1346,20 +1345,20 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = (Packer *) clientData; + register Packer *packPtr = clientData; if (eventPtr->type == ConfigureNotify) { if ((packPtr->slavePtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr); + Tcl_DoWhenIdle(ArrangePacking, packPtr); } if ((packPtr->masterPtr != NULL) && (packPtr->doubleBw != 2*Tk_Changes(packPtr->tkwin)->border_width)) { if (!(packPtr->masterPtr->flags & REQUESTED_REPACK)) { packPtr->doubleBw = 2*Tk_Changes(packPtr->tkwin)->border_width; packPtr->masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr->masterPtr); + Tcl_DoWhenIdle(ArrangePacking, packPtr->masterPtr); } } } else if (eventPtr->type == DestroyNotify) { @@ -1371,8 +1370,7 @@ PackStructureProc( for (slavePtr = packPtr->slavePtr; slavePtr != NULL; slavePtr = nextPtr) { - Tk_ManageGeometry(slavePtr->tkwin, NULL, - (ClientData) NULL); + Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); Tk_UnmapWindow(slavePtr->tkwin); slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; @@ -1386,10 +1384,10 @@ PackStructureProc( } if (packPtr->flags & REQUESTED_REPACK) { - Tcl_CancelIdleCall(ArrangePacking, (ClientData) packPtr); + Tcl_CancelIdleCall(ArrangePacking, packPtr); } packPtr->tkwin = NULL; - Tcl_EventuallyFree((ClientData) packPtr, DestroyPacker); + Tcl_EventuallyFree(packPtr, DestroyPacker); } else if (eventPtr->type == MapNotify) { /* * When a master gets mapped, must redo the geometry computation so @@ -1399,7 +1397,7 @@ PackStructureProc( if ((packPtr->slavePtr != NULL) && !(packPtr->flags & REQUESTED_REPACK)) { packPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) packPtr); + Tcl_DoWhenIdle(ArrangePacking, packPtr); } } else if (eventPtr->type == UnmapNotify) { register Packer *packPtr2; @@ -1441,7 +1439,7 @@ ConfigureSlaves( Tk_Window tkwin, /* Any window in application containing * slaves. Used to look up slave names. */ int objc, /* Number of elements in argv. */ - Tcl_Obj *CONST objv[]) /* Argument objects: contains one or more + Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ @@ -1450,7 +1448,7 @@ ConfigureSlaves( Tk_Window other, slave, parent, ancestor; int i, j, numWindows, tmp, positionGiven; char *string; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "-after", "-anchor", "-before", "-expand", "-fill", "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL }; enum options { @@ -1532,8 +1530,8 @@ ConfigureSlaves( if (prevPtr->masterPtr == NULL) { notPacked: Tcl_AppendResult(interp, "window \"", - Tcl_GetString(objv[i+1]), - "\" isn't packed", NULL); + Tcl_GetString(objv[i+1]), "\" isn't packed", + NULL); return TCL_ERROR; } masterPtr = prevPtr->masterPtr; @@ -1738,7 +1736,7 @@ ConfigureSlaves( slavePtr->nextPtr = prevPtr->nextPtr; prevPtr->nextPtr = slavePtr; } - Tk_ManageGeometry(slave, &packerType, (ClientData) slavePtr); + Tk_ManageGeometry(slave, &packerType, slavePtr); prevPtr = slavePtr; /* @@ -1751,7 +1749,7 @@ ConfigureSlaves( } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; - Tcl_DoWhenIdle(ArrangePacking, (ClientData) masterPtr); + Tcl_DoWhenIdle(ArrangePacking, masterPtr); } } return TCL_OK; diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 7854498..f80e257 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.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: tkPanedWindow.c,v 1.30 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.31 2008/04/27 22:38:56 dkf Exp $ */ #include "default.h" @@ -183,11 +183,11 @@ typedef struct PanedWindow { int Tk_PanedWindowObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void PanedWindowCmdDeletedProc(ClientData clientData); static int ConfigurePanedWindow(Tcl_Interp *interp, PanedWindow *pwPtr, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void DestroyPanedWindow(PanedWindow *pwPtr); static void DisplayPanedWindow(ClientData clientData); static void PanedWindowEventProc(ClientData clientData, @@ -197,7 +197,7 @@ static void ProxyWindowEventProc(ClientData clientData, static void DisplayProxyWindow(ClientData clientData); static void PanedWindowWorldChanged(ClientData instanceData); static int PanedWindowWidgetObjCmd(ClientData clientData, - Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]); + Tcl_Interp *, int objc, Tcl_Obj * const objv[]); static void PanedWindowLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void PanedWindowReqProc(ClientData clientData, @@ -209,14 +209,14 @@ static void SlaveStructureProc(ClientData clientData, XEvent *eventPtr); static int PanedWindowSashCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int PanedWindowProxyCommand(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static void ComputeGeometry(PanedWindow *pwPtr); static int ConfigureSlaves(PanedWindow *pwPtr, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static void DestroyOptionTables(ClientData clientData, Tcl_Interp *interp); static int SetSticky(ClientData clientData, Tcl_Interp *interp, @@ -373,7 +373,7 @@ Tk_PanedWindowObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj * CONST objv[]) /* Argument objects. */ + Tcl_Obj * const objv[]) /* Argument objects. */ { PanedWindow *pwPtr; Tk_Window tkwin, parent; @@ -408,7 +408,7 @@ Tk_PanedWindowObjCmd( */ Tcl_SetAssocData(interp, "PanedWindowOptionTables", - DestroyOptionTables, (ClientData) pwOpts); + DestroyOptionTables, pwOpts); /* * Create the paned window option tables. @@ -430,8 +430,8 @@ Tk_PanedWindowObjCmd( pwPtr->display = Tk_Display(tkwin); pwPtr->interp = interp; pwPtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, - (ClientData) pwPtr, PanedWindowCmdDeletedProc); + Tk_PathName(pwPtr->tkwin), PanedWindowWidgetObjCmd, pwPtr, + PanedWindowCmdDeletedProc); pwPtr->optionTable = pwOpts->pwOptions; pwPtr->slaveOpts = pwOpts->slaveOpts; pwPtr->relief = TK_RELIEF_RAISED; @@ -444,7 +444,7 @@ Tk_PanedWindowObjCmd( * otherwise Tk might free it while we still need it. */ - Tcl_Preserve((ClientData) pwPtr->tkwin); + Tcl_Preserve(pwPtr->tkwin); if (Tk_InitOptions(interp, (char *) pwPtr, pwOpts->pwOptions, tkwin) != TCL_OK) { @@ -453,7 +453,7 @@ Tk_PanedWindowObjCmd( } Tk_CreateEventHandler(pwPtr->tkwin, ExposureMask|StructureNotifyMask, - PanedWindowEventProc, (ClientData) pwPtr); + PanedWindowEventProc, pwPtr); /* * Find the toplevel ancestor of the panedwindow, and make a proxy win as @@ -483,7 +483,7 @@ Tk_PanedWindowObjCmd( Tk_SetWindowVisual(pwPtr->proxywin, Tk_Visual(tkwin), Tk_Depth(tkwin), Tk_Colormap(tkwin)); Tk_CreateEventHandler(pwPtr->proxywin, ExposureMask, ProxyWindowEventProc, - (ClientData) pwPtr); + pwPtr); atts.save_under = True; Tk_ChangeWindowAttributes(pwPtr->proxywin, CWSaveUnder, &atts); @@ -520,11 +520,11 @@ PanedWindowWidgetObjCmd( ClientData clientData, /* Information about square widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj * CONST objv[]) /* Argument objects. */ + Tcl_Obj * const objv[]) /* Argument objects. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; int result = TCL_OK; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "add", "cget", "configure", "forget", "identify", "panecget", "paneconfigure", "panes", "proxy", "sash", NULL }; @@ -547,7 +547,7 @@ PanedWindowWidgetObjCmd( return TCL_ERROR; } - Tcl_Preserve((ClientData) pwPtr); + Tcl_Preserve(pwPtr); switch ((enum options) index) { case PW_ADD: @@ -605,16 +605,17 @@ PanedWindowWidgetObjCmd( for (count = 0, i = 2; i < objc; i++) { Tk_Window slave = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), pwPtr->tkwin); + if (slave == NULL) { continue; } slavePtr = GetPane(pwPtr, slave); if ((slavePtr != NULL) && (slavePtr->masterPtr != NULL)) { count++; - Tk_ManageGeometry(slave, NULL, (ClientData)NULL); + Tk_ManageGeometry(slave, NULL, NULL); Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, (ClientData) slavePtr); + SlaveStructureProc, slavePtr); Tk_UnmapWindow(slavePtr->tkwin); Unlink(slavePtr); } @@ -720,7 +721,7 @@ PanedWindowWidgetObjCmd( result = PanedWindowSashCommand(pwPtr, interp, objc, objv); break; } - Tcl_Release((ClientData) pwPtr); + Tcl_Release(pwPtr); return result; } @@ -746,7 +747,7 @@ ConfigureSlaves( PanedWindow *pwPtr, /* Information about paned window. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int i, firstOptionArg, j, found, doubleBw, index, numNewSlaves, haveLoc; int insertIndex; @@ -973,9 +974,8 @@ ConfigureSlaves( */ Tk_CreateEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, (ClientData) slavePtr); - Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, - (ClientData) slavePtr); + SlaveStructureProc, slavePtr); + Tk_ManageGeometry(slavePtr->tkwin, &panedWindowMgrType, slavePtr); inserts[insertIndex++] = slavePtr; numNewSlaves++; } @@ -1066,9 +1066,9 @@ PanedWindowSashCommand( PanedWindow *pwPtr, /* Pointer to paned window information. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *sashOptionStrings[] = { + static const char *sashOptionStrings[] = { "coord", "dragto", "mark", "place", NULL }; enum sashOptions { @@ -1217,7 +1217,7 @@ ConfigurePanedWindow( Tcl_Interp *interp, /* Used for error reporting. */ PanedWindow *pwPtr, /* Information about widget. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument values. */ + Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; int typemask = 0; @@ -1230,7 +1230,7 @@ ConfigurePanedWindow( Tk_FreeSavedOptions(&savedOptions); - PanedWindowWorldChanged((ClientData) pwPtr); + PanedWindowWorldChanged(pwPtr); /* * If an option that affects geometry has changed, make a re-layout @@ -1268,7 +1268,7 @@ PanedWindowWorldChanged( { XGCValues gcValues; GC newGC; - PanedWindow *pwPtr = (PanedWindow *) instanceData; + PanedWindow *pwPtr = instanceData; /* * Allocated a graphics context for drawing the paned window widget @@ -1297,7 +1297,7 @@ PanedWindowWorldChanged( */ if (Tk_IsMapped(pwPtr->tkwin) && !(pwPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr); + Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr); pwPtr->flags |= REDRAW_PENDING; } } @@ -1325,17 +1325,17 @@ PanedWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; if (eventPtr->type == Expose) { if (pwPtr->tkwin != NULL && !(pwPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr); + Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr); pwPtr->flags |= REDRAW_PENDING; } } else if (eventPtr->type == ConfigureNotify) { pwPtr->flags |= REQUESTED_RELAYOUT; if (pwPtr->tkwin != NULL && !(pwPtr->flags & REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr); + Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr); pwPtr->flags |= REDRAW_PENDING; } } else if (eventPtr->type == DestroyNotify) { @@ -1365,7 +1365,7 @@ static void PanedWindowCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; /* * This function could be invoked either because the window was destroyed @@ -1402,7 +1402,7 @@ static void DisplayPanedWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; Slave *slavePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; @@ -1518,10 +1518,10 @@ DestroyPanedWindow( */ if (pwPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(DisplayPanedWindow, (ClientData) pwPtr); + Tcl_CancelIdleCall(DisplayPanedWindow, pwPtr); } if (pwPtr->flags & RESIZE_PENDING) { - Tcl_CancelIdleCall(ArrangePanes, (ClientData) pwPtr); + Tcl_CancelIdleCall(ArrangePanes, pwPtr); } /* @@ -1533,11 +1533,11 @@ DestroyPanedWindow( for (i = 0; i < pwPtr->numSlaves; i++) { Tk_DeleteEventHandler(pwPtr->slaves[i]->tkwin, StructureNotifyMask, - SlaveStructureProc, (ClientData) pwPtr->slaves[i]); + SlaveStructureProc, pwPtr->slaves[i]); Tk_ManageGeometry(pwPtr->slaves[i]->tkwin, NULL, NULL); - Tk_FreeConfigOptions((char *)pwPtr->slaves[i], pwPtr->slaveOpts, + Tk_FreeConfigOptions((char *) pwPtr->slaves[i], pwPtr->slaveOpts, pwPtr->tkwin); - ckfree((void *)pwPtr->slaves[i]); + ckfree((char *) pwPtr->slaves[i]); pwPtr->slaves[i] = NULL; } if (pwPtr->slaves) { @@ -1555,10 +1555,10 @@ DestroyPanedWindow( */ Tk_FreeConfigOptions((char *) pwPtr, pwPtr->optionTable, pwPtr->tkwin); - Tcl_Release((ClientData) pwPtr->tkwin); + Tcl_Release(pwPtr->tkwin); pwPtr->tkwin = NULL; - Tcl_EventuallyFree((ClientData) pwPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(pwPtr, TCL_DYNAMIC); } /* @@ -1586,12 +1586,12 @@ PanedWindowReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - Slave *slavePtr = (Slave *) clientData; + Slave *slavePtr = clientData; PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr); if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { pwPtr->flags |= RESIZE_PENDING; - Tcl_DoWhenIdle(ArrangePanes, (ClientData) pwPtr); + Tcl_DoWhenIdle(ArrangePanes, pwPtr); } } else { int doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; @@ -1630,18 +1630,18 @@ PanedWindowLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = (Slave *) clientData; - PanedWindow *pwPtr = (PanedWindow *) (slavePtr->masterPtr); + register Slave *slavePtr = clientData; + PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); } Unlink(slavePtr); Tk_DeleteEventHandler(slavePtr->tkwin, StructureNotifyMask, - SlaveStructureProc, (ClientData) slavePtr); + SlaveStructureProc, slavePtr); Tk_UnmapWindow(slavePtr->tkwin); slavePtr->tkwin = NULL; - ckfree((void *)slavePtr); + ckfree((char *) slavePtr); ComputeGeometry(pwPtr); } @@ -1669,7 +1669,7 @@ ArrangePanes( ClientData clientData) /* Structure describing parent whose slaves * are to be re-layed out. */ { - register PanedWindow *pwPtr = (PanedWindow *) clientData; + register PanedWindow *pwPtr = clientData; register Slave *slavePtr; int i, slaveWidth, slaveHeight, slaveX, slaveY; int paneWidth, paneHeight, paneSize, paneMinSize; @@ -1696,7 +1696,7 @@ ArrangePanes( return; } - Tcl_Preserve((ClientData) pwPtr); + Tcl_Preserve(pwPtr); /* * Find index of last visible pane. @@ -1939,7 +1939,7 @@ ArrangePanes( } sashCount--; } - Tcl_Release((ClientData) pwPtr); + Tcl_Release(pwPtr); } /* @@ -2000,7 +2000,7 @@ Unlink( masterPtr->flags |= REQUESTED_RELAYOUT; if (!(masterPtr->flags & REDRAW_PENDING)) { masterPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) masterPtr); + Tcl_DoWhenIdle(DisplayPanedWindow, masterPtr); } /* @@ -2071,13 +2071,13 @@ SlaveStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Slave *slavePtr = (Slave *) clientData; + Slave *slavePtr = clientData; PanedWindow *pwPtr = slavePtr->masterPtr; if (eventPtr->type == DestroyNotify) { Unlink(slavePtr); slavePtr->tkwin = NULL; - ckfree((void *)slavePtr); + ckfree((char *) slavePtr); ComputeGeometry(pwPtr); } } @@ -2256,7 +2256,7 @@ ComputeGeometry( Tk_GeometryRequest(pwPtr->tkwin, reqWidth, reqHeight); if (Tk_IsMapped(pwPtr->tkwin) && !(pwPtr->flags & REDRAW_PENDING)) { pwPtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(DisplayPanedWindow, (ClientData) pwPtr); + Tcl_DoWhenIdle(DisplayPanedWindow, pwPtr); } } @@ -2283,7 +2283,7 @@ DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ Tcl_Interp *interp) /* Pointer to the calling interp */ { - ckfree((char *)clientData); + ckfree((char *) clientData); return; } @@ -2664,11 +2664,11 @@ ProxyWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { - Tcl_DoWhenIdle(DisplayProxyWindow, (ClientData) pwPtr); + Tcl_DoWhenIdle(DisplayProxyWindow, pwPtr); pwPtr->flags |= PROXY_REDRAW_PENDING; } } @@ -2696,7 +2696,7 @@ static void DisplayProxyWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = (PanedWindow *) clientData; + PanedWindow *pwPtr = clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; @@ -2755,9 +2755,9 @@ PanedWindowProxyCommand( PanedWindow *pwPtr, /* Pointer to paned window information. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "coord", "forget", "place", NULL }; enum options { diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 28cdf9d..007c052 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.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: tkPlace.c,v 1.24 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkPlace.c,v 1.25 2008/04/27 22:38:56 dkf Exp $ */ #include "tkInt.h" @@ -174,7 +174,7 @@ static void SlaveStructureProc(ClientData clientData, XEvent *eventPtr); static int ConfigureSlave(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int PlaceInfoCommand(Tcl_Interp *interp, Tk_Window tkwin); static Slave * CreateSlave(Tk_Window tkwin, Tk_OptionTable table); static void FreeSlave(Slave *slavePtr); @@ -208,14 +208,14 @@ Tk_PlaceObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin; Slave *slavePtr; char *string; TkDisplay *dispPtr; Tk_OptionTable optionTable; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "configure", "forget", "info", "slaves", NULL }; enum options { PLACE_CONFIGURE, PLACE_FORGET, PLACE_INFO, PLACE_SLAVES }; @@ -321,7 +321,7 @@ Tk_PlaceObjCmd( Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - (ClientData) slavePtr); + slavePtr); Tk_ManageGeometry(tkwin, NULL, (ClientData) NULL); Tk_UnmapWindow(tkwin); FreeSlave(slavePtr); @@ -618,7 +618,7 @@ ConfigureSlave( Tk_Window tkwin, /* Token for the window to manipulate. */ Tk_OptionTable table, /* Token for option table. */ int objc, /* Number of config arguments. */ - Tcl_Obj *CONST objv[]) /* Object values for arguments. */ + Tcl_Obj *const objv[]) /* Object values for arguments. */ { register Master *masterPtr; Tk_SavedOptions savedOptions; @@ -732,7 +732,7 @@ ConfigureSlave( slavePtr->masterPtr = masterPtr; slavePtr->nextPtr = masterPtr->slavePtr; masterPtr->slavePtr = slavePtr; - Tk_ManageGeometry(slavePtr->tkwin, &placerType, (ClientData) slavePtr); + Tk_ManageGeometry(slavePtr->tkwin, &placerType, slavePtr); /* * Arrange for the master to be re-arranged at the first idle moment. @@ -743,7 +743,7 @@ ConfigureSlave( if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr); + Tcl_DoWhenIdle(RecomputePlacement, masterPtr); } return TCL_OK; @@ -851,7 +851,7 @@ static void RecomputePlacement( ClientData clientData) /* Pointer to Master record. */ { - register Master *masterPtr = (Master *) clientData; + register Master *masterPtr = clientData; register Slave *slavePtr; int x, y, width, height, tmp; int masterWidth, masterHeight, masterX, masterY; @@ -873,13 +873,13 @@ RecomputePlacement( } masterPtr->abortPtr = &abort; abort = 0; - Tcl_Preserve((ClientData) masterPtr); + Tcl_Preserve(masterPtr); /* * Iterate over all the slaves for the master. Each slave's geometry can * be computed independently of the other slaves. Changes to the window's * structure could cause almost anything to happen, including deleting the - * parent or child. If this happens, we'll be told to abort. + * parent or child. If this happens, we'll be told to abort. */ for (slavePtr = masterPtr->slavePtr; slavePtr != NULL && !abort; @@ -1046,7 +1046,7 @@ RecomputePlacement( } masterPtr->abortPtr = NULL; - Tcl_Release((ClientData) masterPtr); + Tcl_Release(masterPtr); } /* @@ -1073,7 +1073,7 @@ MasterStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *masterPtr = (Master *) clientData; + register Master *masterPtr = clientData; register Slave *slavePtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; @@ -1081,7 +1081,7 @@ MasterStructureProc( if ((masterPtr->slavePtr != NULL) && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr); + Tcl_DoWhenIdle(RecomputePlacement, masterPtr); } } else if (eventPtr->type == DestroyNotify) { for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; @@ -1093,13 +1093,13 @@ MasterStructureProc( Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, (char *) masterPtr->tkwin)); if (masterPtr->flags & PARENT_RECONFIG_PENDING) { - Tcl_CancelIdleCall(RecomputePlacement, (ClientData) masterPtr); + Tcl_CancelIdleCall(RecomputePlacement, masterPtr); } masterPtr->tkwin = NULL; if (masterPtr->abortPtr != NULL) { *masterPtr->abortPtr = 1; } - Tcl_EventuallyFree((ClientData) masterPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(masterPtr, TCL_DYNAMIC); } else if (eventPtr->type == MapNotify) { /* * When a master gets mapped, must redo the geometry computation so @@ -1109,7 +1109,7 @@ MasterStructureProc( if ((masterPtr->slavePtr != NULL) && !(masterPtr->flags & PARENT_RECONFIG_PENDING)) { masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr); + Tcl_DoWhenIdle(RecomputePlacement, masterPtr); } } else if (eventPtr->type == UnmapNotify) { /* @@ -1147,7 +1147,7 @@ SlaveStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = (Slave *) clientData; + register Slave *slavePtr = clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { @@ -1184,7 +1184,7 @@ PlaceRequestProc( ClientData clientData, /* Pointer to our record for slave. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Slave *slavePtr = (Slave *) clientData; + Slave *slavePtr = clientData; Master *masterPtr; if (((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) != 0) @@ -1197,7 +1197,7 @@ PlaceRequestProc( } if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { masterPtr->flags |= PARENT_RECONFIG_PENDING; - Tcl_DoWhenIdle(RecomputePlacement, (ClientData) masterPtr); + Tcl_DoWhenIdle(RecomputePlacement, masterPtr); } } @@ -1225,7 +1225,7 @@ PlaceLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = (Slave *) clientData; + register Slave *slavePtr = clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { @@ -1236,7 +1236,7 @@ PlaceLostSlaveProc( Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, (char *) tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, - (ClientData) slavePtr); + slavePtr); FreeSlave(slavePtr); } diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 29ee24e..00a8852 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.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: tkRectOval.c,v 1.17 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkRectOval.c,v 1.18 2008/04/27 22:38:57 dkf Exp $ */ #include <stdio.h> @@ -135,10 +135,10 @@ static Tk_ConfigSpec configSpecs[] = { static void ComputeRectOvalBbox(Tk_Canvas canvas, RectOvalItem *rectOvalPtr); static int ConfigureRectOval(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[], + Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], int flags); static int CreateRectOval(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]); + Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, @@ -149,7 +149,7 @@ static int OvalToArea(Tk_Canvas canvas, Tk_Item *itemPtr, static double OvalToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int RectOvalCoords(Tcl_Interp *interp, Tk_Canvas canvas, - Tk_Item *itemPtr, int objc, Tcl_Obj *CONST objv[]); + Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static int RectOvalToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr, @@ -240,7 +240,7 @@ CreateRectOval( Tk_Item *itemPtr, /* Record to hold new item; header has been * initialized by caller. */ int objc, /* Number of arguments in objv. */ - Tcl_Obj *CONST objv[]) /* Arguments describing rectangle. */ + Tcl_Obj *const objv[]) /* Arguments describing rectangle. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; int i; @@ -315,7 +315,7 @@ RectOvalCoords( Tk_Item *itemPtr, /* Item whose coordinates are to be read or * modified. */ int objc, /* Number of coordinates supplied in objv. */ - Tcl_Obj *CONST objv[]) /* Array of coordinates: x1,y1,x2,y2,... */ + Tcl_Obj *const objv[]) /* Array of coordinates: x1,y1,x2,y2,... */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; @@ -404,7 +404,7 @@ ConfigureRectOval( Tk_Canvas canvas, /* Canvas containing itemPtr. */ Tk_Item *itemPtr, /* Rectangle item to reconfigure. */ int objc, /* Number of elements in objv. */ - Tcl_Obj *CONST objv[], /* Arguments describing things to configure. */ + Tcl_Obj *const objv[], /* Arguments describing things to configure. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; @@ -420,7 +420,7 @@ ConfigureRectOval( tkwin = Tk_CanvasTkwin(canvas); if (TCL_OK != Tk_ConfigureWidget(interp, tkwin, configSpecs, objc, - (CONST char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) { + (const char **)objv, (char *) rectOvalPtr, flags|TK_CONFIG_OBJS)) { return TCL_ERROR; } state = itemPtr->state; @@ -483,7 +483,7 @@ ConfigureRectOval( rectOvalPtr->outline.gc = newGC; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } if (state == TK_STATE_HIDDEN) { ComputeRectOvalBbox(canvas, rectOvalPtr); @@ -492,7 +492,7 @@ ConfigureRectOval( color = rectOvalPtr->fillColor; stipple = rectOvalPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (rectOvalPtr->activeFillColor!=NULL) { color = rectOvalPtr->activeFillColor; } @@ -636,7 +636,7 @@ ComputeRectOvalBbox( Tk_State state = rectOvalPtr->header.state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = rectOvalPtr->outline.width; @@ -645,7 +645,7 @@ ComputeRectOvalBbox( rectOvalPtr->header.x2 = rectOvalPtr->header.y2 = -1; return; } - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) { if (rectOvalPtr->outline.activeWidth>width) { width = rectOvalPtr->outline.activeWidth; } @@ -781,10 +781,10 @@ DisplayRectOval( */ if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } fillStipple = rectOvalPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == (Tk_Item *)rectOvalPtr) { + if (Canvas(canvas)->currentItemPtr == (Tk_Item *) rectOvalPtr) { if (rectOvalPtr->activeFillStipple != None) { fillStipple = rectOvalPtr->activeFillStipple; } @@ -886,11 +886,11 @@ RectToPoint( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = rectPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (rectPtr->outline.activeWidth>width) { width = rectPtr->outline.activeWidth; } @@ -1006,11 +1006,11 @@ OvalToPoint( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = (double) ovalPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (ovalPtr->outline.activeWidth>width) { width = (double) ovalPtr->outline.activeWidth; } @@ -1062,16 +1062,16 @@ RectToArea( Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = rectPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (rectPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (rectPtr->outline.activeWidth > width) { width = rectPtr->outline.activeWidth; } } else if (state == TK_STATE_DISABLED) { - if (rectPtr->outline.disabledWidth>0) { + if (rectPtr->outline.disabledWidth > 0) { width = rectPtr->outline.disabledWidth; } } @@ -1131,22 +1131,21 @@ OvalToArea( * y1, x2, y2) describing rectangular area. */ { RectOvalItem *ovalPtr = (RectOvalItem *) itemPtr; - double oval[4], halfWidth; + double oval[4], halfWidth, width; int result; - double width; Tk_State state = itemPtr->state; if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } width = ovalPtr->outline.width; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { - if (ovalPtr->outline.activeWidth>width) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { + if (ovalPtr->outline.activeWidth > width) { width = ovalPtr->outline.activeWidth; } } else if (state == TK_STATE_DISABLED) { - if (ovalPtr->outline.disabledWidth>0) { + if (ovalPtr->outline.disabledWidth > 0) { width = ovalPtr->outline.disabledWidth; } } @@ -1328,12 +1327,12 @@ RectOvalToPostscript( } if (state == TK_STATE_NULL) { - state = ((TkCanvas *)canvas)->canvas_state; + state = Canvas(canvas)->canvas_state; } color = rectOvalPtr->outline.color; fillColor = rectOvalPtr->fillColor; fillStipple = rectOvalPtr->fillStipple; - if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) { + if (Canvas(canvas)->currentItemPtr == itemPtr) { if (rectOvalPtr->outline.activeColor!=NULL) { color = rectOvalPtr->outline.activeColor; } @@ -1385,7 +1384,7 @@ RectOvalToPostscript( Tcl_AppendResult(interp, pathCmd, "0 setlinejoin 2 setlinecap\n", NULL); if (Tk_CanvasPsOutline(canvas, itemPtr, - &(rectOvalPtr->outline))!= TCL_OK) { + &rectOvalPtr->outline)!= TCL_OK) { return TCL_ERROR; } } diff --git a/generic/tkScale.c b/generic/tkScale.c index fce0341..cb010c1 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.28 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.29 2008/04/27 22:38:58 dkf Exp $ */ #include "default.h" @@ -142,7 +142,7 @@ static const Tk_OptionSpec optionSpecs[] = { * scale widget command. */ -static CONST char *commandNames[] = { +static const char *commandNames[] = { "cget", "configure", "coords", "get", "identify", "set", NULL }; @@ -158,17 +158,17 @@ enum command { static void ComputeFormat(TkScale *scalePtr); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void DestroyScale(char *memPtr); static void ScaleCmdDeletedProc(ClientData clientData); static void ScaleEventProc(ClientData clientData, XEvent *eventPtr); static char * ScaleVarProc(ClientData clientData, - Tcl_Interp *interp, CONST char *name1, - CONST char *name2, int flags); + Tcl_Interp *interp, const char *name1, + const char *name2, int flags); static int ScaleWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void ScaleWorldChanged(ClientData instanceData); static void ScaleSetVariable(TkScale *scalePtr); @@ -204,7 +204,7 @@ Tk_ScaleObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument values. */ + Tcl_Obj *const objv[]) /* Argument values. */ { register TkScale *scalePtr; Tk_OptionTable optionTable; @@ -242,7 +242,7 @@ Tk_ScaleObjCmd( scalePtr->interp = interp; scalePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(scalePtr->tkwin), ScaleWidgetObjCmd, - (ClientData) scalePtr, ScaleCmdDeletedProc); + scalePtr, ScaleCmdDeletedProc); scalePtr->optionTable = optionTable; scalePtr->orient = ORIENT_VERTICAL; scalePtr->width = 0; @@ -291,10 +291,10 @@ Tk_ScaleObjCmd( scalePtr->takeFocusPtr = NULL; scalePtr->flags = NEVER_SET; - Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, (ClientData) scalePtr); + Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, scalePtr); Tk_CreateEventHandler(scalePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, - ScaleEventProc, (ClientData) scalePtr); + ScaleEventProc, scalePtr); if ((Tk_InitOptions(interp, (char *) scalePtr, optionTable, tkwin) != TCL_OK) || @@ -330,9 +330,9 @@ ScaleWidgetObjCmd( ClientData clientData, /* Information about scale widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument strings. */ + Tcl_Obj *const objv[]) /* Argument strings. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = clientData; Tcl_Obj *objPtr; int index, result; @@ -345,7 +345,7 @@ ScaleWidgetObjCmd( if (result != TCL_OK) { return result; } - Tcl_Preserve((ClientData) scalePtr); + Tcl_Preserve(scalePtr); switch (index) { case COMMAND_CGET: @@ -467,11 +467,11 @@ ScaleWidgetObjCmd( break; } } - Tcl_Release((ClientData) scalePtr); + Tcl_Release(scalePtr); return result; error: - Tcl_Release((ClientData) scalePtr); + Tcl_Release(scalePtr); return TCL_ERROR; } @@ -503,7 +503,7 @@ DestroyScale( Tcl_DeleteCommandFromToken(scalePtr->interp, scalePtr->widgetCmd); if (scalePtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(TkpDisplayScale, (ClientData) scalePtr); + Tcl_CancelIdleCall(TkpDisplayScale, scalePtr); } /* @@ -514,7 +514,7 @@ DestroyScale( if (scalePtr->varNamePtr != NULL) { Tcl_UntraceVar(scalePtr->interp, Tcl_GetString(scalePtr->varNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - ScaleVarProc, (ClientData) scalePtr); + ScaleVarProc, scalePtr); } if (scalePtr->troughGC != None) { Tk_FreeGC(scalePtr->display, scalePtr->troughGC); @@ -557,7 +557,7 @@ ConfigureScale( register TkScale *scalePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ - Tcl_Obj *CONST objv[]) /* Argument values. */ + Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; Tcl_Obj *errorResult = NULL; @@ -571,7 +571,7 @@ ConfigureScale( if (scalePtr->varNamePtr != NULL) { Tcl_UntraceVar(interp, Tcl_GetString(scalePtr->varNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - ScaleVarProc, (ClientData) scalePtr); + ScaleVarProc, scalePtr); } for (error = 0; error <= 1; error++) { @@ -581,8 +581,8 @@ ConfigureScale( */ if (Tk_SetOptions(interp, (char *) scalePtr, - scalePtr->optionTable, objc, objv, - scalePtr->tkwin, &savedOptions, NULL) != TCL_OK) { + scalePtr->optionTable, objc, objv, scalePtr->tkwin, + &savedOptions, NULL) != TCL_OK) { continue; } } else { @@ -687,10 +687,10 @@ ConfigureScale( } Tcl_TraceVar(interp, Tcl_GetString(scalePtr->varNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, - ScaleVarProc, (ClientData) scalePtr); + ScaleVarProc, scalePtr); } - ScaleWorldChanged((ClientData) scalePtr); + ScaleWorldChanged(scalePtr); if (error) { Tcl_SetObjResult(interp, errorResult); Tcl_DecrRefCount(errorResult); @@ -723,9 +723,7 @@ ScaleWorldChanged( { XGCValues gcValues; GC gc; - TkScale *scalePtr; - - scalePtr = (TkScale *) instanceData; + TkScale *scalePtr = instanceData; gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); @@ -1007,7 +1005,7 @@ ScaleEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); @@ -1055,7 +1053,7 @@ static void ScaleCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = clientData; Tk_Window tkwin = scalePtr->tkwin; /* @@ -1102,7 +1100,7 @@ TkEventuallyRedrawScale( } if (!(scalePtr->flags & REDRAW_PENDING)) { scalePtr->flags |= REDRAW_PENDING; - Tcl_DoWhenIdle(TkpDisplayScale, (ClientData) scalePtr); + Tcl_DoWhenIdle(TkpDisplayScale, scalePtr); } scalePtr->flags |= what; } @@ -1173,11 +1171,11 @@ static char * ScaleVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* Name of variable. */ - CONST char *name2, /* Second part of variable name. */ + const char *name1, /* Name of variable. */ + const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkScale *scalePtr = (TkScale *) clientData; + register TkScale *scalePtr = clientData; char *resultStr; double value; Tcl_Obj *valuePtr; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 52e449f..359e92c 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.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: tkScrollbar.c,v 1.12 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkScrollbar.c,v 1.13 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -25,7 +25,7 @@ static Tk_CustomOption orientOption = { (Tk_OptionParseProc *) TkOrientParseProc, TkOrientPrintProc, - (ClientData) NULL + NULL }; /* @@ -99,10 +99,10 @@ Tk_ConfigSpec tkpScrollbarConfigSpecs[] = { static int ConfigureScrollbar(Tcl_Interp *interp, TkScrollbar *scrollPtr, int argc, - CONST char **argv, int flags); + const char **argv, int flags); static void ScrollbarCmdDeletedProc(ClientData clientData); static int ScrollbarWidgetCmd(ClientData clientData, - Tcl_Interp *, int argc, CONST char **argv); + Tcl_Interp *, int argc, const char **argv); /* *-------------------------------------------------------------- @@ -126,9 +126,9 @@ Tk_ScrollbarCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; register TkScrollbar *scrollPtr; Tk_Window newWin; @@ -146,7 +146,7 @@ Tk_ScrollbarCmd( Tk_SetClass(newWin, "Scrollbar"); scrollPtr = TkpCreateScrollbar(newWin); - Tk_SetClassProcs(newWin, &tkpScrollbarProcs, (ClientData) scrollPtr); + Tk_SetClassProcs(newWin, &tkpScrollbarProcs, scrollPtr); /* * Initialize fields that won't be initialized by ConfigureScrollbar, or @@ -159,7 +159,7 @@ Tk_ScrollbarCmd( scrollPtr->interp = interp; scrollPtr->widgetCmd = Tcl_CreateCommand(interp, Tk_PathName(scrollPtr->tkwin), ScrollbarWidgetCmd, - (ClientData) scrollPtr, ScrollbarCmdDeletedProc); + scrollPtr, ScrollbarCmdDeletedProc); scrollPtr->vertical = 0; scrollPtr->width = 0; scrollPtr->command = NULL; @@ -223,9 +223,9 @@ ScrollbarWidgetCmd( ClientData clientData, /* Information about scrollbar widget. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { - register TkScrollbar *scrollPtr = (TkScrollbar *) clientData; + register TkScrollbar *scrollPtr = clientData; int result = TCL_OK; size_t length; int c; @@ -235,7 +235,7 @@ ScrollbarWidgetCmd( argv[0], " option ?arg arg ...?\"", NULL); return TCL_ERROR; } - Tcl_Preserve((ClientData) scrollPtr); + Tcl_Preserve(scrollPtr); c = argv[1][0]; length = strlen(argv[1]); if ((c == 'a') && (strncmp(argv[1], "activate", length) == 0)) { @@ -493,11 +493,11 @@ ScrollbarWidgetCmd( } done: - Tcl_Release((ClientData) scrollPtr); + Tcl_Release(scrollPtr); return result; error: - Tcl_Release((ClientData) scrollPtr); + Tcl_Release(scrollPtr); return TCL_ERROR; } @@ -528,7 +528,7 @@ ConfigureScrollbar( /* Information about widget; may or may not * already have values for some fields. */ int argc, /* Number of valid entries in argv. */ - CONST char **argv, /* Arguments. */ + const char **argv, /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { if (Tk_ConfigureWidget(interp, scrollPtr->tkwin, tkpScrollbarConfigSpecs, @@ -587,7 +587,7 @@ TkScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = (TkScrollbar *) clientData; + TkScrollbar *scrollPtr = clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); @@ -599,7 +599,7 @@ TkScrollbarEventProc( scrollPtr->widgetCmd); } if (scrollPtr->flags & REDRAW_PENDING) { - Tcl_CancelIdleCall(TkpDisplayScrollbar, (ClientData) scrollPtr); + Tcl_CancelIdleCall(TkpDisplayScrollbar, scrollPtr); } /* * Free up all the stuff that requires special handling, then let @@ -608,7 +608,7 @@ TkScrollbarEventProc( Tk_FreeOptions(tkpScrollbarConfigSpecs, (char *) scrollPtr, scrollPtr->display, 0); - Tcl_EventuallyFree((ClientData) scrollPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(scrollPtr, TCL_DYNAMIC); } else if (eventPtr->type == ConfigureNotify) { TkpComputeScrollbarGeometry(scrollPtr); TkScrollbarEventuallyRedraw(scrollPtr); @@ -651,7 +651,7 @@ static void ScrollbarCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScrollbar *scrollPtr = (TkScrollbar *) clientData; + TkScrollbar *scrollPtr = clientData; Tk_Window tkwin = scrollPtr->tkwin; /* @@ -691,7 +691,7 @@ TkScrollbarEventuallyRedraw( return; } if ((scrollPtr->flags & REDRAW_PENDING) == 0) { - Tcl_DoWhenIdle(TkpDisplayScrollbar, (ClientData) scrollPtr); + Tcl_DoWhenIdle(TkpDisplayScrollbar, scrollPtr); scrollPtr->flags |= REDRAW_PENDING; } } diff --git a/generic/tkSelect.c b/generic/tkSelect.c index dca3d1c..e02478f 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.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: tkSelect.c,v 1.20 2007/04/17 14:36:49 dkf Exp $ + * RCS: @(#) $Id: tkSelect.c,v 1.21 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -197,7 +197,7 @@ Tk_CreateSelHandler( unsigned cmdInfoLen = sizeof(CommandInfo) + ((CommandInfo*)clientData)->cmdLength - 3; - selPtr->clientData = (ClientData)ckalloc(cmdInfoLen); + selPtr->clientData = (ClientData) ckalloc(cmdInfoLen); memcpy(selPtr->clientData, clientData, cmdInfoLen); } else { selPtr->clientData = clientData; @@ -321,7 +321,7 @@ Tk_DeleteSelHandler( * Mark the CommandInfo as deleted and free it if we can. */ - ((CommandInfo*)selPtr->clientData)->interp = NULL; + ((CommandInfo *) selPtr->clientData)->interp = NULL; Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC); } ckfree((char *) selPtr); @@ -671,15 +671,15 @@ Tk_SelectionObjCmd( * interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = clientData; char *path = NULL; Atom selection; char *selName = NULL, *string; int count, index; Tcl_Obj **objs; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "clear", "get", "handle", "own", NULL }; enum options { @@ -698,7 +698,7 @@ Tk_SelectionObjCmd( switch ((enum options) index) { case SELECTION_CLEAR: { - static CONST char *clearOptionStrings[] = { + static const char *clearOptionStrings[] = { "-displayof", "-selection", NULL }; enum clearOptions { CLEAR_DISPLAYOF, CLEAR_SELECTION }; @@ -757,7 +757,7 @@ Tk_SelectionObjCmd( char *targetName = NULL; Tcl_DString selBytes; int result; - static CONST char *getOptionStrings[] = { + static const char *getOptionStrings[] = { "-displayof", "-selection", "-type", NULL }; enum getOptions { GET_DISPLAYOF, GET_SELECTION, GET_TYPE }; @@ -817,7 +817,7 @@ Tk_SelectionObjCmd( Tcl_DStringInit(&selBytes); result = Tk_GetSelection(interp, tkwin, selection, target, - SelGetProc, (ClientData) &selBytes); + SelGetProc, &selBytes); if (result == TCL_OK) { Tcl_DStringResult(interp, &selBytes); } else { @@ -832,7 +832,7 @@ Tk_SelectionObjCmd( char *formatName = NULL; register CommandInfo *cmdInfoPtr; int cmdLength; - static CONST char *handleOptionStrings[] = { + static const char *handleOptionStrings[] = { "-format", "-selection", "-type", NULL }; enum handleOptions { @@ -911,7 +911,7 @@ Tk_SelectionObjCmd( cmdInfoPtr->cmdLength = cmdLength; strcpy(cmdInfoPtr->command, string); Tk_CreateSelHandler(tkwin, selection, target, HandleTclCommand, - (ClientData) cmdInfoPtr, format); + cmdInfoPtr, format); } return TCL_OK; } @@ -920,7 +920,7 @@ Tk_SelectionObjCmd( register LostCommand *lostPtr; char *script = NULL; int cmdLength; - static CONST char *ownOptionStrings[] = { + static const char *ownOptionStrings[] = { "-command", "-displayof", "-selection", NULL }; enum ownOptions { OWN_COMMAND, OWN_DISPLAYOF, OWN_SELECTION }; @@ -1003,15 +1003,15 @@ Tk_SelectionObjCmd( script = Tcl_GetString(objs[1]); } if (script == NULL) { - Tk_OwnSelection(tkwin, selection, NULL, (ClientData) NULL); + Tk_OwnSelection(tkwin, selection, NULL, NULL); return TCL_OK; } cmdLength = strlen(script); - lostPtr = (LostCommand *) ckalloc((unsigned) (sizeof(LostCommand) - -3 + cmdLength)); + lostPtr = (LostCommand *) + ckalloc((unsigned) (sizeof(LostCommand) - 3 + cmdLength)); lostPtr->interp = interp; strcpy(lostPtr->command, script); - Tk_OwnSelection(tkwin, selection, LostSelection, (ClientData) lostPtr); + Tk_OwnSelection(tkwin, selection, LostSelection, lostPtr); return TCL_OK; } } @@ -1119,7 +1119,7 @@ TkSelDeadWindow( * Mark the CommandInfo as deleted and free it when we can. */ - ((CommandInfo*)selPtr->clientData)->interp = NULL; + ((CommandInfo *) selPtr->clientData)->interp = NULL; Tcl_EventuallyFree(selPtr->clientData, TCL_DYNAMIC); } ckfree((char *) selPtr); @@ -1292,7 +1292,7 @@ SelGetProc( * used). */ char *portion) /* New information to be appended. */ { - Tcl_DStringAppend((Tcl_DString *) clientData, portion, -1); + Tcl_DStringAppend(clientData, portion, -1); return TCL_OK; } @@ -1324,7 +1324,7 @@ HandleTclCommand( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - CommandInfo *cmdInfoPtr = (CommandInfo *) clientData; + CommandInfo *cmdInfoPtr = clientData; int spaceNeeded, length; #define MAX_STATIC_SIZE 100 char staticSpace[MAX_STATIC_SIZE]; @@ -1333,7 +1333,7 @@ HandleTclCommand( Tcl_DString oldResult; Tcl_Obj *objPtr; int extraBytes, charOffset, count, numChars; - CONST char *p; + const char *p; /* * We must also protect the interpreter and the command from being deleted @@ -1341,7 +1341,7 @@ HandleTclCommand( */ Tcl_Preserve(clientData); - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); /* * Compute the proper byte offset in the case where the last chunk split a @@ -1427,7 +1427,7 @@ HandleTclCommand( } Tcl_Release(clientData); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); return count; } @@ -1492,7 +1492,7 @@ TkSelDefaultSelection( if ((selPtr->selection == infoPtr->selection) && (selPtr->target != dispPtr->applicationAtom) && (selPtr->target != dispPtr->windowAtom)) { - CONST char *atomString = Tk_GetAtomName((Tk_Window) winPtr, + const char *atomString = Tk_GetAtomName((Tk_Window) winPtr, selPtr->target); Tcl_DStringAppendElement(&ds, atomString); } @@ -1559,12 +1559,12 @@ static void LostSelection( ClientData clientData) /* Pointer to LostCommand structure. */ { - LostCommand *lostPtr = (LostCommand *) clientData; + LostCommand *lostPtr = clientData; Tcl_Obj *objPtr; Tcl_Interp *interp; interp = lostPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); /* * Execute the command. Save the interpreter's result, if any, and restore @@ -1582,7 +1582,7 @@ LostSelection( Tcl_SetObjResult(interp, objPtr); Tcl_DecrRefCount(objPtr); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); /* * Free the storage for the command, since we're done with it now. diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 6bfde11..29d9957 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.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: tkSquare.c,v 1.10 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkSquare.c,v 1.11 2008/04/27 22:38:58 dkf Exp $ */ #if 0 @@ -94,7 +94,7 @@ static const Tk_OptionSpec optionSpecs[] = { int SquareObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static void SquareDeletedProc(ClientData clientData); static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr); static void SquareDestroy(char *memPtr); @@ -103,7 +103,7 @@ static void KeepInWindow(Square *squarePtr); static void SquareObjEventProc(ClientData clientData, XEvent *eventPtr); static int SquareWidgetObjCmd(ClientData clientData, - Tcl_Interp *, int objc, Tcl_Obj * CONST objv[]); + Tcl_Interp *, int objc, Tcl_Obj * const objv[]); /* *-------------------------------------------------------------- @@ -127,7 +127,7 @@ SquareObjCmd( ClientData clientData, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Square *squarePtr; Tk_Window tkwin; @@ -166,8 +166,8 @@ SquareObjCmd( squarePtr->display = Tk_Display(tkwin); squarePtr->interp = interp; squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, - Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, - (ClientData) squarePtr, SquareDeletedProc); + Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr, + SquareDeletedProc); squarePtr->gc = None; squarePtr->optionTable = optionTable; @@ -179,7 +179,7 @@ SquareObjCmd( } Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask, - SquareObjEventProc, (ClientData) squarePtr); + SquareObjEventProc, squarePtr); if (Tk_SetOptions(interp, (char *) squarePtr, optionTable, objc - 2, objv + 2, tkwin, NULL, NULL) != TCL_OK) { goto error; @@ -220,11 +220,11 @@ SquareWidgetObjCmd( ClientData clientData, /* Information about square widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj * CONST objv[]) /* Argument objects. */ + Tcl_Obj * const objv[]) /* Argument objects. */ { - Square *squarePtr = (Square *) clientData; + Square *squarePtr = clientData; int result = TCL_OK; - static CONST char *squareOptions[] = {"cget", "configure", NULL}; + static const char *squareOptions[] = {"cget", "configure", NULL}; enum { SQUARE_CGET, SQUARE_CONFIGURE }; @@ -241,7 +241,7 @@ SquareWidgetObjCmd( return TCL_ERROR; } - Tcl_Preserve((ClientData) squarePtr); + Tcl_Preserve(squarePtr); switch (index) { case SQUARE_CGET: @@ -279,7 +279,7 @@ SquareWidgetObjCmd( result = SquareConfigure(interp, squarePtr); } if (!squarePtr->updatePending) { - Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr); + Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = 1; } } @@ -287,11 +287,11 @@ SquareWidgetObjCmd( Tcl_SetObjResult(interp, resultObjPtr); } } - Tcl_Release((ClientData) squarePtr); + Tcl_Release(squarePtr); return result; error: - Tcl_Release((ClientData) squarePtr); + Tcl_Release(squarePtr); return TCL_ERROR; } @@ -352,7 +352,7 @@ SquareConfigure( &borderWidth); Tk_SetInternalBorder(squarePtr->tkwin, borderWidth); if (!squarePtr->updatePending) { - Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr); + Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = 1; } KeepInWindow(squarePtr); @@ -382,17 +382,17 @@ SquareObjEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Square *squarePtr = (Square *) clientData; + Square *squarePtr = clientData; if (eventPtr->type == Expose) { if (!squarePtr->updatePending) { - Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr); + Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = 1; } } else if (eventPtr->type == ConfigureNotify) { KeepInWindow(squarePtr); if (!squarePtr->updatePending) { - Tcl_DoWhenIdle(SquareDisplay, (ClientData) squarePtr); + Tcl_DoWhenIdle(SquareDisplay, squarePtr); squarePtr->updatePending = 1; } } else if (eventPtr->type == DestroyNotify) { @@ -407,9 +407,9 @@ SquareObjEventProc( squarePtr->widgetCmd); } if (squarePtr->updatePending) { - Tcl_CancelIdleCall(SquareDisplay, (ClientData) squarePtr); + Tcl_CancelIdleCall(SquareDisplay, squarePtr); } - Tcl_EventuallyFree((ClientData) squarePtr, SquareDestroy); + Tcl_EventuallyFree(squarePtr, SquareDestroy); } } @@ -435,7 +435,7 @@ static void SquareDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Square *squarePtr = (Square *) clientData; + Square *squarePtr = clientData; Tk_Window tkwin = squarePtr->tkwin; /* @@ -472,7 +472,7 @@ static void SquareDisplay( ClientData clientData) /* Information about window. */ { - Square *squarePtr = (Square *) clientData; + Square *squarePtr = clientData; Tk_Window tkwin = squarePtr->tkwin; Pixmap pm = None; Drawable d; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index c7f02e7..2372007 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.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: tkStubInit.c,v 1.62 2008/04/16 14:51:29 das Exp $ + * RCS: @(#) $Id: tkStubInit.c,v 1.63 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -37,9 +37,9 @@ */ #define Tk_CreateCanvasVisitor \ - ((void (*)(Tcl_Interp * interp, VOID * typePtr)) NULL) + ((void (*)(Tcl_Interp * interp, void * typePtr)) NULL) #define Tk_GetCanvasVisitor \ - ((VOID * (*)(Tcl_Interp * interp, CONST char * name)) NULL) + ((void * (*)(Tcl_Interp * interp, const char * name)) NULL) /* * WARNING: The contents of this file is automatically generated by the diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index ddfd986..ce47028 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.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: tkStubLib.c,v 1.24 2008/04/02 21:31:58 das Exp $ + * RCS: @(#) $Id: tkStubLib.c,v 1.25 2008/04/27 22:38:58 dkf Exp $ */ /* @@ -59,7 +59,9 @@ const TkIntXlibStubs *tkIntXlibStubsPtr = NULL; * Use our own isdigit to avoid linking to libc on windows */ -static int isDigit(const int c) +static int +isDigit( + const int c) { return (c >= '0' && c <= '9'); } @@ -82,13 +84,13 @@ static int isDigit(const int c) *---------------------------------------------------------------------- */ -MODULE_SCOPE CONST char * +MODULE_SCOPE const char * Tk_InitStubs( Tcl_Interp *interp, - CONST char *version, + const char *version, int exact) { - CONST char *actualVersion; + const char *actualVersion; const TkStubs **stubsPtrPtr = &tkStubsPtr; /* squelch warning */ actualVersion = Tcl_PkgRequireEx(interp, "Tk", version, 0, @@ -97,14 +99,14 @@ Tk_InitStubs( return NULL; } if (exact) { - CONST char *p = version; + const char *p = version; int count = 0; while (*p) { count += !isDigit(*p++); } if (count == 1) { - CONST char *q = actualVersion; + const char *q = actualVersion; p = version; while (*p && (*p == *q)) { diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 5f2ada2..24464c0 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.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: tkStyle.c,v 1.8 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkStyle.c,v 1.9 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -26,7 +26,7 @@ typedef struct StyledWidgetSpec { * structure. */ Tk_OptionTable optionTable; /* Option table for the widget class using the * element. */ - CONST Tk_OptionSpec **optionsPtr; + const Tk_OptionSpec **optionsPtr; /* Table of option spec pointers, matching the * option list provided during element * registration. Malloc'd. */ @@ -60,7 +60,7 @@ typedef struct StyledElement { */ typedef struct StyleEngine { - CONST char *name; /* Name of engine. Points to a hash key. */ + const char *name; /* Name of engine. Points to a hash key. */ StyledElement *elements; /* Table of widget element descriptors. Each * element is indexed by a unique system-wide * ID. Table grows dynamically as new elements @@ -77,7 +77,7 @@ typedef struct StyleEngine { */ typedef struct Style { - CONST char *name; /* Name of style. Points to a hash key. */ + const char *name; /* Name of style. Points to a hash key. */ StyleEngine *enginePtr; /* Style engine of which the style is an * instance. */ ClientData clientData; /* Data provided during registration. */ @@ -88,7 +88,7 @@ typedef struct Style { */ typedef struct Element { - CONST char *name; /* Name of element. Points to a hash key. */ + const char *name; /* Name of element. Points to a hash key. */ int id; /* Id of element. */ int genericId; /* Id of generic element. */ int created; /* Boolean, whether the element was created @@ -122,7 +122,7 @@ static Tcl_ThreadDataKey dataKey; * Forward declarations for functions defined later in this file: */ -static int CreateElement(CONST char *name, int create); +static int CreateElement(const char *name, int create); static void DupStyleObjProc(Tcl_Obj *srcObjPtr, Tcl_Obj *dupObjPtr); static void FreeElement(Element *elementPtr); @@ -134,13 +134,13 @@ static StyledElement * GetStyledElement(StyleEngine *enginePtr, int elementId); static StyledWidgetSpec*GetWidgetSpec(StyledElement *elementPtr, Tk_OptionTable optionTable); -static void InitElement(Element *elementPtr, CONST char *name, +static void InitElement(Element *elementPtr, const char *name, int id, int genericId, int created); -static void InitStyle(Style *stylePtr, CONST char *name, +static void InitStyle(Style *stylePtr, const char *name, StyleEngine *enginePtr, ClientData clientData); static void InitStyledElement(StyledElement *elementPtr); static void InitStyleEngine(StyleEngine *enginePtr, - CONST char *name, StyleEngine *parentPtr); + const char *name, StyleEngine *parentPtr); static void InitWidgetSpec(StyledWidgetSpec *widgetSpecPtr, StyledElement *elementPtr, Tk_OptionTable optionTable); @@ -182,7 +182,7 @@ void TkStylePkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->nbInit != 0) { @@ -238,7 +238,7 @@ void TkStylePkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; @@ -267,7 +267,7 @@ TkStylePkgFree( entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (entryPtr != NULL) { - enginePtr = (StyleEngine *) Tcl_GetHashValue(entryPtr); + enginePtr = Tcl_GetHashValue(entryPtr); FreeStyleEngine(enginePtr); ckfree((char *) enginePtr); entryPtr = Tcl_NextHashEntry(&search); @@ -305,12 +305,12 @@ TkStylePkgFree( Tk_StyleEngine Tk_RegisterStyleEngine( - CONST char *name, /* Name of the engine to create. NULL or empty + const char *name, /* Name of the engine to create. NULL or empty * means the default system engine. */ Tk_StyleEngine parent) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -337,7 +337,7 @@ Tk_RegisterStyleEngine( enginePtr = (StyleEngine *) ckalloc(sizeof(StyleEngine)); InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr), (StyleEngine *) parent); - Tcl_SetHashValue(entryPtr, (ClientData) enginePtr); + Tcl_SetHashValue(entryPtr, enginePtr); return (Tk_StyleEngine) enginePtr; } @@ -361,13 +361,13 @@ Tk_RegisterStyleEngine( static void InitStyleEngine( StyleEngine *enginePtr, /* Points to an uninitialized engine. */ - CONST char *name, /* Name of the registered engine. NULL or empty + const char *name, /* Name of the registered engine. NULL or empty * means the default system engine. Usually * points to the hash key. */ StyleEngine *parentPtr) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -377,14 +377,12 @@ InitStyleEngine( */ enginePtr->parentPtr = NULL; - } else if (parentPtr == NULL) { /* * The default style engine is the parent. */ enginePtr->parentPtr = tsdPtr->defaultEnginePtr; - } else { enginePtr->parentPtr = parentPtr; } @@ -424,7 +422,7 @@ static void FreeStyleEngine( StyleEngine *enginePtr) /* The style engine to free. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -456,10 +454,10 @@ FreeStyleEngine( Tk_StyleEngine Tk_GetStyleEngine( - CONST char *name) /* Name of the engine to retrieve. NULL or + const char *name) /* Name of the engine to retrieve. NULL or * empty means the default system engine. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; @@ -472,7 +470,7 @@ Tk_GetStyleEngine( return NULL; } - return (Tk_StyleEngine) Tcl_GetHashValue(entryPtr); + return Tcl_GetHashValue(entryPtr); } /* @@ -494,7 +492,7 @@ Tk_GetStyleEngine( static void InitElement( Element *elementPtr, /* Points to an uninitialized element.*/ - CONST char *name, /* Name of the registered element. Usually + const char *name, /* Name of the registered element. Usually * points to the hash key. */ int id, /* Unique element ID. */ int genericId, /* ID of generic element. -1 means none. */ @@ -604,17 +602,16 @@ FreeStyledElement( static int CreateElement( - CONST char *name, /* Name of the element. */ - int create) /* Boolean, whether the element is being created - * explicitly (being registered) or implicitly (by a - * derived element). */ + const char *name, /* Name of the element. */ + int create) /* Boolean, whether the element is being + * created explicitly (being registered) or + * implicitly (by a derived element). */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr, *engineEntryPtr; Tcl_HashSearch search; - int newEntry; - int elementId, genericId = -1; + int newEntry, elementId, genericId = -1; char *dot; StyleEngine *enginePtr; @@ -642,7 +639,7 @@ CreateElement( } elementId = tsdPtr->nbElements++; - Tcl_SetHashValue(entryPtr, (ClientData) INT2PTR(elementId)); + Tcl_SetHashValue(entryPtr, INT2PTR(elementId)); /* * Reallocate element table. @@ -660,7 +657,7 @@ CreateElement( engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (engineEntryPtr != NULL) { - enginePtr = (StyleEngine *) Tcl_GetHashValue(engineEntryPtr); + enginePtr = Tcl_GetHashValue(engineEntryPtr); enginePtr->elements = (StyledElement *) ckrealloc( (char *) enginePtr->elements, @@ -691,9 +688,9 @@ CreateElement( int Tk_GetElementId( - CONST char *name) /* Name of the element. */ + const char *name) /* Name of the element. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int genericId = -1; @@ -851,7 +848,7 @@ GetStyledElement( int elementId) /* Unique element ID */ { StyledElement *elementPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); StyleEngine *enginePtr2; @@ -912,7 +909,7 @@ InitWidgetSpec( { int i, nbOptions; Tk_ElementOptionSpec *elementOptionPtr; - CONST Tk_OptionSpec *widgetOptionPtr; + const Tk_OptionSpec *widgetOptionPtr; widgetSpecPtr->elementPtr = elementPtr; widgetSpecPtr->optionTable = optionTable; @@ -930,7 +927,7 @@ InitWidgetSpec( * Build the widget option list. */ - widgetSpecPtr->optionsPtr = (CONST Tk_OptionSpec **) + widgetSpecPtr->optionsPtr = (const Tk_OptionSpec **) ckalloc(sizeof(Tk_OptionSpec *) * nbOptions); for (i = 0, elementOptionPtr = elementPtr->specPtr->options; i < nbOptions; i++, elementOptionPtr++) { @@ -1232,12 +1229,12 @@ Tk_DrawElement( Tk_Style Tk_CreateStyle( - CONST char *name, /* Name of the style to create. NULL or empty + const char *name, /* Name of the style to create. NULL or empty * means the default system style. */ Tk_StyleEngine engine, /* The style engine. */ ClientData clientData) /* Private data passed as is to engine code. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -1263,10 +1260,9 @@ Tk_CreateStyle( stylePtr = (Style *) ckalloc(sizeof(Style)); InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), - (engine != NULL ? (StyleEngine *) engine : - tsdPtr->defaultEnginePtr), + (engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr), clientData); - Tcl_SetHashValue(entryPtr, (ClientData) stylePtr); + Tcl_SetHashValue(entryPtr, stylePtr); return (Tk_Style) stylePtr; } @@ -1290,7 +1286,7 @@ Tk_CreateStyle( *--------------------------------------------------------------------------- */ -CONST char * +const char * Tk_NameOfStyle( Tk_Style style) /* Style whose name is desired. */ { @@ -1318,7 +1314,7 @@ Tk_NameOfStyle( static void InitStyle( Style *stylePtr, /* Points to an uninitialized style. */ - CONST char *name, /* Name of the registered style. NULL or empty + const char *name, /* Name of the registered style. NULL or empty * means the default system style. Usually * points to the hash key. */ StyleEngine *enginePtr, /* The style engine. */ @@ -1350,10 +1346,10 @@ InitStyle( Tk_Style Tk_GetStyle( Tcl_Interp *interp, /* Interp for error return. */ - CONST char *name) /* Name of the style to retrieve. NULL or empty + const char *name) /* Name of the style to retrieve. NULL or empty * means the default system style. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; Style *stylePtr; @@ -1370,7 +1366,7 @@ Tk_GetStyle( } return (Tk_Style) NULL; } - stylePtr = (Style *) Tcl_GetHashValue(entryPtr); + stylePtr = Tcl_GetHashValue(entryPtr); return (Tk_Style) stylePtr; } @@ -1417,10 +1413,8 @@ Tk_AllocStyleFromObj( if (objPtr->typePtr != &styleObjType) { SetStyleFromAny(interp, objPtr); - stylePtr = (Style *) objPtr->internalRep.otherValuePtr; - } else { - stylePtr = (Style *) objPtr->internalRep.otherValuePtr; } + stylePtr = objPtr->internalRep.otherValuePtr; return (Tk_Style) stylePtr; } @@ -1452,7 +1446,7 @@ Tk_GetStyleFromObj( SetStyleFromAny(NULL, objPtr); } - return (Tk_Style) objPtr->internalRep.otherValuePtr; + return objPtr->internalRep.otherValuePtr; } /* @@ -1507,7 +1501,7 @@ SetStyleFromAny( } objPtr->typePtr = &styleObjType; - objPtr->internalRep.otherValuePtr = (VOID *) Tk_GetStyle(interp, name); + objPtr->internalRep.otherValuePtr = Tk_GetStyle(interp, name); return TCL_OK; } @@ -1551,7 +1545,8 @@ DupStyleObjProc( Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { dupObjPtr->typePtr = srcObjPtr->typePtr; - dupObjPtr->internalRep.otherValuePtr=srcObjPtr->internalRep.otherValuePtr; + dupObjPtr->internalRep.otherValuePtr = + srcObjPtr->internalRep.otherValuePtr; } /* diff --git a/generic/tkTest.c b/generic/tkTest.c index 432f5f7..b294022 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkTest.c,v 1.35 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkTest.c,v 1.36 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -61,7 +61,7 @@ typedef struct TImageInstance { */ static int ImageCreate(Tcl_Interp *interp, - char *name, int argc, Tcl_Obj *CONST objv[], + char *name, int argc, Tcl_Obj *const objv[], Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *clientDataPtr); static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); @@ -103,7 +103,7 @@ static NewApp *newAppPtr = NULL;/* First in list of all new interpreters. */ extern int SquareObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); typedef struct CBinding { Tcl_Interp *interp; @@ -144,39 +144,39 @@ static int CBindingEvalProc(ClientData clientData, static void CBindingFreeProc(ClientData clientData); int Tktest_Init(Tcl_Interp *interp); static int ImageCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); static int TestcbindCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); static int TestbitmapObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int TestborderObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int TestcolorObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int TestcursorObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int TestdeleteappsCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); static int TestfontObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int TestmakeexistCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) static int TestmenubarCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); #endif #if defined(__WIN32__) || defined(MAC_OSX_TK) static int TestmetricsCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); #endif static int TestobjconfigObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static int CustomOptionSet(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, char *recordPtr, @@ -191,15 +191,15 @@ static void CustomOptionRestore(ClientData clientData, static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); #if !(defined(__WIN32__) || defined(MAC_OSX_TK)) static int TestwrapperCmd(ClientData dummy, - Tcl_Interp *interp, int argc, CONST char **argv); + Tcl_Interp *interp, int argc, const char **argv); #endif static void TrivialCmdDeletedProc(ClientData clientData); static int TrivialConfigObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, - Tcl_Obj * CONST objv[]); + Tcl_Obj * const objv[]); static void TrivialEventProc(ClientData clientData, XEvent *eventPtr); @@ -334,7 +334,7 @@ TestcbindCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { TkWindow *winPtr; Tk_Window tkwin; @@ -442,7 +442,7 @@ TestbitmapObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc < 2) { @@ -477,7 +477,7 @@ TestborderObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc < 2) { @@ -512,7 +512,7 @@ TestcolorObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "color"); @@ -546,7 +546,7 @@ TestcursorObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cursor"); @@ -581,7 +581,7 @@ TestdeleteappsCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { NewApp *nextPtr; @@ -618,9 +618,9 @@ TestobjconfigObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *options[] = { + static const char *options[] = { "alltypes", "chain1", "chain2", "configerror", "delete", "info", "internal", "new", "notenoughparams", "twowindows", NULL }; @@ -1249,10 +1249,10 @@ TrivialConfigObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int result = TCL_OK; - static CONST char *options[] = { + static const char *options[] = { "cget", "configure", "csave", NULL }; enum { @@ -1432,9 +1432,9 @@ TestfontObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { - static CONST char *options[] = {"counts", "subfonts", NULL}; + static const char *options[] = {"counts", "subfonts", NULL}; enum option {COUNTS, SUBFONTS}; int index; Tk_Window tkwin; @@ -1493,7 +1493,7 @@ ImageCreate( * image. */ char *name, /* Name to use for image. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument strings for options (doesn't + Tcl_Obj *const objv[], /* Argument strings for options (doesn't * include image name or type). */ Tk_ImageType *typePtr, /* Pointer to our type record (not used). */ Tk_ImageMaster master, /* Token for image, to be used by us in later @@ -1558,7 +1558,7 @@ ImageCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { TImageMaster *timPtr = (TImageMaster *) clientData; int x, y, width, height; @@ -1779,7 +1779,7 @@ TestmakeexistCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { Tk_Window mainWin = (Tk_Window) clientData; int i; @@ -1821,7 +1821,7 @@ TestmenubarCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { #ifdef __UNIX__ Tk_Window mainWin = (Tk_Window) clientData; @@ -1890,7 +1890,7 @@ TestmetricsCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { char buf[TCL_INTEGER_SPACE]; int val; @@ -1963,7 +1963,7 @@ TestpropCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { Tk_Window mainWin = (Tk_Window) clientData; int result, actualFormat; @@ -2043,7 +2043,7 @@ TestwrapperCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { TkWindow *winPtr, *wrapperPtr; Tk_Window tkwin; diff --git a/generic/tkText.c b/generic/tkText.c index 0032ad5..97ce974 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkText.c,v 1.79 2007/12/13 15:24:16 dgp Exp $ + * RCS: @(#) $Id: tkText.c,v 1.80 2008/04/27 22:38:58 dkf Exp $ */ #include "default.h" @@ -331,13 +331,13 @@ int tkTextDebug = 0; */ static int ConfigureText(Tcl_Interp *interp, - TkText *textPtr, int objc, Tcl_Obj *CONST objv[]); + TkText *textPtr, int objc, Tcl_Obj *const objv[]); static int DeleteIndexRange(TkSharedText *sharedPtr, - TkText *textPtr, CONST TkTextIndex *indexPtr1, - CONST TkTextIndex *indexPtr2, int viewUpdate); -static int CountIndices(CONST TkText *textPtr, - CONST TkTextIndex *indexPtr1, - CONST TkTextIndex *indexPtr2, + TkText *textPtr, const TkTextIndex *indexPtr1, + const TkTextIndex *indexPtr2, int viewUpdate); +static int CountIndices(const TkText *textPtr, + const TkTextIndex *indexPtr1, + const TkTextIndex *indexPtr2, TkTextCountType type); static void DestroyText(TkText *textPtr); static int InsertChars(TkSharedText *sharedTextPtr, @@ -346,58 +346,58 @@ static int InsertChars(TkSharedText *sharedTextPtr, static void TextBlinkProc(ClientData clientData); static void TextCmdDeletedProc(ClientData clientData); static int CreateWidget(TkSharedText *sharedPtr, Tk_Window tkwin, - Tcl_Interp *interp, CONST TkText *parent, - int objc, Tcl_Obj *CONST objv[]); + Tcl_Interp *interp, const TkText *parent, + int objc, Tcl_Obj *const objv[]); static void TextEventProc(ClientData clientData, XEvent *eventPtr); static int TextFetchSelection(ClientData clientData, int offset, char *buffer, int maxBytes); -static int TextIndexSortProc(CONST void *first, - CONST void *second); +static int TextIndexSortProc(const void *first, + const void *second); static int TextInsertCmd(TkSharedText *sharedTextPtr, TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[], - CONST TkTextIndex *indexPtr, int viewUpdate); + int objc, Tcl_Obj *const objv[], + const TkTextIndex *indexPtr, int viewUpdate); static int TextReplaceCmd(TkText *textPtr, Tcl_Interp *interp, - CONST TkTextIndex *indexFromPtr, - CONST TkTextIndex *indexToPtr, - int objc, Tcl_Obj *CONST objv[], int viewUpdate); + const TkTextIndex *indexFromPtr, + const TkTextIndex *indexToPtr, + int objc, Tcl_Obj *const objv[], int viewUpdate); static int TextSearchCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int TextEditCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int TextWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int SharedTextObjCmd(ClientData clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static void TextWorldChangedCallback(ClientData instanceData); static void TextWorldChanged(TkText *textPtr, int mask); static int TextDumpCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static int DumpLine(Tcl_Interp *interp, TkText *textPtr, int what, TkTextLine *linePtr, int start, int end, int lineno, Tcl_Obj *command); static int DumpSegment(TkText *textPtr, Tcl_Interp *interp, - CONST char *key, CONST char *value, - Tcl_Obj *command, CONST TkTextIndex *index, + const char *key, const char *value, + Tcl_Obj *command, const TkTextIndex *index, int what); static int TextEditUndo(TkText *textPtr); static int TextEditRedo(TkText *textPtr); -static Tcl_Obj * TextGetText(CONST TkText *textPtr, - CONST TkTextIndex *index1, - CONST TkTextIndex *index2, int visibleOnly); +static Tcl_Obj * TextGetText(const TkText *textPtr, + const TkTextIndex *index1, + const TkTextIndex *index2, int visibleOnly); static void GenerateModifiedEvent(TkText *textPtr); static void UpdateDirtyFlag(TkSharedText *sharedPtr); static void TextPushUndoAction(TkText *textPtr, Tcl_Obj *undoString, int insert, - CONST TkTextIndex *index1Ptr, - CONST TkTextIndex *index2Ptr); -static int TextSearchIndexInLine(CONST SearchSpec *searchSpecPtr, + const TkTextIndex *index1Ptr, + const TkTextIndex *index2Ptr); +static int TextSearchIndexInLine(const SearchSpec *searchSpecPtr, TkTextLine *linePtr, int byteIndex); static int TextPeerCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *CONST objv[]); + int objc, Tcl_Obj *const objv[]); static TkUndoProc TextUndoRedoCallback; /* @@ -441,7 +441,7 @@ Tk_TextObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = (Tk_Window) clientData; @@ -479,10 +479,10 @@ CreateWidget( TkSharedText *sharedPtr, /* Shared widget info, or NULL. */ Tk_Window tkwin, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ - CONST TkText *parent, /* If non-NULL then take default start, end + const TkText *parent, /* If non-NULL then take default start, end * from this parent. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register TkText *textPtr; Tk_OptionTable optionTable; @@ -679,13 +679,13 @@ TextWidgetObjCmd( ClientData clientData, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register TkText *textPtr = (TkText *) clientData; int result = TCL_OK; int index; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "bbox", "cget", "compare", "configure", "count", "debug", "delete", "dlineinfo", "dump", "edit", "get", "image", "index", "insert", "mark", "peer", "replace", "scan", "search", "see", "tag", "window", @@ -713,7 +713,7 @@ TextWidgetObjCmd( switch ((enum options) index) { case TEXT_BBOX: { int x, y, width, height; - CONST TkTextIndex *indexPtr; + const TkTextIndex *indexPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); @@ -757,8 +757,8 @@ TextWidgetObjCmd( break; case TEXT_COMPARE: { int relation, value; - CONST char *p; - CONST TkTextIndex *index1Ptr, *index2Ptr; + const char *p; + const TkTextIndex *index1Ptr, *index2Ptr; if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "index1 op index2"); @@ -818,7 +818,7 @@ TextWidgetObjCmd( } break; case TEXT_COUNT: { - CONST TkTextIndex *indexFromPtr, *indexToPtr; + const TkTextIndex *indexFromPtr, *indexToPtr; int i, found = 0, update = 0; Tcl_Obj *objPtr = NULL; @@ -841,7 +841,7 @@ TextWidgetObjCmd( for (i = 2; i < objc-2; i++) { int value, length; - CONST char *option = Tcl_GetStringFromObj(objv[i], &length); + const char *option = Tcl_GetStringFromObj(objv[i], &length); char c; if (length < 2 || option[0] != '-') { @@ -880,7 +880,7 @@ TextWidgetObjCmd( } if (compare > 0) { - CONST TkTextIndex *tmpPtr = indexFromPtr; + const TkTextIndex *tmpPtr = indexFromPtr; indexFromPtr = indexToPtr; indexToPtr = tmpPtr; @@ -1061,7 +1061,7 @@ TextWidgetObjCmd( * Simple case requires no predetermination of indices. */ - CONST TkTextIndex *indexPtr1, *indexPtr2; + const TkTextIndex *indexPtr1, *indexPtr2; /* * Parse the starting and stopping indices. @@ -1107,7 +1107,7 @@ TextWidgetObjCmd( */ for (i = 0; i < objc; i++) { - CONST TkTextIndex *indexPtr = + const TkTextIndex *indexPtr = TkTextGetIndexFromObj(interp, textPtr, objv[i]); if (indexPtr == NULL) { @@ -1198,7 +1198,7 @@ TextWidgetObjCmd( break; case TEXT_DLINEINFO: { int x, y, width, height, base; - CONST TkTextIndex *indexPtr; + const TkTextIndex *indexPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); @@ -1233,7 +1233,7 @@ TextWidgetObjCmd( case TEXT_GET: { Tcl_Obj *objPtr = NULL; int i, found = 0, visible = 0; - CONST char *name; + const char *name; int length; if (objc < 3) { @@ -1264,7 +1264,7 @@ TextWidgetObjCmd( } for (; i < objc; i += 2) { - CONST TkTextIndex *index1Ptr, *index2Ptr; + const TkTextIndex *index1Ptr, *index2Ptr; TkTextIndex index2; index1Ptr = TkTextGetIndexFromObj(interp, textPtr, objv[i]); @@ -1328,7 +1328,7 @@ TextWidgetObjCmd( result = TkTextImageCmd(textPtr, interp, objc, objv); break; case TEXT_INDEX: { - CONST TkTextIndex *indexPtr; + const TkTextIndex *indexPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); @@ -1345,7 +1345,7 @@ TextWidgetObjCmd( break; } case TEXT_INSERT: { - CONST TkTextIndex *indexPtr; + const TkTextIndex *indexPtr; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1371,7 +1371,7 @@ TextWidgetObjCmd( result = TextPeerCmd(textPtr, interp, objc, objv); break; case TEXT_REPLACE: { - CONST TkTextIndex *indexFromPtr, *indexToPtr; + const TkTextIndex *indexFromPtr, *indexToPtr; if (objc < 5) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1530,13 +1530,13 @@ SharedTextObjCmd( ClientData clientData, /* Information about shared test B-tree. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register TkSharedText *sharedPtr = (TkSharedText *) clientData; int result = TCL_OK; int index; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "delete", "insert", NULL }; enum options { @@ -1636,12 +1636,12 @@ TextPeerCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = textPtr->tkwin; int index; - static CONST char *peerOptionStrings[] = { + static const char *peerOptionStrings[] = { "create", "names", NULL }; enum peerOptions { @@ -1710,12 +1710,12 @@ static int TextReplaceCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - CONST TkTextIndex *indexFromPtr, + const TkTextIndex *indexFromPtr, /* Index from which to replace. */ - CONST TkTextIndex *indexToPtr, + const TkTextIndex *indexToPtr, /* Index to which to replace. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ + Tcl_Obj *const objv[], /* Argument objects. */ int viewUpdate) /* Update vertical view if set. */ { /* @@ -1780,8 +1780,8 @@ TextReplaceCmd( static int TextIndexSortProc( - CONST void *first, /* Elements to be compared. */ - CONST void *second) + const void *first, /* Elements to be compared. */ + const void *second) { TkTextIndex *pair1 = (TkTextIndex *) first; TkTextIndex *pair2 = (TkTextIndex *) second; @@ -1997,7 +1997,7 @@ ConfigureText( register TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_SavedOptions savedOptions; int oldExport = textPtr->exportSelection; @@ -2508,7 +2508,7 @@ InsertChars( int resetViewCount; int pixels[2*PIXEL_CLIENTS]; - CONST char *string = Tcl_GetStringFromObj(stringPtr, &length); + const char *string = Tcl_GetStringFromObj(stringPtr, &length); if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; @@ -2640,9 +2640,9 @@ TextPushUndoAction( TkText *textPtr, /* Overall information about text widget. */ Tcl_Obj *undoString, /* New text. */ int insert, /* 1 if insert, else delete. */ - CONST TkTextIndex *index1Ptr, + const TkTextIndex *index1Ptr, /* Index describing first location. */ - CONST TkTextIndex *index2Ptr) + const TkTextIndex *index2Ptr) /* Index describing second location. */ { TkUndoSubAtom *iAtom, *dAtom; @@ -2864,11 +2864,11 @@ TextUndoRedoCallback( static int CountIndices( - CONST TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *indexPtr1, + const TkText *textPtr, /* Overall information about text widget. */ + const TkTextIndex *indexPtr1, /* Index describing location of first * character to delete. */ - CONST TkTextIndex *indexPtr2, + const TkTextIndex *indexPtr2, /* Index describing location of last character * to delete. NULL means just delete the one * character given by indexPtr1. */ @@ -2921,10 +2921,10 @@ static int DeleteIndexRange( TkSharedText *sharedTextPtr,/* Shared portion of peer widgets. */ TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *indexPtr1, + const TkTextIndex *indexPtr1, /* Index describing location of first * character (or other entity) to delete. */ - CONST TkTextIndex *indexPtr2, + const TkTextIndex *indexPtr2, /* Index describing location of last * character (or other entity) to delete. * NULL means just delete the one character @@ -3491,8 +3491,8 @@ TextInsertCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[], /* Argument objects. */ - CONST TkTextIndex *indexPtr,/* Index at which to insert. */ + Tcl_Obj *const objv[], /* Argument objects. */ + const TkTextIndex *indexPtr,/* Index at which to insert. */ int viewUpdate) /* Update the view if set. */ { TkTextIndex index1, index2; @@ -3536,7 +3536,7 @@ TextInsertCmd( int i; for (i = 0; i < numTags; i++) { - CONST char *strTag = Tcl_GetString(tagNamePtrs[i]); + const char *strTag = Tcl_GetString(tagNamePtrs[i]); TkBTreeTag(&index1, &index2, TkTextCreateTag(textPtr, strTag, NULL), 1); @@ -3570,12 +3570,12 @@ TextSearchCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int i, argsLeft, code; SearchSpec searchSpec; - static CONST char *switchStrings[] = { + static const char *switchStrings[] = { "--", "-all", "-backwards", "-count", "-elide", "-exact", "-forwards", "-hidden", "-nocase", "-nolinestop", "-overlap", "-regexp", "-strictlimits", NULL @@ -3787,7 +3787,7 @@ TextSearchGetLineIndex( int *offsetPosPtr) /* For returning the text offset in the * line. */ { - CONST TkTextIndex *indexPtr; + const TkTextIndex *indexPtr; int line; TkText *textPtr = (TkText *) searchSpecPtr->clientData; @@ -3846,7 +3846,7 @@ TextSearchGetLineIndex( static int TextSearchIndexInLine( - CONST SearchSpec *searchSpecPtr, + const SearchSpec *searchSpecPtr, /* Search parameters. */ TkTextLine *linePtr, /* The line we're looking at. */ int byteIndex) /* Index into the line. */ @@ -4066,7 +4066,7 @@ TextSearchFoundMatch( */ if (searchSpecPtr->exact) { - CONST char *startOfLine = Tcl_GetString(theLine); + const char *startOfLine = Tcl_GetString(theLine); numChars = Tcl_NumUtfChars(startOfLine + matchOffset, matchLength); } else { @@ -4277,7 +4277,7 @@ TkTextGetTabs( /* * Map these strings to TkTextTabAlign values. */ - static CONST char *tabOptionStrings[] = { + static const char *tabOptionStrings[] = { "left", "right", "center", "numeric", NULL }; @@ -4431,7 +4431,7 @@ TextDumpCmd( register TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "dump". */ { @@ -4449,7 +4449,7 @@ TextDumpCmd( #define TK_DUMP_IMG 0x10 #define TK_DUMP_ALL (TK_DUMP_TEXT|TK_DUMP_MARK|TK_DUMP_TAG| \ TK_DUMP_WIN|TK_DUMP_IMG) - static CONST char *optStrings[] = { + static const char *optStrings[] = { "-all", "-command", "-image", "-mark", "-tag", "-text", "-window", NULL }; @@ -4816,10 +4816,10 @@ static int DumpSegment( TkText *textPtr, Tcl_Interp *interp, - CONST char *key, /* Segment type key. */ - CONST char *value, /* Segment value. */ + const char *key, /* Segment type key. */ + const char *value, /* Segment value. */ Tcl_Obj *command, /* Script callback. */ - CONST TkTextIndex *index, /* index with line/byte position info. */ + const TkTextIndex *index, /* index with line/byte position info. */ int what) /* Look for TK_DUMP_INDEX bit. */ { char buffer[TK_POS_CHARS]; @@ -4831,7 +4831,7 @@ DumpSegment( Tcl_AppendElement(interp, buffer); return 0; } else { - CONST char *argv[4]; + const char *argv[4]; char *list; int oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); @@ -4956,11 +4956,11 @@ TextEditCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int index; - static CONST char *editOptionStrings[] = { + static const char *editOptionStrings[] = { "modified", "redo", "reset", "separator", "undo", NULL }; enum editOptions { @@ -5080,10 +5080,10 @@ TextEditCmd( static Tcl_Obj * TextGetText( - CONST TkText *textPtr, /* Information about text widget. */ - CONST TkTextIndex *indexPtr1, + const TkText *textPtr, /* Information about text widget. */ + const TkTextIndex *indexPtr1, /* Get text from this index... */ - CONST TkTextIndex *indexPtr2, + const TkTextIndex *indexPtr2, /* ...to this index. */ int visibleOnly) /* If non-zero, then only return non-elided * characters. */ @@ -5251,7 +5251,7 @@ SearchPerform( */ if (toPtr != NULL) { - CONST TkTextIndex *indexToPtr, *indexFromPtr; + const TkTextIndex *indexToPtr, *indexFromPtr; TkText *textPtr = (TkText *) searchSpecPtr->clientData; indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr); @@ -5345,7 +5345,7 @@ SearchCore( Tcl_Obj *theLine; int alreadySearchOffset = -1; - CONST char *pattern = NULL; /* For exact searches only. */ + const char *pattern = NULL; /* For exact searches only. */ int firstNewLine = -1; /* For exact searches only. */ Tcl_RegExp regexp = NULL; /* For regexp searches only. */ @@ -5403,7 +5403,7 @@ SearchCore( */ if (searchSpecPtr->exact) { - CONST char *nl; + const char *nl; /* * We only need to set the matchLength once for exact searches, and we @@ -5540,11 +5540,11 @@ SearchCore( if (searchSpecPtr->exact) { int maxExtraLines = 0; - CONST char *startOfLine = Tcl_GetString(theLine); + const char *startOfLine = Tcl_GetString(theLine); do { Tcl_UniChar ch; - CONST char *p; + const char *p; int lastFullLine = lastOffset; if (firstNewLine == -1) { @@ -5569,7 +5569,7 @@ SearchCore( * match. */ - CONST char c = pattern[0]; + const char c = pattern[0]; if (alreadySearchOffset != -1) { p = startOfLine + alreadySearchOffset; @@ -6515,7 +6515,7 @@ TkpTesttextCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { TkText *textPtr; size_t len; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index c8c8606..995b3e8 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.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: tkTextDisp.c,v 1.68 2007/12/13 15:24:17 dgp Exp $ + * RCS: @(#) $Id: tkTextDisp.c,v 1.69 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -542,23 +542,23 @@ static void DisplayDLine(TkText *textPtr, DLine *dlPtr, static void DisplayLineBackground(TkText *textPtr, DLine *dlPtr, DLine *prevPtr, Pixmap pixmap); static void DisplayText(ClientData clientData); -static DLine * FindDLine(DLine *dlPtr, CONST TkTextIndex *indexPtr); +static DLine * FindDLine(DLine *dlPtr, const TkTextIndex *indexPtr); static void FreeDLines(TkText *textPtr, DLine *firstPtr, DLine *lastPtr, int action); static void FreeStyle(TkText *textPtr, TextStyle *stylePtr); -static TextStyle * GetStyle(TkText *textPtr, CONST TkTextIndex *indexPtr); +static TextStyle * GetStyle(TkText *textPtr, const TkTextIndex *indexPtr); static void GetXView(Tcl_Interp *interp, TkText *textPtr, int report); static void GetYView(Tcl_Interp *interp, TkText *textPtr, int report); static int GetYPixelCount(TkText *textPtr, DLine *dlPtr); static DLine * LayoutDLine(TkText *textPtr, - CONST TkTextIndex *indexPtr); -static int MeasureChars(Tk_Font tkfont, CONST char *source, + const TkTextIndex *indexPtr); +static int MeasureChars(Tk_Font tkfont, const char *source, int maxBytes, int rangeStart, int rangeLength, int startX, int maxX, int flags, int *nextXPtr); static void MeasureUp(TkText *textPtr, - CONST TkTextIndex *srcPtr, int distance, + const TkTextIndex *srcPtr, int distance, TkTextIndex *dstPtr, int *overlap); static int NextTabStop(Tk_Font tkfont, int x, int tabOrigin); static void UpdateDisplayInfo(TkText *textPtr); @@ -568,8 +568,8 @@ static int SizeOfTab(TkText *textPtr, int tabStyle, TkTextTabArray *tabArrayPtr, int *indexPtr, int x, int maxX); static void TextChanged(TkText *textPtr, - CONST TkTextIndex *index1Ptr, - CONST TkTextIndex *index2Ptr); + const TkTextIndex *index1Ptr, + const TkTextIndex *index2Ptr); static void TextInvalidateRegion(TkText *textPtr, TkRegion region); static void TextRedrawTag(TkText *textPtr, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr, @@ -577,7 +577,7 @@ static void TextRedrawTag(TkText *textPtr, static void TextInvalidateLineMetrics(TkText *textPtr, TkTextLine *linePtr, int lineCount, int action); static int CalculateDisplayLineHeight(TkText *textPtr, - CONST TkTextIndex *indexPtr, int *byteCountPtr, + const TkTextIndex *indexPtr, int *byteCountPtr, int *mergedLinePtr); static void DlineIndexOfX(TkText *textPtr, DLine *dlPtr, int x, TkTextIndex *indexPtr); @@ -585,7 +585,7 @@ static int DlineXOfIndex(TkText *textPtr, DLine *dlPtr, int byteIndex); static int TextGetScrollInfoObj(Tcl_Interp *interp, TkText *textPtr, int objc, - Tcl_Obj *CONST objv[], double *dblPtr, + Tcl_Obj *const objv[], double *dblPtr, int *intPtr); static void AsyncUpdateLineMetrics(ClientData clientData); static void AsyncUpdateYScrollbar(ClientData clientData); @@ -742,7 +742,7 @@ TkTextFreeDInfo( static TextStyle * GetStyle( TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *indexPtr)/* The character in the text for which display + const TkTextIndex *indexPtr)/* The character in the text for which display * information is wanted. */ { TkTextTag **tagPtrs; @@ -1047,7 +1047,7 @@ FreeStyle( static DLine * LayoutDLine( TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *indexPtr)/* Beginning of display line. May not + const TkTextIndex *indexPtr)/* Beginning of display line. May not * necessarily point to a character * segment. */ { @@ -3518,7 +3518,7 @@ TkTextFindDisplayLineEnd( static int CalculateDisplayLineHeight( TkText *textPtr, /* Widget record for text widget. */ - CONST TkTextIndex *indexPtr,/* The index at the beginning of the display + const TkTextIndex *indexPtr,/* The index at the beginning of the display * line of interest. */ int *byteCountPtr, /* NULL or used to return the number of byte * indices on the given display line. */ @@ -3589,7 +3589,7 @@ CalculateDisplayLineHeight( int TkTextIndexYPixels( TkText *textPtr, /* Widget record for text widget. */ - CONST TkTextIndex *indexPtr)/* The index of which we want the pixel + const TkTextIndex *indexPtr)/* The index of which we want the pixel * distance from top of logical line to top of * index. */ { @@ -4510,8 +4510,8 @@ void TkTextChanged( TkSharedText *sharedTextPtr,/* Shared widget section, or NULL. */ TkText *textPtr, /* Widget record for text widget, or NULL. */ - CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */ - CONST TkTextIndex*index2Ptr)/* Index of character just after last one to + const TkTextIndex*index1Ptr,/* Index of first character to redisplay. */ + const TkTextIndex*index2Ptr)/* Index of character just after last one to * redisplay. */ { if (sharedTextPtr == NULL) { @@ -4528,8 +4528,8 @@ TkTextChanged( static void TextChanged( TkText *textPtr, /* Widget record for text widget, or NULL. */ - CONST TkTextIndex*index1Ptr,/* Index of first character to redisplay. */ - CONST TkTextIndex*index2Ptr)/* Index of character just after last one to + const TkTextIndex*index1Ptr,/* Index of first character to redisplay. */ + const TkTextIndex*index2Ptr)/* Index of character just after last one to * redisplay. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; @@ -5209,7 +5209,7 @@ TkTextMeasureDown( static void MeasureUp( TkText *textPtr, /* Text widget in which to measure. */ - CONST TkTextIndex *srcPtr, /* Index of character from which to start + const TkTextIndex *srcPtr, /* Index of character from which to start * measuring. */ int distance, /* Vertical distance in pixels measured from * the pixel just below the lowest one in @@ -5313,7 +5313,7 @@ TkTextSeeCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "see". */ { @@ -5442,7 +5442,7 @@ TkTextXviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "xview". */ { @@ -5725,7 +5725,7 @@ TkTextYviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "yview". */ { @@ -5751,7 +5751,7 @@ TkTextYviewCmd( pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { - register CONST char *switchStr = + register const char *switchStr = Tcl_GetStringFromObj(objv[2], &switchLength); if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", @@ -5906,7 +5906,7 @@ TkTextScanCmd( register TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "scan". */ { @@ -6414,7 +6414,7 @@ static DLine * FindDLine( register DLine *dlPtr, /* Pointer to first in list of DLines to * search. */ - CONST TkTextIndex *indexPtr)/* Index of desired character. */ + const TkTextIndex *indexPtr)/* Index of desired character. */ { TkTextLine *linePtr; @@ -6784,7 +6784,7 @@ DlineXOfIndex( int TkTextIndexBbox( TkText *textPtr, /* Widget record for text widget. */ - CONST TkTextIndex *indexPtr,/* Index whose bounding box is desired. */ + const TkTextIndex *indexPtr,/* Index whose bounding box is desired. */ int *xPtr, int *yPtr, /* Filled with index's upper-left * coordinate. */ int *widthPtr, int *heightPtr, @@ -6914,7 +6914,7 @@ TkTextIndexBbox( int TkTextDLineInfo( TkText *textPtr, /* Widget record for text widget. */ - CONST TkTextIndex *indexPtr,/* Index of character whose bounding box is + const TkTextIndex *indexPtr,/* Index of character whose bounding box is * desired. */ int *xPtr, int *yPtr, /* Filled with line's upper-left * coordinate. */ @@ -8054,7 +8054,7 @@ NextTabStop( static int MeasureChars( Tk_Font tkfont, /* Font in which to draw characters. */ - CONST char *source, /* Characters to be displayed. Need not be + const char *source, /* Characters to be displayed. Need not be * NULL-terminated. */ int maxBytes, /* Maximum # of bytes to consider from * source. */ @@ -8069,7 +8069,7 @@ MeasureChars( * here. */ { int curX, width, ch; - CONST char *special, *end, *start; + const char *special, *end, *start; ch = 0; /* lint. */ curX = startX; @@ -8161,19 +8161,19 @@ TextGetScrollInfoObj( Tcl_Interp *interp, /* Used for error reporting. */ TkText *textPtr, /* Information about the text widget. */ int objc, /* # arguments for command. */ - Tcl_Obj *CONST objv[], /* Arguments for command. */ + Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines or * pixels to scroll, if any. */ { - static CONST char *subcommands[] = { + static const char *subcommands[] = { "moveto", "scroll", NULL }; enum viewSubcmds { VIEW_MOVETO, VIEW_SCROLL }; - static CONST char *units[] = { + static const char *units[] = { "units", "pages", "pixels", NULL }; enum viewUnits { diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 4219feb..e1d58e8 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.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: tkTextIndex.c,v 1.28 2007/12/13 15:24:17 dgp Exp $ + * RCS: @(#) $Id: tkTextIndex.c,v 1.29 2008/04/27 22:38:58 dkf Exp $ */ #include "default.h" @@ -35,12 +35,12 @@ * Forward declarations for functions defined later in this file: */ -static CONST char * ForwBack(TkText *textPtr, CONST char *string, +static const char * ForwBack(TkText *textPtr, const char *string, TkTextIndex *indexPtr); -static CONST char * StartEnd(TkText *textPtr, CONST char *string, +static const char * StartEnd(TkText *textPtr, const char *string, TkTextIndex *indexPtr); static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, - TkText *textPtr, CONST char *string, + TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); /* @@ -63,7 +63,7 @@ static void UpdateStringOfTextIndex(Tcl_Obj *objPtr); #define GET_INDEXEPOCH(objPtr) \ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2)) #define SET_TEXTINDEX(objPtr, indexPtr) \ - ((objPtr)->internalRep.twoPtrValue.ptr1 = (VOID *) (indexPtr)) + ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr)) #define SET_INDEXEPOCH(objPtr, epoch) \ ((objPtr)->internalRep.twoPtrValue.ptr2 = INT2PTR(epoch)) @@ -131,7 +131,7 @@ UpdateStringOfTextIndex( char buffer[TK_POS_CHARS]; register int len; - CONST TkTextIndex *indexPtr = GET_TEXTINDEX(objPtr); + const TkTextIndex *indexPtr = GET_TEXTINDEX(objPtr); len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer); @@ -181,7 +181,7 @@ MakeObjIndex( TkText *textPtr, /* Information about text widget. */ Tcl_Obj *objPtr, /* Object containing description of * position. */ - CONST TkTextIndex *origPtr) /* Pointer to index. */ + const TkTextIndex *origPtr) /* Pointer to index. */ { TkTextIndex *indexPtr = (TkTextIndex *) ckalloc(sizeof(TkTextIndex)); @@ -201,7 +201,7 @@ MakeObjIndex( return indexPtr; } -CONST TkTextIndex * +const TkTextIndex * TkTextGetIndexFromObj( Tcl_Interp *interp, /* Use this for error reporting. */ TkText *textPtr, /* Information about text widget. */ @@ -269,7 +269,7 @@ TkTextGetIndexFromObj( Tcl_Obj * TkTextNewIndexObj( TkText *textPtr, /* Text widget for this index */ - CONST TkTextIndex *indexPtr)/* Pointer to index. */ + const TkTextIndex *indexPtr)/* Pointer to index. */ { Tcl_Obj *retVal; @@ -385,7 +385,7 @@ TkTextIndex * TkTextMakeByteIndex( TkTextBTree tree, /* Tree that lineIndex and byteIndex refer * to. */ - CONST TkText *textPtr, + const TkText *textPtr, int lineIndex, /* Index of desired line (0 means first line * of text). */ int byteIndex, /* Byte index of desired character. */ @@ -393,7 +393,7 @@ TkTextMakeByteIndex( { TkTextSegment *segPtr; int index; - CONST char *p, *start; + const char *p, *start; Tcl_UniChar ch; indexPtr->tree = tree; @@ -437,7 +437,7 @@ TkTextMakeByteIndex( if ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) { /* * Prevent UTF-8 character from being split up by ensuring - * that byteIndex falls on a character boundary. If index + * that byteIndex falls on a character boundary. If the index * falls in the middle of a UTF-8 character, it will be * adjusted to the end of that UTF-8 character. */ @@ -571,7 +571,7 @@ TkTextMakeCharIndex( TkTextSegment * TkTextIndexToSeg( - CONST TkTextIndex *indexPtr,/* Text index. */ + const TkTextIndex *indexPtr,/* Text index. */ int *offsetPtr) /* Where to store offset within segment, or * NULL if offset isn't wanted. */ { @@ -609,10 +609,10 @@ TkTextIndexToSeg( int TkTextSegToOffset( - CONST TkTextSegment *segPtr,/* Segment whose offset is desired. */ - CONST TkTextLine *linePtr) /* Line containing segPtr. */ + const TkTextSegment *segPtr,/* Segment whose offset is desired. */ + const TkTextLine *linePtr) /* Line containing segPtr. */ { - CONST TkTextSegment *segPtr2; + const TkTextSegment *segPtr2; int offset = 0; for (segPtr2 = linePtr->segPtr; segPtr2 != segPtr; @@ -703,7 +703,7 @@ int TkTextGetIndex( Tcl_Interp *interp, /* Use this for error reporting. */ TkText *textPtr, /* Information about text widget. */ - CONST char *string, /* Textual description of position. */ + const char *string, /* Textual description of position. */ TkTextIndex *indexPtr) /* Index structure to fill in. */ { return GetIndex(interp, NULL, textPtr, string, indexPtr, NULL); @@ -737,7 +737,7 @@ GetIndex( Tcl_Interp *interp, /* Use this for error reporting. */ TkSharedText *sharedPtr, TkText *textPtr, /* Information about text widget. */ - CONST char *string, /* Textual description of position. */ + const char *string, /* Textual description of position. */ TkTextIndex *indexPtr, /* Index structure to fill in. */ int *canCachePtr) /* Pointer to integer to store whether we can * cache the index (or NULL). */ @@ -746,7 +746,7 @@ GetIndex( TkTextIndex first, last; int wantLast, result; char c; - CONST char *cp; + const char *cp; Tcl_DString copy; int canCache = 0; @@ -788,7 +788,7 @@ GetIndex( TkTextSearch search; TkTextTag *tagPtr; Tcl_HashEntry *hPtr = NULL; - CONST char *tagName; + const char *tagName; if ((p[1] == 'f') && (strncmp(p+1, "first", 5) == 0)) { wantLast = 0; @@ -813,7 +813,7 @@ GetIndex( hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName); *p = '.'; if (hPtr != NULL) { - tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr); + tagPtr = Tcl_GetHashValue(hPtr); } } @@ -1022,8 +1022,8 @@ GetIndex( int TkTextPrintIndex( - CONST TkText *textPtr, - CONST TkTextIndex *indexPtr,/* Pointer to index. */ + const TkText *textPtr, + const TkTextIndex *indexPtr,/* Pointer to index. */ char *string) /* Place to store the position. Must have at * least TK_POS_CHARS characters. */ { @@ -1086,8 +1086,8 @@ TkTextPrintIndex( int TkTextIndexCmp( - CONST TkTextIndex*index1Ptr,/* First index. */ - CONST TkTextIndex*index2Ptr)/* Second index. */ + const TkTextIndex*index1Ptr,/* First index. */ + const TkTextIndex*index2Ptr)/* Second index. */ { int line1, line2; @@ -1139,15 +1139,15 @@ TkTextIndexCmp( *--------------------------------------------------------------------------- */ -static CONST char * +static const char * ForwBack( TkText *textPtr, /* Information about text widget. */ - CONST char *string, /* String to parse for additional info about + const char *string, /* String to parse for additional info about * modifier (count and units). Points to "+" * or "-" that starts modifier. */ TkTextIndex *indexPtr) /* Index to update as specified in string. */ { - register CONST char *p, *units; + register const char *p, *units; char *end; int count, lineIndex, modifier; size_t length; @@ -1387,8 +1387,8 @@ ForwBack( int TkTextIndexForwBytes( - CONST TkText *textPtr, - CONST TkTextIndex *srcPtr, /* Source index. */ + const TkText *textPtr, + const TkTextIndex *srcPtr, /* Source index. */ int byteCount, /* How many bytes forward to move. May be * negative. */ TkTextIndex *dstPtr) /* Destination index: gets modified. */ @@ -1459,8 +1459,8 @@ TkTextIndexForwBytes( void TkTextIndexForwChars( - CONST TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *srcPtr, /* Source index. */ + const TkText *textPtr, /* Overall information about text widget. */ + const TkTextIndex *srcPtr, /* Source index. */ int charCount, /* How many characters forward to move. May * be negative. */ TkTextIndex *dstPtr, /* Destination index: gets modified. */ @@ -1480,8 +1480,7 @@ TkTextIndexForwChars( return; } if (checkElided) { - infoPtr = (TkTextElideInfo *) - ckalloc((unsigned) sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, srcPtr, infoPtr); } @@ -1639,11 +1638,11 @@ TkTextIndexForwChars( int TkTextIndexCount( - CONST TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *indexPtr1, + const TkText *textPtr, /* Overall information about text widget. */ + const TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ - CONST TkTextIndex *indexPtr2, + const TkTextIndex *indexPtr2, /* Index describing location of last character * at which to stop the count. */ TkTextCountType type) /* The kind of indices to count. */ @@ -1665,8 +1664,7 @@ TkTextIndexCount( seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes); if (checkElided) { - infoPtr = (TkTextElideInfo *) - ckalloc((unsigned) sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *) ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, indexPtr1, infoPtr); } @@ -1835,8 +1833,8 @@ TkTextIndexCount( int TkTextIndexBackBytes( - CONST TkText *textPtr, - CONST TkTextIndex *srcPtr, /* Source index. */ + const TkText *textPtr, + const TkTextIndex *srcPtr, /* Source index. */ int byteCount, /* How many bytes backward to move. May be * negative. */ TkTextIndex *dstPtr) /* Destination index: gets modified. */ @@ -1905,8 +1903,8 @@ TkTextIndexBackBytes( void TkTextIndexBackChars( - CONST TkText *textPtr, /* Overall information about text widget. */ - CONST TkTextIndex *srcPtr, /* Source index. */ + const TkText *textPtr, /* Overall information about text widget. */ + const TkTextIndex *srcPtr, /* Source index. */ int charCount, /* How many characters backward to move. May * be negative. */ TkTextIndex *dstPtr, /* Destination index: gets modified. */ @@ -1915,7 +1913,7 @@ TkTextIndexBackChars( TkTextSegment *segPtr, *oldPtr; TkTextElideInfo *infoPtr = NULL; int lineIndex, segSize; - CONST char *p, *start, *end; + const char *p, *start, *end; int elide = 0; int checkElided = (type & COUNT_DISPLAY); @@ -2114,15 +2112,15 @@ TkTextIndexBackChars( *---------------------------------------------------------------------- */ -static CONST char * +static const char * StartEnd( TkText *textPtr, /* Information about text widget. */ - CONST char *string, /* String to parse for additional info about + const char *string, /* String to parse for additional info about * modifier (count and units). Points to first * character of modifer word. */ TkTextIndex *indexPtr) /* Index to modify based on string. */ { - CONST char *p; + const char *p; size_t length; register TkTextSegment *segPtr; int modifier; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 97929bd..b54ae3f 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.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: tkTextTag.c,v 1.27 2007/12/13 15:24:17 dgp Exp $ + * RCS: @(#) $Id: tkTextTag.c,v 1.28 2008/04/27 22:38:58 dkf Exp $ */ #include "default.h" @@ -101,7 +101,7 @@ static void ChangeTagPriority(TkText *textPtr, TkTextTag *tagPtr, static TkTextTag * FindTag(Tcl_Interp *interp, TkText *textPtr, Tcl_Obj *tagName); static void SortTags(int numTags, TkTextTag **tagArrayPtr); -static int TagSortProc(CONST VOID *first, CONST VOID *second); +static int TagSortProc(const void *first, const void *second); static void TagBindEvent(TkText *textPtr, XEvent *eventPtr, int numTags, TkTextTag **tagArrayPtr); @@ -128,11 +128,11 @@ TkTextTagCmd( register TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. Someone else has already + Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "tag". */ { - static CONST char *tagOptionStrings[] = { + static const char *tagOptionStrings[] = { "add", "bind", "cget", "configure", "delete", "lower", "names", "nextrange", "prevrange", "raise", "ranges", "remove", NULL }; @@ -225,7 +225,7 @@ TkTextTagCmd( if (addTag && textPtr->exportSelection && !(textPtr->flags & GOT_SELECTION)) { Tk_OwnSelection(textPtr->tkwin, XA_PRIMARY, - TkTextLostSelection, (ClientData) textPtr); + TkTextLostSelection, textPtr); textPtr->flags |= GOT_SELECTION; } textPtr->abortSelections = 1; @@ -285,13 +285,13 @@ TkTextTagCmd( return TCL_ERROR; } } else if (objc == 5) { - CONST char *command; + const char *command; command = Tk_GetBinding(interp, textPtr->sharedTextPtr->bindingTable, (ClientData) tagPtr->name, Tcl_GetString(objv[4])); if (command == NULL) { - CONST char *string = Tcl_GetStringResult(interp); + const char *string = Tcl_GetStringResult(interp); /* * Ignore missing binding errors. This is a special hack that @@ -541,7 +541,7 @@ TkTextTagCmd( continue; } - tagPtr = (TkTextTag *) Tcl_GetHashValue(hPtr); + tagPtr = Tcl_GetHashValue(hPtr); if (tagPtr == textPtr->selTagPtr) { continue; } @@ -607,7 +607,7 @@ TkTextTagCmd( for (i=0, hPtr = Tcl_FirstHashEntry( &textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - arrayPtr[i] = (TkTextTag *) Tcl_GetHashValue(hPtr); + arrayPtr[i] = Tcl_GetHashValue(hPtr); } /* @@ -928,14 +928,14 @@ TkTextTagCmd( TkTextTag * TkTextCreateTag( TkText *textPtr, /* Widget in which tag is being used. */ - CONST char *tagName, /* Name of desired tag. */ + const char *tagName, /* Name of desired tag. */ int *newTag) /* If non-NULL, then return 1 if new, or 0 if * already exists. */ { register TkTextTag *tagPtr; Tcl_HashEntry *hPtr = NULL; int isNew; - CONST char *name; + const char *name; if (!strcmp(tagName, "sel")) { if (textPtr->selTagPtr != NULL) { @@ -955,7 +955,7 @@ TkTextCreateTag( *newTag = isNew; } if (!isNew) { - return (TkTextTag *) Tcl_GetHashValue(hPtr); + return Tcl_GetHashValue(hPtr); } name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr); } @@ -1048,7 +1048,7 @@ FindTag( { Tcl_HashEntry *hPtr; int len; - CONST char *str; + const char *str; str = Tcl_GetStringFromObj(tagName, &len); if (len == 3 && !strcmp(str,"sel")) { @@ -1057,7 +1057,7 @@ FindTag( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(tagName)); if (hPtr != NULL) { - return (TkTextTag *) Tcl_GetHashValue(hPtr); + return Tcl_GetHashValue(hPtr); } if (interp != NULL) { Tcl_AppendResult(interp, "tag \"", Tcl_GetString(tagName), @@ -1279,8 +1279,8 @@ SortTags( static int TagSortProc( - CONST void *first, - CONST void *second) /* Elements to be compared. */ + const void *first, + const void *second) /* Elements to be compared. */ { TkTextTag *tagPtr1, *tagPtr2; @@ -1349,7 +1349,7 @@ ChangeTagPriority( } for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - tagPtr2 = (TkTextTag *) Tcl_GetHashValue(hPtr); + tagPtr2 = Tcl_GetHashValue(hPtr); if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) { tagPtr2->priority += delta; } @@ -1380,7 +1380,7 @@ TkTextBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkText *textPtr = (TkText *) clientData; + TkText *textPtr = clientData; int repick = 0; # define AnyButtonMask \ @@ -1687,8 +1687,8 @@ TagBindEvent( TkTextTag **tagArrayPtr) /* Array of relevant tags. */ { #define NUM_BIND_TAGS 10 - CONST char *nameArray[NUM_BIND_TAGS]; - CONST char **nameArrPtr; + const char *nameArray[NUM_BIND_TAGS]; + const char **nameArrPtr; int i; /* @@ -1696,7 +1696,7 @@ TagBindEvent( */ if (numTags > NUM_BIND_TAGS) { - nameArrPtr = (CONST char **) ckalloc(numTags * sizeof(CONST char *)); + nameArrPtr = (const char **) ckalloc(numTags * sizeof(const char *)); } else { nameArrPtr = nameArray; } diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 1b880d1..e0e100a 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.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: tkVisual.c,v 1.10 2007/12/13 15:24:21 dgp Exp $ + * RCS: @(#) $Id: tkVisual.c,v 1.11 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -88,7 +88,7 @@ Visual * Tk_GetVisual( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which visual will be used. */ - CONST char *string, /* String describing visual. See manual entry + const char *string, /* String describing visual. See manual entry * for details. */ int *depthPtr, /* The depth of the returned visual is stored * here. */ @@ -103,7 +103,7 @@ Tk_GetVisual( Visual *visual; ptrdiff_t length; int c, numVisuals, prio, bestPrio, i; - CONST char *p; + const char *p; VisualDictionary *dictPtr; TkColormap *cmapPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -368,7 +368,7 @@ Colormap Tk_GetColormap( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window where colormap will be used. */ - CONST char *string) /* String that identifies colormap: either + const char *string) /* String that identifies colormap: either * "new" or the name of another window. */ { Colormap colormap; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index c73b950..8820c73 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.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: tkWindow.c,v 1.94 2008/04/16 14:51:29 das Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.95 2008/04/27 22:38:58 dkf Exp $ */ #include "tkInt.h" @@ -242,14 +242,14 @@ static Tk_ArgvInfo argTable[] = { */ static Tk_Window CreateTopLevelWindow(Tcl_Interp *interp, - Tk_Window parent, CONST char *name, - CONST char *screenName, unsigned int flags); + Tk_Window parent, const char *name, + const char *screenName, unsigned int flags); static void DeleteWindowsExitProc(ClientData clientData); -static TkDisplay * GetScreen(Tcl_Interp *interp, CONST char *screenName, +static TkDisplay * GetScreen(Tcl_Interp *interp, const char *screenName, int *screenPtr); static int Initialize(Tcl_Interp *interp); static int NameWindow(Tcl_Interp *interp, TkWindow *winPtr, - TkWindow *parentPtr, CONST char *name); + TkWindow *parentPtr, const char *name); static void UnlinkWindow(TkWindow *winPtr); /* @@ -342,9 +342,9 @@ CreateTopLevelWindow( Tk_Window parent, /* Token for logical parent of new window * (used for naming, options, etc.). May be * NULL. */ - CONST char *name, /* Name for new window; if parent is non-NULL, + const char *name, /* Name for new window; if parent is non-NULL, * must be unique among parent's children. */ - CONST char *screenName, /* Name of screen on which to create window. + const char *screenName, /* Name of screen on which to create window. * NULL means use DISPLAY environment variable * to determine. Empty string means use * parent's screen, or DISPLAY if no @@ -354,7 +354,7 @@ CreateTopLevelWindow( register TkWindow *winPtr; register TkDisplay *dispPtr; int screenId; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -446,15 +446,15 @@ CreateTopLevelWindow( static TkDisplay * GetScreen( Tcl_Interp *interp, /* Place to leave error message. */ - CONST char *screenName, /* Name for screen. NULL or empty means use + const char *screenName, /* Name for screen. NULL or empty means use * DISPLAY envariable. */ int *screenPtr) /* Where to store screen number. */ { register TkDisplay *dispPtr; - CONST char *p; + const char *p; int screenId; size_t length; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -564,7 +564,7 @@ TkGetDisplay( Display *display) /* X's display pointer */ { TkDisplay *dispPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (dispPtr = tsdPtr->displayList; dispPtr != NULL; @@ -597,7 +597,7 @@ TkGetDisplay( TkDisplay * TkGetDisplayList(void) { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->displayList; @@ -624,7 +624,7 @@ TkGetDisplayList(void) TkMainInfo * TkGetMainInfoList(void) { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->mainWindowList; @@ -736,7 +736,7 @@ NameWindow( register TkWindow *winPtr, /* Window that is to be named and inserted. */ TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used * for naming, options, etc.). */ - CONST char *name) /* Name for winPtr; must be unique among + const char *name) /* Name for winPtr; must be unique among * parentPtr's children. */ { #define FIXED_SIZE 200 @@ -853,7 +853,7 @@ NameWindow( Tk_Window TkCreateMainWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - CONST char *screenName, /* Name of screen on which to create window. + const char *screenName, /* Name of screen on which to create window. * Empty or NULL string means use DISPLAY * environment variable. */ char *baseName) /* Base name for application; usually of the @@ -866,7 +866,7 @@ TkCreateMainWindow( register TkWindow *winPtr; register TkCmd *cmdPtr; ClientData clientData; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -952,13 +952,13 @@ TkCreateMainWindow( Tcl_Panic("TkCreateMainWindow: builtin command with NULL string and object procs"); } if (cmdPtr->passMainWindow) { - clientData = (ClientData) tkwin; + clientData = tkwin; } else { - clientData = (ClientData) NULL; + clientData = NULL; } if (cmdPtr->cmdProc != NULL) { Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc, - clientData, (void (*) _ANSI_ARGS_((ClientData))) NULL); + clientData, NULL); } else { Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc, clientData, NULL); @@ -1011,9 +1011,9 @@ Tk_CreateWindow( * the interp's result is assumed to be * initialized by the caller. */ Tk_Window parent, /* Token for parent of new window. */ - CONST char *name, /* Name for new window. Must be unique among + const char *name, /* Name for new window. Must be unique among * parent's children. */ - CONST char *screenName) /* If NULL, new window will be internal on + const char *screenName) /* If NULL, new window will be internal on * same screen as its parent. If non-NULL, * gives name of screen on which to create new * window; window will be a top-level @@ -1075,7 +1075,7 @@ Tk_CreateAnonymousWindow( * the interp's result is assumed to be * initialized by the caller. */ Tk_Window parent, /* Token for parent of new window. */ - CONST char *screenName) /* If NULL, new window will be internal on + const char *screenName) /* If NULL, new window will be internal on * same screen as its parent. If non-NULL, * gives name of screen on which to create new * window; window will be a top-level @@ -1142,11 +1142,11 @@ Tk_CreateWindowFromPath( * initialized by the caller. */ Tk_Window tkwin, /* Token for any window in application that is * to contain new window. */ - CONST char *pathName, /* Path name for new window within the + const char *pathName, /* Path name for new window within the * application of tkwin. The parent of this * window must already exist, but the window * itself must not exist. */ - CONST char *screenName) /* If NULL, new window will be on same screen + const char *screenName) /* If NULL, new window will be on same screen * as its parent. If non-NULL, gives name of * screen on which to create new window; * window will be a top-level window. */ @@ -1257,7 +1257,7 @@ Tk_DestroyWindow( TkDisplay *dispPtr = winPtr->dispPtr; XEvent event; TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_ALREADY_DEAD) { @@ -1485,7 +1485,7 @@ Tk_DestroyWindow( if (winPtr->mainPtr != NULL) { if (winPtr->pathName != NULL) { Tk_DeleteAllBindings(winPtr->mainPtr->bindingTable, - (ClientData) winPtr->pathName); + winPtr->pathName); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, winPtr->pathName)); @@ -1607,7 +1607,7 @@ Tk_DestroyWindow( #endif } } - Tcl_EventuallyFree((ClientData) winPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(winPtr, TCL_DYNAMIC); } /* @@ -2235,7 +2235,7 @@ TkDoConfigureNotify( void Tk_SetClass( Tk_Window tkwin, /* Token for window to assign class. */ - CONST char *className) /* New class for tkwin. */ + const char *className) /* New class for tkwin. */ { register TkWindow *winPtr = (TkWindow *) tkwin; @@ -2299,7 +2299,7 @@ Tk_SetClassProcs( Tk_Window Tk_NameToWindow( Tcl_Interp *interp, /* Where to report errors. */ - CONST char *pathName, /* Path name of window. */ + const char *pathName, /* Path name of window. */ Tk_Window tkwin) /* Token for window: name is assumed to belong * to the same main window as tkwin. */ { @@ -2326,7 +2326,7 @@ Tk_NameToWindow( } return NULL; } - return (Tk_Window) Tcl_GetHashValue(hPtr); + return Tcl_GetHashValue(hPtr); } /* @@ -2369,7 +2369,7 @@ Tk_IdToWindow( if (hPtr == NULL) { return NULL; } - return (Tk_Window) Tcl_GetHashValue(hPtr); + return Tcl_GetHashValue(hPtr); } /* @@ -2389,7 +2389,7 @@ Tk_IdToWindow( *---------------------------------------------------------------------- */ -CONST char * +const char * Tk_DisplayName( Tk_Window tkwin) /* Window whose display name is desired. */ { @@ -2628,8 +2628,7 @@ Tk_MainWindow( return NULL; } #endif - tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { @@ -2697,8 +2696,7 @@ Tk_GetNumMainWindows(void) } #endif - tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->numMainWindows; } @@ -2756,7 +2754,7 @@ DeleteWindowsExitProc( { TkDisplay *dispPtr, *nextPtr; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) clientData; + ThreadSpecificData *tsdPtr = clientData; if (tsdPtr == NULL) { return; @@ -2772,11 +2770,11 @@ DeleteWindowsExitProc( while (tsdPtr->halfdeadWindowList != NULL) { interp = tsdPtr->halfdeadWindowList->winPtr->mainPtr->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); tsdPtr->halfdeadWindowList->flags |= HD_CLEANUP; tsdPtr->halfdeadWindowList->winPtr->flags &= ~TK_ALREADY_DEAD; Tk_DestroyWindow((Tk_Window) tsdPtr->halfdeadWindowList->winPtr); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* @@ -2785,9 +2783,9 @@ DeleteWindowsExitProc( while (tsdPtr->mainWindowList != NULL) { interp = tsdPtr->mainWindowList->interp; - Tcl_Preserve((ClientData) interp); + Tcl_Preserve(interp); Tk_DestroyWindow((Tk_Window) tsdPtr->mainWindowList->winPtr); - Tcl_Release((ClientData) interp); + Tcl_Release(interp); } /* @@ -2937,9 +2935,9 @@ Initialize( { char *p; int argc, code; - CONST char **argv; + const char **argv; char *args[20]; - CONST char *argString = NULL; + const char *argString = NULL; Tcl_DString class; ThreadSpecificData *tsdPtr; @@ -2958,8 +2956,7 @@ Initialize( TkRegisterObjTypes(); - tsdPtr = (ThreadSpecificData *) - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Start by initializing all the static variables to default acceptable @@ -2979,7 +2976,7 @@ Initialize( argv = NULL; /* - * We start by resetting the result because it might not be clean + * We start by resetting the result because it might not be clean. */ Tcl_ResetResult(interp); @@ -3155,7 +3152,7 @@ Initialize( visual = NULL; } args[argc] = NULL; - code = TkCreateFrame((ClientData) NULL, interp, argc, args, 1, name); + code = TkCreateFrame(NULL, interp, argc, args, 1, name); Tcl_DStringFree(&class); if (code != TCL_OK) { @@ -3253,7 +3250,7 @@ tkInit"); * specific cleanups take place to avoid panics in finalization. */ - TkCreateThreadExitHandler(DeleteWindowsExitProc, (ClientData) tsdPtr); + TkCreateThreadExitHandler(DeleteWindowsExitProc, tsdPtr); } return code; @@ -3284,16 +3281,16 @@ tkInit"); *---------------------------------------------------------------------- */ -CONST char * +const char * Tk_PkgInitStubsCheck( Tcl_Interp *interp, - CONST char * version, + const char * version, int exact) { - CONST char *actualVersion = Tcl_PkgRequire(interp, "Tk", version, 0); + const char *actualVersion = Tcl_PkgRequire(interp, "Tk", version, 0); if (exact && actualVersion) { - CONST char *p = version; + const char *p = version; int count = 0; while (*p) { diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index bae3e6a..4d1adcd 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -1,4 +1,4 @@ -/* $Id: ttkButton.c,v 1.8 2007/12/13 15:26:24 dgp Exp $ +/* $Id: ttkButton.c,v 1.9 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. @@ -519,7 +519,7 @@ CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) */ static int CheckbuttonInvokeCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Checkbutton *checkPtr = recordPtr; WidgetCore *corePtr = &checkPtr->core; @@ -705,7 +705,7 @@ RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) */ static int RadiobuttonInvokeCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Radiobutton *radioPtr = recordPtr; WidgetCore *corePtr = &radioPtr->core; diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 3dcb379..8c50485 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -1,4 +1,4 @@ -/* $Id: ttkImage.c,v 1.7 2007/12/13 15:26:26 dgp Exp $ +/* $Id: ttkImage.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ * Image specifications and image element factory. * * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sf.net> @@ -312,7 +312,7 @@ Ttk_CreateImageElement( void *clientData, Ttk_Theme theme, const char *elementName, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { const char *optionStrings[] = { "-border","-height","-padding","-sticky","-width",NULL }; diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index c0d930a..76d1768 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -1,4 +1,4 @@ -/* $Id: ttkInit.c,v 1.7 2007/12/13 15:26:26 dgp Exp $ +/* $Id: ttkInit.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2003, Joe English * * Ttk package: initialization routine and miscellaneous utilities. @@ -46,7 +46,7 @@ int Ttk_GetCompoundFromObj( * Legal values for the -orient option. * See also: enum Ttk_Orient. */ -CONST char *ttkOrientStrings[] = { +const char *ttkOrientStrings[] = { "horizontal", "vertical", NULL }; diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 68fd665..7b10300 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -1,4 +1,4 @@ -/* $Id: ttkNotebook.c,v 1.13 2008/01/28 00:36:08 jenglish Exp $ +/* $Id: ttkNotebook.c,v 1.14 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2004, Joe English */ @@ -208,7 +208,7 @@ static void DestroyTab(Notebook *nb, Tab *tab) static int ConfigureTab( Tcl_Interp *interp, Notebook *nb, Tab *tab, Tk_Window slaveWindow, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; Ttk_Padding padding = tab->padding; @@ -854,7 +854,7 @@ static int GetTabIndex( /* $nb add window ?options ... ? */ static int NotebookAddCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; int index = Ttk_NumberSlaves(nb->notebook.mgr); @@ -968,7 +968,7 @@ static int NotebookInsertCommand( * Removes the specified tab. */ static int NotebookForgetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; int index; @@ -992,7 +992,7 @@ static int NotebookForgetCommand( * Hides the specified tab. */ static int NotebookHideCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; int index; @@ -1022,7 +1022,7 @@ static int NotebookHideCommand( * Returns name of tab element at $x,$y; empty string if none. */ static int NotebookIdentifyCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_LayoutNode *node = NULL; @@ -1065,7 +1065,7 @@ static int NotebookIdentifyCommand( * See above for valid item formats. */ static int NotebookIndexCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; int index, status; @@ -1097,7 +1097,7 @@ static int NotebookIndexCommand( * the currently-selected pane. */ static int NotebookSelectCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; @@ -1123,7 +1123,7 @@ static int NotebookSelectCommand( * Return list of tabs. */ static int NotebookTabsCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; @@ -1148,7 +1148,7 @@ static int NotebookTabsCommand( /* $nb tab $tab ?-option ?value -option value...?? */ static int NotebookTabCommand( - Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Notebook *nb = recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index cac3d20..bd9457c 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,4 +1,4 @@ -/* $Id: ttkPanedwindow.c,v 1.14 2008/02/23 17:35:28 jenglish Exp $ +/* $Id: ttkPanedwindow.c,v 1.15 2008/04/27 22:41:12 dkf Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -142,7 +142,7 @@ static void DestroyPane(Paned *pw, Pane *pane) */ static int ConfigurePane( Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; Tk_SavedOptions savedOptions; @@ -615,7 +615,7 @@ static void PanedDisplay(void *recordPtr, Drawable d) /* $pw add window [ options ... ] */ static int PanedAddCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; Tk_Window slaveWindow; @@ -640,7 +640,7 @@ static int PanedAddCommand( * Insert new slave, or move existing one. */ static int PanedInsertCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); @@ -685,7 +685,7 @@ static int PanedInsertCommand( /* $pw forget $pane */ static int PanedForgetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; int paneIndex; @@ -709,7 +709,7 @@ static int PanedForgetCommand( * Return index of sash at $x,$y */ static int PanedIdentifyCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; int sashThickness = pw->paned.sashThickness; @@ -743,7 +743,7 @@ static int PanedIdentifyCommand( * Query/modify pane options. */ static int PanedPaneCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; int paneIndex; @@ -780,7 +780,7 @@ static int PanedPaneCommand( * Return list of managed panes. */ static int PanedPanesCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; Ttk_Manager *mgr = pw->paned.mgr; @@ -807,7 +807,7 @@ static int PanedPanesCommand( * Query or modify sash position. */ static int PanedSashposCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Paned *pw = recordPtr; int sashIndex, position = -1; diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index 6d6db8d..b5883e1 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -1,4 +1,4 @@ -/* $Id: ttkProgress.c,v 1.5 2007/01/11 14:49:47 jenglish Exp $ +/* $Id: ttkProgress.c,v 1.6 2008/04/27 22:41:12 dkf Exp $ * * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * @@ -399,7 +399,7 @@ static Ttk_Layout ProgressbarGetLayout( /* $sb step ?amount? */ static int ProgressbarStepCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; @@ -453,7 +453,7 @@ static int ProgressbarStepCommand( * and pass to interpreter. */ static int ProgressbarStartStopCommand( - Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *CONST objv[]) + Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *cmd = Tcl_NewListObj(objc, objv); Tcl_Obj *prefix[2]; @@ -473,14 +473,14 @@ static int ProgressbarStartStopCommand( } static int ProgressbarStartCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::start", objc, objv); } static int ProgressbarStopCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index 4c8d1eb..68438a2 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -1,4 +1,4 @@ -/* $Id: ttkScale.c,v 1.7 2007/12/13 15:26:26 dgp Exp $ +/* $Id: ttkScale.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ * Copyright (C) 2004 Pat Thoyts <patthoyts@users.sourceforge.net> * * ttk::scale widget. @@ -252,7 +252,7 @@ static double ScaleFraction(Scale *scalePtr, double value) */ static int ScaleGetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scale *scalePtr = recordPtr; int x, y, r = TCL_OK; @@ -280,7 +280,7 @@ ScaleGetCommand( */ static int ScaleSetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scale *scalePtr = recordPtr; double from = 0.0, to = 1.0, value; @@ -348,7 +348,7 @@ ScaleSetCommand( static int ScaleCoordsCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scale *scalePtr = recordPtr; double value; diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index 82bb880..26656f2 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -1,4 +1,4 @@ -/* $Id: ttkScrollbar.c,v 1.7 2007/12/13 15:26:26 dgp Exp $ +/* $Id: ttkScrollbar.c,v 1.8 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2003, Joe English * * ttk::scrollbar widget. @@ -132,7 +132,7 @@ static void ScrollbarDoLayout(void *recordPtr) */ static int ScrollbarSetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scrollbar *scrollbar = recordPtr; Tcl_Obj *firstObj, *lastObj; @@ -183,7 +183,7 @@ ScrollbarSetCommand( */ static int ScrollbarGetCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scrollbar *scrollbar = recordPtr; Tcl_Obj *result[2]; @@ -206,7 +206,7 @@ ScrollbarGetCommand( */ static int ScrollbarDeltaCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scrollbar *sb = recordPtr; double dx, dy; @@ -246,7 +246,7 @@ ScrollbarDeltaCommand( */ static int ScrollbarFractionCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { Scrollbar *sb = recordPtr; Ttk_Box b = sb->scrollbar.troughBox; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 598bc34..3439ef0 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.11 2007/12/13 15:26:26 dgp Exp $ + * $Id: ttkTheme.c,v 1.12 2008/04/27 22:41:12 dkf Exp $ */ #include <stdlib.h> @@ -18,7 +18,7 @@ #include "ttkThemeInt.h" #ifdef NO_PRIVATE_HEADERS -EXTERN CONST Tk_OptionSpec *TkGetOptionSpec (CONST char *name, +EXTERN const Tk_OptionSpec *TkGetOptionSpec(const char *name, Tk_OptionTable optionTable); #else #include <tkInt.h> @@ -832,7 +832,7 @@ int Ttk_RegisterElementFactory( static int Ttk_CloneElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, - int objc, Tcl_Obj *CONST objv[]) + int objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; ElementImpl *fromElement; @@ -1183,7 +1183,7 @@ StyleMapCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj * CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1247,7 +1247,7 @@ usage: /* + style configure $style -option ?value... */ static int StyleConfigureCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1302,7 +1302,7 @@ usage: /* + style lookup $style -option ?statespec? ?defaultValue? */ static int StyleLookupCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1346,7 +1346,7 @@ static int StyleLookupCmd( /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *optStrings[] = @@ -1410,7 +1410,7 @@ static int StyleThemeCreateCmd( * Return list of registered themes. */ static int StyleThemeNamesCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; return EnumerateHashTable(interp, &pkgPtr->themeTable); @@ -1426,7 +1426,7 @@ StyleThemeSettingsCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj * CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; @@ -1452,7 +1452,7 @@ StyleThemeSettingsCmd( /* + style element create name type ? ...args ? */ static int StyleElementCreateCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1484,7 +1484,7 @@ static int StyleElementCreateCmd( * Return a list of elements defined in the current theme. */ static int StyleElementNamesCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1500,7 +1500,7 @@ static int StyleElementNamesCmd( * Return list of element options for specified element */ static int StyleElementOptionsCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1536,7 +1536,7 @@ static int StyleElementOptionsCmd( /* + style layout name ?spec? */ static int StyleLayoutCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; @@ -1576,7 +1576,7 @@ StyleThemeUseCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj * CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { StylePackageData *pkgPtr = clientData; Ttk_Theme theme; @@ -1635,7 +1635,7 @@ StyleObjCmd( ClientData clientData, /* Master StylePackageData pointer */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ - Tcl_Obj * CONST objv[]) /* Argument objects */ + Tcl_Obj *const objv[]) /* Argument objects */ { struct Ensemble *ensemble = StyleEnsemble; int optPtr = 1; diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index 37a319b..cb2f1c7 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -1,4 +1,4 @@ -/* $Id: ttkTrace.c,v 1.1 2006/10/31 01:42:26 hobbs Exp $ +/* $Id: ttkTrace.c,v 1.2 2008/04/27 22:41:12 dkf Exp $ * * Copyright 2003, Joe English * @@ -27,8 +27,8 @@ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ - CONST char *name1, /* (unused) */ - CONST char *name2, /* (unused) */ + const char *name1, /* (unused) */ + const char *name2, /* (unused) */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = clientData; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index ad60f4b..95c9a99 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,4 +1,4 @@ -/* $Id: ttkTreeview.c,v 1.23 2007/12/13 15:26:26 dgp Exp $ +/* $Id: ttkTreeview.c,v 1.24 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. @@ -2915,8 +2915,8 @@ static int TreeviewTagBindCommand( Tcl_SetObjResult(interp, Tcl_NewStringObj(script,-1)); } } else if (objc == 6) { /* $tv tag bind $tag $sequence $script */ - CONST char *sequence = Tcl_GetString(objv[4]); - CONST char *script = Tcl_GetString(objv[5]); + const char *sequence = Tcl_GetString(objv[4]); + const char *script = Tcl_GetString(objv[5]); unsigned long mask = Tk_CreateBinding(interp, tv->tree.bindingTable, tag, sequence, script, 0); diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index ae00a32..43c6086 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -1,4 +1,4 @@ -/* $Id: ttkWidget.c,v 1.11 2008/01/06 22:35:41 jenglish Exp $ +/* $Id: ttkWidget.c,v 1.12 2008/04/27 22:41:12 dkf Exp $ * Copyright (c) 2003, Joe English * * Core widget utilities. @@ -180,7 +180,7 @@ WidgetInstanceObjCmd( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj * const objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { WidgetCore *corePtr = (WidgetCore *)clientData; const WidgetCommandSpec *commands = corePtr->widgetSpec->commands; @@ -345,7 +345,7 @@ static struct Tk_ClassProcs widgetClassProcs = { * ClientData is a WidgetSpec *. */ int TtkWidgetConstructorObjCmd( - ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) + ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { WidgetSpec *widgetSpec = (WidgetSpec *)clientData; const char *className = widgetSpec->className; @@ -594,7 +594,7 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) /* $w cget -option */ int TtkWidgetCgetCommand( -Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) +Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Tcl_Obj *result; @@ -614,7 +614,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[], void *recordPtr) /* $w configure ?-option ?value ....?? */ int TtkWidgetConfigureCommand( -Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) +Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Tcl_Obj *result; @@ -679,7 +679,7 @@ Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) */ int TtkWidgetStateCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_StateSpec spec; @@ -719,7 +719,7 @@ int TtkWidgetStateCommand( */ int TtkWidgetInstateCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_State state = corePtr->state; @@ -749,7 +749,7 @@ int TtkWidgetInstateCommand( * Returns: name of element at $x, $y */ int TtkWidgetIdentifyCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], void *recordPtr) + Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr) { WidgetCore *corePtr = recordPtr; Ttk_LayoutNode *node; |