From 4b9f05fc68f4d1a561c16fcb44c31af46bedb3d6 Mon Sep 17 00:00:00 2001 From: nijtmans Date: Tue, 3 Feb 2009 23:55:47 +0000 Subject: - eliminate some unnessary type casts - some internal const decorations - spacing --- ChangeLog | 26 ++++++++++++++++++++++++++ generic/tkCanvArc.c | 4 ++-- generic/tkCanvBmap.c | 4 ++-- generic/tkCanvImg.c | 4 ++-- generic/tkCanvWind.c | 4 ++-- generic/tkCmds.c | 24 ++++++++++++------------ generic/tkConfig.c | 7 ++++--- generic/tkEntry.c | 20 ++++++++++---------- generic/tkFocus.c | 4 ++-- generic/tkFont.c | 4 ++-- generic/tkFrame.c | 6 +++--- generic/tkGrab.c | 4 ++-- generic/tkGrid.c | 20 ++++++++++---------- generic/tkImage.c | 4 ++-- generic/tkListbox.c | 23 ++++++++++++----------- generic/tkObj.c | 8 +++++--- generic/tkOption.c | 6 +++--- generic/tkPack.c | 10 +++++----- generic/tkPanedWindow.c | 7 ++++--- generic/tkRectOval.c | 4 ++-- generic/tkSelect.c | 18 ++++++++++-------- generic/tkText.c | 4 ++-- generic/tkTextMark.c | 4 ++-- generic/tkTextTag.c | 6 +++--- 24 files changed, 129 insertions(+), 96 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cfa338..22b8f21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2009-01-29 Jan Nijtmans + + * generic/tkCanvArc.c - eliminate some unnessary type casts + * generic/tkCanvBmap.c - some internal const decorations + * generic/tkCanvImg.c - spacing + * generic/tkCanvWind.c + * generic/tkCmds.c + * generic/tkConfig.c + * generic/tkEntry.c + * generic/tkFocus.c + * generic/tkFont.c + * generic/tkFrame.c + * generic/tkGrab.c + * generic/tkGrid.c + * generic/tkImage.c + * generic/tkListbox.c + * generic/tkObj.c + * generic/tkOption.c + * generic/tkPack.c + * generic/tkPanedWindow.c + * generic/tkRectOval.c + * generic/tkSelect.c + * generic/tkText.c + * generic/tkTextMark.c + * generic/tkTextTag.c + 2009-01-28 Jan Nijtmans * generic/ttk/ttkCache.c: - eliminate some unnessary type casts diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index 90ebe24..2d75948 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.19 2008/11/22 22:28:52 das Exp $ + * RCS: @(#) $Id: tkCanvArc.c,v 1.20 2009/02/03 23:55:47 nijtmans Exp $ */ #include @@ -299,7 +299,7 @@ CreateArc( */ for (i = 1; i < objc; i++) { - char *arg = Tcl_GetString(objv[i]); + const char *arg = Tcl_GetString(objv[i]); if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { break; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 932e6ed..8cf550e 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.16 2008/11/09 20:51:28 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvBmap.c,v 1.17 2009/02/03 23:55:47 nijtmans Exp $ */ #include @@ -201,7 +201,7 @@ TkcCreateBitmap( if (objc == 1) { i = 1; } else { - char *arg = Tcl_GetString(objv[1]); + const char *arg = Tcl_GetString(objv[1]); i = 2; if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 96a17e4..5cf3b6c 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.13 2008/11/09 20:51:28 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvImg.c,v 1.14 2009/02/03 23:55:47 nijtmans Exp $ */ #include @@ -187,7 +187,7 @@ CreateImage( if (objc == 1) { i = 1; } else { - char *arg = Tcl_GetString(objv[1]); + const char *arg = Tcl_GetString(objv[1]); i = 2; if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { i = 1; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index a133898..850586c 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.18 2008/11/09 20:51:28 nijtmans Exp $ + * RCS: @(#) $Id: tkCanvWind.c,v 1.19 2009/02/03 23:55:47 nijtmans Exp $ */ #include @@ -199,7 +199,7 @@ CreateWinItem( if (objc == 1) { i = 1; } else { - char *arg = Tcl_GetString(objv[1]); + const char *arg = Tcl_GetString(objv[1]); i = 2; if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 21bd8d4..c6ed614 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.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: tkCmds.c,v 1.49 2008/12/10 05:02:40 das Exp $ + * RCS: @(#) $Id: tkCmds.c,v 1.50 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -165,7 +165,7 @@ Tk_BindObjCmd( Tk_Window tkwin = (Tk_Window) clientData; TkWindow *winPtr; ClientData object; - char *string; + const char *string; if ((objc < 2) || (objc > 4)) { Tcl_WrongNumArgs(interp, 1, objv, "window ?pattern? ?command?"); @@ -200,7 +200,7 @@ Tk_BindObjCmd( if (objc == 4) { int append = 0; unsigned long mask; - char *sequence, *script; + const char *sequence, *script; sequence = Tcl_GetString(objv[2]); script = Tcl_GetString(objv[3]); @@ -270,7 +270,7 @@ TkBindEventProc( ClientData objects[MAX_OBJS], *objPtr; TkWindow *topLevPtr; int i, count; - char *p; + const char *p; Tcl_HashEntry *hPtr; if ((winPtr->mainPtr == NULL) || (winPtr->mainPtr->bindingTable == NULL)) { @@ -289,7 +289,7 @@ TkBindEventProc( (winPtr->numTags * sizeof(ClientData))); } for (i = 0; i < winPtr->numTags; i++) { - p = (char *) winPtr->tagPtr[i]; + p = winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -351,7 +351,7 @@ Tk_BindtagsObjCmd( Tk_Window tkwin = (Tk_Window) clientData; TkWindow *winPtr, *winPtr2; int i, length; - char *p; + const char *p; Tcl_Obj *listPtr, **tags; if ((objc < 2) || (objc > 3)) { @@ -449,17 +449,17 @@ TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { int i; - char *p; + const char *p; for (i = 0; i < winPtr->numTags; i++) { - p = (char *) (winPtr->tagPtr[i]); + p = winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they * have to be freed. */ - ckfree(p); + ckfree((char *) p); } } ckfree((char *) winPtr->tagPtr); @@ -675,7 +675,7 @@ AppnameCmd( { Tk_Window tkwin = clientData; TkWindow *winPtr; - char *string; + const char *string; if (Tcl_IsSafe(interp)) { Tcl_SetResult(interp, @@ -940,7 +940,7 @@ InactiveCmd( Tcl_SetObjResult(interp, Tcl_NewLongObj(inactive)); } else if (objc - skip == 2) { - char *string; + const char *string; string = Tcl_GetString(objv[objc-1]); if (strcmp(string, "reset") != 0) { @@ -2056,7 +2056,7 @@ TkGetDisplayOf( * unmodified if "-displayof" argument was not * present. */ { - char *string; + const char *string; int length; if (objc < 1) { diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 201f204..27a48cb 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.29 2008/10/15 06:41:06 nijtmans Exp $ + * RCS: @(#) $Id: tkConfig.c,v 1.30 2009/02/03 23:55:47 nijtmans Exp $ */ /* @@ -712,7 +712,8 @@ DoObjConfig( break; } case TK_OPTION_STRING: { - char *newStr, *value; + char *newStr; + const char *value; int length; if (nullOK && ObjectIsEmpty(valuePtr)) { @@ -1123,7 +1124,7 @@ GetOptionFromObj( OptionTable *tablePtr) /* Table in which to look up objPtr. */ { Option *bestPtr; - char *name; + const char *name; /* * First, check to see if the object already has the answer cached. diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 44ea933..8bc738f 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.57 2008/12/09 21:22:56 dgp Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.58 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -414,7 +414,7 @@ static char * EntryTextVarProc(ClientData clientData, const char *name2, int flags); static void EntryUpdateScrollbar(Entry *entryPtr); static int EntryValidate(Entry *entryPtr, char *cmd); -static int EntryValidateChange(Entry *entryPtr, char *change, +static int EntryValidateChange(Entry *entryPtr, const 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, @@ -428,8 +428,8 @@ static int EntryWidgetObjCmd(ClientData clientData, Tcl_Obj *const objv[]); static void EntryWorldChanged(ClientData instanceData); static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr, - char *string, int *indexPtr); -static void InsertChars(Entry *entryPtr, int index, char *string); + const char *string, int *indexPtr); +static void InsertChars(Entry *entryPtr, int index, const char *string); /* * These forward declarations are the spinbox specific ones: @@ -736,7 +736,7 @@ EntryWidgetObjCmd( case COMMAND_SCAN: { int x; - char *minorCmd; + const char *minorCmd; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x"); @@ -1998,7 +1998,7 @@ InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ int index, /* Add the new elements before this character * index. */ - char *value) /* New characters to add (NULL-terminated + const char *value) /* New characters to add (NULL-terminated * string). */ { ptrdiff_t byteIndex; @@ -2500,7 +2500,7 @@ GetEntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry for which the index is being * specified. */ - char *string, /* Specifies character in entryPtr. */ + const char *string, /* Specifies character in entryPtr. */ int *indexPtr) /* Where to store converted character index */ { size_t length; @@ -3187,7 +3187,7 @@ EntryValidate( static int EntryValidateChange( register Entry *entryPtr, /* Entry that needs validation. */ - char *change, /* Characters to be added/deleted + const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete, -1 otherwise */ @@ -3810,7 +3810,7 @@ SpinboxWidgetObjCmd( case SB_CMD_SCAN: { int x; - char *minorCmd; + const char *minorCmd; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "mark|dragto x"); @@ -4189,7 +4189,7 @@ SpinboxInvoke( */ int i, listc, elemLen, length = entryPtr->numChars; - char *bytes; + const char *bytes; Tcl_Obj **listv; Tcl_ListObjGetElements(interp, sbPtr->listObj, &listc, &listv); diff --git a/generic/tkFocus.c b/generic/tkFocus.c index cbe8cda..b3696d1 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.20 2008/11/23 21:58:24 patthoyts Exp $ + * RCS: @(#) $Id: tkFocus.c,v 1.21 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -119,7 +119,7 @@ Tk_FocusObjCmd( TkWindow *winPtr = clientData; TkWindow *newPtr, *focusWinPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; - char *windowName; + const char *windowName; int index; /* diff --git a/generic/tkFont.c b/generic/tkFont.c index 046a0ff..21ff311 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.52 2009/01/09 07:03:31 nijtmans Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.53 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -3787,7 +3787,7 @@ TkFontParseXLFD( } Tcl_DStringInit(&ds); - Tcl_DStringAppend(&ds, (char *) str, -1); + Tcl_DStringAppend(&ds, str, -1); src = Tcl_DStringValue(&ds); field[0] = src; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 4ff8866..67c0fab 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.37 2008/11/15 00:00:27 patthoyts Exp $ + * RCS: @(#) $Id: tkFrame.c,v 1.38 2009/02/03 23:55:47 nijtmans Exp $ */ #include "default.h" @@ -760,7 +760,7 @@ FrameWidgetObjCmd( */ for (i = 2; i < objc; i++) { - char *arg = Tcl_GetStringFromObj(objv[i], &length); + const char *arg = Tcl_GetStringFromObj(objv[i], &length); if (length < 2) { continue; } @@ -1071,7 +1071,7 @@ FrameWorldChanged( GC gc; int anyTextLabel, anyWindowLabel; int bWidthLeft, bWidthRight, bWidthTop, bWidthBottom; - char *labelText; + const char *labelText; anyTextLabel = (framePtr->type == TYPE_LABELFRAME) && (labelframePtr->textPtr != NULL) && diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 8bf0e89..1f80028 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.17 2008/11/23 21:58:24 patthoyts Exp $ + * RCS: @(#) $Id: tkGrab.c,v 1.18 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -188,7 +188,7 @@ Tk_GrabObjCmd( int globalGrab; Tk_Window tkwin; TkDisplay *dispPtr; - char *arg; + const char *arg; int index; int len; static const char *const optionStrings[] = { diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 50427c4..b4392f3 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.51 2008/11/08 22:52:29 dkf Exp $ + * RCS: @(#) $Id: tkGrid.c,v 1.52 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -300,7 +300,7 @@ static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, int row, int numRows); static void StickyToString(int flags, char *result); -static int StringToSticky(char *string); +static int StringToSticky(const char *string); static void Unlink(Gridder *gridPtr); static const Tk_GeomMgr gridMgrType = { @@ -347,7 +347,7 @@ Tk_GridObjCmd( int index; if (objc >= 2) { - char *argv1 = Tcl_GetString(objv[1]); + const char *argv1 = Tcl_GetString(objv[1]); if ((argv1[0] == '.') || (argv1[0] == REL_SKIP) || (argv1[0] == REL_VERT)) { @@ -629,7 +629,7 @@ GridForgetRemoveCommand( Tk_Window slave; Gridder *slavePtr; int i; - char *string = Tcl_GetString(objv[1]); + const char *string = Tcl_GetString(objv[1]); char c = string[0]; for (i = 2; i < objc; i++) { @@ -930,7 +930,7 @@ GridRowColumnConfigureCommand( Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ int i, j, first, last; - char *string; + const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL }; @@ -2881,7 +2881,7 @@ ConfigureSlaves( int defaultRow = -1; int defaultColumn = 0; /* Default column number */ int defaultColumnSpan = 1; /* Default number of columns */ - char *lastWindow; /* Use this window to base current row/col + const char *lastWindow; /* Use this window to base current row/col * on */ int numSkip; /* Number of 'x' found */ static const char *const optionStrings[] = { @@ -2892,7 +2892,7 @@ ConfigureSlaves( CONF_COLUMN, CONF_COLUMNSPAN, CONF_IN, CONF_IPADX, CONF_IPADY, CONF_PADX, CONF_PADY, CONF_ROW, CONF_ROWSPAN, CONF_STICKY }; int index; - char *string; + const char *string; char firstChar; int positionGiven; @@ -3040,7 +3040,7 @@ ConfigureSlaves( for (defaultColumnSpan = 1; j + defaultColumnSpan < numWindows; defaultColumnSpan++) { - char *string = Tcl_GetString(objv[j + defaultColumnSpan]); + const char *string = Tcl_GetString(objv[j + defaultColumnSpan]); if (*string != REL_HORIZ) { break; @@ -3332,7 +3332,7 @@ ConfigureSlaves( */ for (width = 1; width + j < numWindows; width++) { - char *string = Tcl_GetString(objv[j+width]); + const char *string = Tcl_GetString(objv[j+width]); if (*string != REL_VERT) { break; @@ -3451,7 +3451,7 @@ StickyToString( static int StringToSticky( - char *string) + const char *string) { int sticky = 0; char c; diff --git a/generic/tkImage.c b/generic/tkImage.c index 9effbf0..ca818a3 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.42 2008/11/12 09:56:51 dkf Exp $ + * RCS: @(#) $Id: tkImage.c,v 1.43 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -226,7 +226,7 @@ Tk_ImageObjCmd( Tcl_HashSearch search; char idString[16 + TCL_INTEGER_SPACE]; TkDisplay *dispPtr = winPtr->dispPtr; - char *arg, *name; + const char *arg, *name; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 838751d..f97dd4c 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.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: tkListbox.c,v 1.54 2008/12/09 21:22:56 dgp Exp $ + * RCS: @(#) $Id: tkListbox.c,v 1.55 2009/02/03 23:55:47 nijtmans Exp $ */ #include "default.h" @@ -1094,7 +1094,7 @@ ListboxBboxSubCmd( if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) { Tcl_Obj *el; - char *stringRep; + const char *stringRep; int pixelWidth, stringLen, x, y, result; Tk_FontMetrics fm; @@ -1396,7 +1396,7 @@ ListboxGetItemAttributes( attrs->selFgColor = NULL; Tk_InitOptions(interp, (char *)attrs, listPtr->itemAttrOptionTable, listPtr->tkwin); - Tcl_SetHashValue(entry, (ClientData) attrs); + Tcl_SetHashValue(entry, attrs); } attrs = (ItemAttr *)Tcl_GetHashValue(entry); return attrs; @@ -1828,7 +1828,7 @@ DisplayListbox( Tk_FontMetrics fm; Tcl_Obj *curElement; Tcl_HashEntry *entry; - char *stringRep; + const char *stringRep; ItemAttr *attrs; Tk_3DBorder selectedBg; XGCValues gcValues; @@ -2211,7 +2211,7 @@ ListboxComputeGeometry( int width, height, pixelWidth, pixelHeight, textLength, i, result; Tk_FontMetrics fm; Tcl_Obj *element; - char *text; + const char *text; if (fontChanged || maxIsStale) { listPtr->xScrollUnit = Tk_TextWidth(listPtr->tkfont, "0", 1); @@ -2297,7 +2297,7 @@ ListboxInsertSubCmd( { int i, oldMaxWidth, pixelWidth, result, length; Tcl_Obj *newListObj; - char *stringRep; + const char *stringRep; oldMaxWidth = listPtr->maxWidth; for (i = 0; i < objc; i++) { @@ -2411,7 +2411,7 @@ ListboxDeleteSubCmd( { int count, i, widthChanged, length, result, pixelWidth; Tcl_Obj *newListObj, *element; - char *stringRep; + const char *stringRep; Tcl_HashEntry *entry; /* @@ -2701,7 +2701,7 @@ GetListboxIndex( int *indexPtr) /* Where to store converted index. */ { int result, index; - char *stringRep; + const char *stringRep; /* * First see if the index is one of the named indices. @@ -2738,7 +2738,8 @@ GetListboxIndex( if (stringRep[0] == '@') { /* @x,y index */ int y; - char *start, *end; + const char *start; + char *end; start = stringRep + 1; strtol(start, &end, 0); @@ -3043,7 +3044,7 @@ ListboxSelect( if (select) { entry = Tcl_CreateHashEntry(listPtr->selection, (char *) INT2PTR(i), &isNew); - Tcl_SetHashValue(entry, (ClientData) NULL); + Tcl_SetHashValue(entry, NULL); listPtr->numSelected++; if (firstRedisplay < 0) { firstRedisplay = i; @@ -3099,7 +3100,7 @@ ListboxFetchSelection( Tcl_DString selection; int length, count, needNewline, stringLen, i; Tcl_Obj *curElement; - char *stringRep; + const char *stringRep; Tcl_HashEntry *entry; if (!listPtr->exportSelection) { diff --git a/generic/tkObj.c b/generic/tkObj.c index b92f172..d3ce270 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.25 2008/11/29 00:12:58 ferrieux Exp $ + * RCS: @(#) $Id: tkObj.c,v 1.26 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -383,7 +383,8 @@ SetPixelFromAny( Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; - char *string, *rest; + const char *string; + char *rest; double d; int i, units; @@ -637,7 +638,8 @@ SetMMFromAny( Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; - char *string, *rest; + const char *string; + char *rest; double d; int units; MMRep *mmPtr; diff --git a/generic/tkOption.c b/generic/tkOption.c index 8d83ede..19394d1 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.28 2008/10/30 23:18:59 nijtmans Exp $ + * RCS: @(#) $Id: tkOption.c,v 1.29 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -223,7 +223,7 @@ static int GetDefaultOptions(Tcl_Interp *interp, static ElArray * NewArray(int numEls); static void OptionThreadExitProc(ClientData clientData); static void OptionInit(TkMainInfo *mainPtr); -static int ParsePriority(Tcl_Interp *interp, char *string); +static int ParsePriority(Tcl_Interp *interp, const char *string); static int ReadOptionFile(Tcl_Interp *interp, Tk_Window tkwin, const char *fileName, int priority); static void SetupStacks(TkWindow *winPtr, int leaf); @@ -855,7 +855,7 @@ TkOptionClassChanged( static int ParsePriority( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - char *string) /* Describes a priority level, either + const char *string) /* Describes a priority level, either * symbolically or numerically. */ { int priority, c; diff --git a/generic/tkPack.c b/generic/tkPack.c index b1dcd6a..334afdb 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.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: tkPack.c,v 1.32 2008/12/07 16:35:44 das Exp $ + * RCS: @(#) $Id: tkPack.c,v 1.33 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -190,7 +190,7 @@ Tk_PackObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = clientData; - char *argv2; + const char *argv2; static const char *const optionStrings[] = { /* after, append, before and unpack are deprecated */ "after", "append", "before", "unpack", @@ -201,7 +201,7 @@ Tk_PackObjCmd( int index; if (objc >= 2) { - char *string = Tcl_GetString(objv[1]); + const char *string = Tcl_GetString(objv[1]); if (string[0] == '.') { return ConfigureSlaves(interp, tkwin, objc-1, objv+1); @@ -1135,7 +1135,7 @@ PackAfter( packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; - char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); + const char *curOpt = Tcl_GetStringFromObj(curOptPtr, &length); c = curOpt[0]; @@ -1459,7 +1459,7 @@ ConfigureSlaves( Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; Tk_Window other, slave, parent, ancestor; int i, j, numWindows, tmp, positionGiven; - char *string; + const char *string; static const char *const optionStrings[] = { "-after", "-anchor", "-before", "-expand", "-fill", "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL }; diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 8dfcfed..061e041 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.37 2008/11/08 22:52:29 dkf Exp $ + * RCS: @(#) $Id: tkPanedWindow.c,v 1.38 2009/02/03 23:55:47 nijtmans Exp $ */ #include "default.h" @@ -754,7 +754,7 @@ ConfigureSlaves( Tk_Window tkwin = NULL, ancestor, parent; Slave *slavePtr, **inserts, **newSlaves; Slave options; - char *arg; + const char *arg; /* * Find the non-window name arguments; these are the configure options for @@ -2369,7 +2369,8 @@ SetSticky( int flags) /* Flags for the option, set Tk_SetOptions. */ { int sticky = 0; - char c, *string, *internalPtr; + char c, *internalPtr; + const char *string; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index b9b79aa..061e5b5 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.19 2008/11/09 20:51:28 nijtmans Exp $ + * RCS: @(#) $Id: tkRectOval.c,v 1.20 2009/02/03 23:55:47 nijtmans Exp $ */ #include @@ -266,7 +266,7 @@ CreateRectOval( */ for (i = 1; i < objc; i++) { - char *arg = Tcl_GetString(objv[i]); + const char *arg = Tcl_GetString(objv[i]); if ((arg[0] == '-') && (arg[1] >= 'a') && (arg[1] <= 'z')) { break; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index effd47b..9a13e9a 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.27 2008/12/09 21:22:56 dgp Exp $ + * RCS: @(#) $Id: tkSelect.c,v 1.28 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -674,9 +674,10 @@ Tk_SelectionObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = clientData; - char *path = NULL; + const char *path = NULL; Atom selection; - char *selName = NULL, *string; + const char *selName = NULL; + const char *string; int count, index; Tcl_Obj **objs; static const char *const optionStrings[] = { @@ -754,7 +755,7 @@ Tk_SelectionObjCmd( case SELECTION_GET: { Atom target; - char *targetName = NULL; + const char *targetName = NULL; Tcl_DString selBytes; int result; static const char *const getOptionStrings[] = { @@ -828,8 +829,8 @@ Tk_SelectionObjCmd( case SELECTION_HANDLE: { Atom target, format; - char *targetName = NULL; - char *formatName = NULL; + const char *targetName = NULL; + const char *formatName = NULL; register CommandInfo *cmdInfoPtr; int cmdLength; static const char *const handleOptionStrings[] = { @@ -918,7 +919,7 @@ Tk_SelectionObjCmd( case SELECTION_OWN: { register LostCommand *lostPtr; - char *script = NULL; + const char *script = NULL; int cmdLength; static const char *const ownOptionStrings[] = { "-command", "-displayof", "-selection", NULL @@ -1328,7 +1329,8 @@ HandleTclCommand( int spaceNeeded, length; #define MAX_STATIC_SIZE 100 char staticSpace[MAX_STATIC_SIZE]; - char *command, *string; + char *command; + const char *string; Tcl_Interp *interp = cmdInfoPtr->interp; Tcl_DString oldResult; int extraBytes, charOffset, count, numChars; diff --git a/generic/tkText.c b/generic/tkText.c index b051e9d..c7c5418 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.87 2008/12/07 16:32:44 das Exp $ + * RCS: @(#) $Id: tkText.c,v 1.88 2009/02/03 23:55:47 nijtmans Exp $ */ #include "default.h" @@ -4536,7 +4536,7 @@ TextDumpCmd( TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES); } else { int length; - char *str; + const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index 4e483d8..0a0dd2d 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.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: tkTextMark.c,v 1.23 2008/12/06 10:48:29 dkf Exp $ + * RCS: @(#) $Id: tkTextMark.c,v 1.24 2009/02/03 23:55:47 nijtmans Exp $ */ #include "tkInt.h" @@ -128,7 +128,7 @@ TkTextMarkCmd( case MARK_GRAVITY: { char c; int length; - char *str; + const char *str; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?"); diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index bcfd91b..cb13ae1 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.30 2008/10/17 23:18:37 nijtmans Exp $ + * RCS: @(#) $Id: tkTextTag.c,v 1.31 2009/02/03 23:55:47 nijtmans Exp $ */ #include "default.h" @@ -253,7 +253,7 @@ TkTextTagCmd( if (objc == 6) { int append = 0; unsigned long mask; - char *fifth = Tcl_GetString(objv[5]); + const char *fifth = Tcl_GetString(objv[5]); if (fifth[0] == 0) { return Tk_DeleteBinding(interp, @@ -1686,7 +1686,7 @@ TagBindEvent( int numTags, /* Number of relevant tags. */ TkTextTag **tagArrayPtr) /* Array of relevant tags. */ { - #define NUM_BIND_TAGS 10 +# define NUM_BIND_TAGS 10 const char *nameArray[NUM_BIND_TAGS]; const char **nameArrPtr; int i; -- cgit v0.12