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 /unix | |
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 'unix')
-rw-r--r-- | unix/tkAppInit.c | 8 | ||||
-rw-r--r-- | unix/tkUnix.c | 6 | ||||
-rw-r--r-- | unix/tkUnixConfig.c | 6 | ||||
-rw-r--r-- | unix/tkUnixCursor.c | 34 | ||||
-rw-r--r-- | unix/tkUnixDialog.c | 16 | ||||
-rw-r--r-- | unix/tkUnixEmbed.c | 6 | ||||
-rw-r--r-- | unix/tkUnixEvent.c | 4 | ||||
-rw-r--r-- | unix/tkUnixFont.c | 123 | ||||
-rw-r--r-- | unix/tkUnixInit.c | 9 | ||||
-rw-r--r-- | unix/tkUnixMenu.c | 52 | ||||
-rw-r--r-- | unix/tkUnixRFont.c | 12 | ||||
-rw-r--r-- | unix/tkUnixSend.c | 109 | ||||
-rw-r--r-- | unix/tkUnixWm.c | 197 | ||||
-rw-r--r-- | unix/tkUnixXId.c | 22 |
14 files changed, 301 insertions, 303 deletions
diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 526a3e8..9ae77f1 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -10,14 +10,14 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkAppInit.c,v 1.8 2007/02/22 13:56:33 dkf Exp $ + * RCS: @(#) $Id: tkAppInit.c,v 1.9 2008/04/27 22:39:12 dkf Exp $ */ #include "tk.h" #include "locale.h" #ifdef TK_TEST -extern int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp)); +extern int Tktest_Init(Tcl_Interp *interp); #endif /* TK_TEST */ /* @@ -52,7 +52,7 @@ main( #ifndef TK_LOCAL_APPINIT #define TK_LOCAL_APPINIT Tcl_AppInit #endif - extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp)); + extern int TK_LOCAL_APPINIT(Tcl_Interp *interp); /* * The following #if block allows you to change how Tcl finds the startup @@ -61,7 +61,7 @@ main( */ #ifdef TK_LOCAL_MAIN_HOOK - extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv)); + extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv); TK_LOCAL_MAIN_HOOK(&argc, &argv); #endif diff --git a/unix/tkUnix.c b/unix/tkUnix.c index cd44149..986ca96 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.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: tkUnix.c,v 1.15 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnix.c,v 1.16 2008/04/27 22:39:13 dkf Exp $ */ #include "tkInt.h" @@ -71,11 +71,11 @@ TkGetServerInfo( *---------------------------------------------------------------------- */ -CONST char * +const char * TkGetDefaultScreenName( Tcl_Interp *interp, /* Interp used to find environment * variables. */ - CONST char *screenName) /* Screen name from command line, or NULL. */ + const char *screenName) /* Screen name from command line, or NULL. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = Tcl_GetVar2(interp, "env", "DISPLAY", TCL_GLOBAL_ONLY); diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c index 91a992a..65a23d7 100644 --- a/unix/tkUnixConfig.c +++ b/unix/tkUnixConfig.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: tkUnixConfig.c,v 1.6 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixConfig.c,v 1.7 2008/04/27 22:39:13 dkf Exp $ */ #include "tkInt.h" @@ -37,8 +37,8 @@ Tcl_Obj * TkpGetSystemDefault( Tk_Window tkwin, /* A window to use. */ - CONST char *dbName, /* The option database name. */ - CONST char *className) /* The name of the option class. */ + const char *dbName, /* The option database name. */ + const char *className) /* The name of the option class. */ { return NULL; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index d57db13..103fd13 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.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: tkUnixCursor.c,v 1.13 2008/03/26 19:34:53 dgp Exp $ + * RCS: @(#) $Id: tkUnixCursor.c,v 1.14 2008/04/27 22:39:13 dkf Exp $ */ #include "tkInt.h" @@ -30,8 +30,8 @@ typedef struct { * the official cursor font: */ -static struct CursorName { - CONST char *name; +static const struct CursorName { + const char *name; unsigned int shape; } cursorNames[] = { {"X_cursor", XC_X_cursor}, @@ -161,8 +161,8 @@ static struct CursorName { #endif /* DEFINE_MYARROW_CURSOR */ -static struct TkCursorName { - char *name; +static const struct TkCursorName { + const char *name; char *data; char *mask; } tkCursorNames[] = { @@ -182,8 +182,8 @@ static struct TkCursorName { #endif static Cursor CreateCursorFromTableOrFile(Tcl_Interp *interp, - Tk_Window tkwin, int argc, CONST char **argv, - struct TkCursorName *tkCursorPtr); + Tk_Window tkwin, int argc, const char **argv, + const struct TkCursorName *tkCursorPtr); /* *---------------------------------------------------------------------- @@ -213,10 +213,10 @@ TkGetCursorByName( TkUnixCursor *cursorPtr = NULL; Cursor cursor = None; int argc; - CONST char **argv = NULL; + const char **argv = NULL; Display *display = Tk_Display(tkwin); int inTkTable = 0; - struct TkCursorName* tkCursorPtr = NULL; + const struct TkCursorName *tkCursorPtr = NULL; if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; @@ -247,7 +247,7 @@ TkGetCursorByName( if ((argv[0][0] != '@') && !inTkTable) { XColor fg, bg; unsigned int maskIndex; - register struct CursorName *namePtr; + register const struct CursorName *namePtr; TkDisplay *dispPtr; /* @@ -377,8 +377,8 @@ CreateCursorFromTableOrFile( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ Tk_Window tkwin, /* Window in which cursor will be used. */ int argc, - CONST char **argv, /* Cursor spec parsed into elements. */ - struct TkCursorName *tkCursorPtr) + const char **argv, /* Cursor spec parsed into elements. */ + const struct TkCursorName *tkCursorPtr) /* Non-NULL when cursor is defined in Tk * table. */ { @@ -388,8 +388,8 @@ CreateCursorFromTableOrFile( int xHot = -1, yHot = -1; int dummy1, dummy2; XColor fg, bg; - CONST char *fgColor; - CONST char *bgColor; + const char *fgColor; + const char *bgColor; int inTkTable = (tkCursorPtr != NULL); Display *display = Tk_Display(tkwin); @@ -430,7 +430,7 @@ CreateCursorFromTableOrFile( ckfree(data); } else { if (TkReadBitmapFile(display, drawable, &argv[0][1], - (unsigned int *) &width, (unsigned int *) &height, + (unsigned *) &width, (unsigned *) &height, &source, &xHot, &yHot) != BitmapSuccess) { Tcl_AppendResult(interp, "cleanup reading bitmap file \"", &argv[0][1], "\"", NULL); @@ -570,8 +570,8 @@ CreateCursorFromTableOrFile( TkCursor * TkCreateCursorFromData( 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. */ XColor fgColor, /* Foreground color for cursor. */ diff --git a/unix/tkUnixDialog.c b/unix/tkUnixDialog.c index 1299e90..851edf3 100644 --- a/unix/tkUnixDialog.c +++ b/unix/tkUnixDialog.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: tkUnixDialog.c,v 1.6 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixDialog.c,v 1.7 2008/04/27 22:39:13 dkf Exp $ * */ @@ -42,7 +42,7 @@ EvalObjv( Tcl_Interp *interp, /* Current interpreter. */ char *cmdName, /* Name of the TCL command to call */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Arguments. */ + Tcl_Obj *const *objv) /* Arguments. */ { Tcl_Obj *cmdObj, **objs; int result; @@ -85,7 +85,7 @@ Tk_ChooseColorObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Arguments. */ + Tcl_Obj *const *objv) /* Arguments. */ { return EvalObjv(interp, "tk::ColorDialog", objc-1, objv+1); } @@ -114,9 +114,9 @@ Tk_GetOpenFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Arguments. */ + Tcl_Obj *const *objv) /* Arguments. */ { - Tk_Window tkwin = (Tk_Window)clientData; + Tk_Window tkwin = clientData; if (Tk_StrictMotif(tkwin)) { return EvalObjv(interp, "tk::MotifOpenFDialog", objc-1, objv+1); @@ -146,9 +146,9 @@ Tk_GetSaveFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Arguments. */ + Tcl_Obj *const *objv) /* Arguments. */ { - Tk_Window tkwin = (Tk_Window)clientData; + Tk_Window tkwin = clientData; if (Tk_StrictMotif(tkwin)) { return EvalObjv(interp, "tk::MotifSaveFDialog", objc-1, objv+1); @@ -180,7 +180,7 @@ Tk_MessageBoxCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST *objv) /* Arguments. */ + Tcl_Obj *const *objv) /* Arguments. */ { return EvalObjv(interp, "tk::MessageBox", objc-1, objv+1); } diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index 9b93cb6..028d081 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.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: tkUnixEmbed.c,v 1.12 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixEmbed.c,v 1.13 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -97,7 +97,7 @@ TkpUseWindow( * string is bogus. */ Tk_Window tkwin, /* Tk window that does not yet have an * associated X window. */ - CONST char *string) /* String identifying an X window to use for + const char *string) /* String identifying an X window to use for * tkwin; must be an integer value. */ { TkWindow *winPtr = (TkWindow *) tkwin; @@ -867,7 +867,7 @@ TkpTestembedCmd( 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. */ { int all; Container *containerPtr; diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index bb66552..8335b09 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.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: tkUnixEvent.c,v 1.27 2008/03/26 19:04:10 jenglish Exp $ + * RCS: @(#) $Id: tkUnixEvent.c,v 1.28 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -115,7 +115,7 @@ DisplayExitHandler( TkDisplay * TkpOpenDisplay( - CONST char *displayNameStr) + const char *displayNameStr) { TkDisplay *dispPtr; Display *display = XOpenDisplay(displayNameStr); diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index d97723b..286ac32 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixFont.c,v 1.33 2007/02/28 09:23:30 dkf Exp $ + * RCS: @(#) $Id: tkUnixFont.c,v 1.34 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -21,7 +21,7 @@ * The preferred font encodings. */ -static CONST char *encodingList[] = { +static const char *encodingList[] = { "iso8859-1", "jis0208", "jis0212", NULL }; @@ -207,31 +207,31 @@ static void FontPkgCleanup(ClientData clientData); static FontFamily * AllocFontFamily(Display *display, XFontStruct *fontStructPtr, int base); static SubFont * CanUseFallback(UnixFont *fontPtr, - CONST char *fallbackName, int ch, + const char *fallbackName, int ch, SubFont **fixSubFontPtrPtr); static SubFont * CanUseFallbackWithAliases(UnixFont *fontPtr, char *fallbackName, int ch, Tcl_DString *nameTriedPtr, SubFont **fixSubFontPtrPtr); -static int ControlUtfProc(ClientData clientData, CONST char *src, +static int ControlUtfProc(ClientData clientData, const char *src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static XFontStruct * CreateClosestFont(Tk_Window tkwin, - CONST TkFontAttributes *faPtr, - CONST TkXLFDAttributes *xaPtr); + const TkFontAttributes *faPtr, + const TkXLFDAttributes *xaPtr); static SubFont * FindSubFontForChar(UnixFont *fontPtr, int ch, SubFont **fixSubFontPtrPtr); static void FontMapInsert(SubFont *subFontPtr, int ch); static void FontMapLoadPage(SubFont *subFontPtr, int row); static int FontMapLookup(SubFont *subFontPtr, int ch); static void FreeFontFamily(FontFamily *afPtr); -static CONST char * GetEncodingAlias(CONST char *name); +static const char * GetEncodingAlias(const char *name); static int GetFontAttributes(Display *display, XFontStruct *fontStructPtr, FontAttributes *faPtr); static XFontStruct * GetScreenFont(Display *display, FontAttributes *wantPtr, char **nameList, - int bestIdx[], unsigned int bestScore[]); + int bestIdx[], unsigned bestScore[]); static XFontStruct * GetSystemFont(Display *display); static int IdentifySymbolEncodings(FontAttributes *faPtr); static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr, @@ -239,21 +239,21 @@ static void InitFont(Tk_Window tkwin, XFontStruct *fontStructPtr, static void InitSubFont(Display *display, XFontStruct *fontStructPtr, int base, SubFont *subFontPtr); -static char ** ListFonts(Display *display, CONST char *faceName, +static char ** ListFonts(Display *display, const char *faceName, int *numNamesPtr); -static char ** ListFontOrAlias(Display *display, CONST char*faceName, +static char ** ListFontOrAlias(Display *display, const char*faceName, int *numNamesPtr); -static unsigned int RankAttributes(FontAttributes *wantPtr, +static unsigned RankAttributes(FontAttributes *wantPtr, FontAttributes *gotPtr); static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); -static int SeenName(CONST char *name, Tcl_DString *dsPtr); +static int SeenName(const char *name, Tcl_DString *dsPtr); #ifndef WORDS_BIGENDIAN -static int Ucs2beToUtfProc(ClientData clientData, CONST char*src, +static int Ucs2beToUtfProc(ClientData clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); -static int UtfToUcs2beProc(ClientData clientData, CONST char*src, +static int UtfToUcs2beProc(ClientData clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); @@ -281,7 +281,7 @@ static void FontPkgCleanup( ClientData clientData) { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->controlFamily.encoding != NULL) { @@ -320,7 +320,7 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_EncodingType type; SubFont dummy; @@ -382,7 +382,7 @@ TkpFontPkgInit( static int ControlUtfProc( ClientData clientData, /* Not used. */ - CONST char *src, /* Source string in UTF-8. */ + const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state @@ -406,7 +406,7 @@ ControlUtfProc( * correspond to the bytes stored in the * output buffer. */ { - CONST char *srcStart, *srcEnd; + const char *srcStart, *srcEnd; char *dstStart, *dstEnd; Tcl_UniChar ch; int result; @@ -475,7 +475,7 @@ ControlUtfProc( static int Ucs2beToUtfProc( ClientData clientData, /* Not used. */ - CONST char *src, /* Source string in Unicode. */ + const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state @@ -499,7 +499,7 @@ Ucs2beToUtfProc( * correspond to the bytes stored in the * output buffer. */ { - CONST char *srcStart, *srcEnd; + const char *srcStart, *srcEnd; char *dstEnd, *dstStart; int result, numChars; @@ -558,7 +558,7 @@ static int UtfToUcs2beProc( ClientData clientData, /* TableEncodingData that specifies * encoding. */ - CONST char *src, /* Source string in UTF-8. */ + const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ Tcl_EncodingState *statePtr,/* Place for conversion routine to store state @@ -582,7 +582,7 @@ UtfToUcs2beProc( * correspond to the bytes stored in the * output buffer. */ { - CONST char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; + const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; Tcl_UniChar ch; @@ -658,12 +658,12 @@ UtfToUcs2beProc( TkFont * TkpGetNativeFont( Tk_Window tkwin, /* For display where font will be used. */ - CONST char *name) /* Platform-specific font name. */ + const char *name) /* Platform-specific font name. */ { UnixFont *fontPtr; XFontStruct *fontStructPtr; FontAttributes fa; - CONST char *p; + const char *p; int hasSpace, dashes, hasWild; /* @@ -765,7 +765,7 @@ TkpGetFontFromAttributes( * will be released. If NULL, a new TkFont * structure is allocated. */ Tk_Window tkwin, /* For display where font will be used. */ - CONST TkFontAttributes *faPtr) + const TkFontAttributes *faPtr) /* Set of attributes to match. */ { UnixFont *fontPtr; @@ -960,6 +960,7 @@ TkpGetFontAttrsForChar( SubFont *thisSubFontPtr = FindSubFontForChar(fontPtr, c, &lastSubFontPtr); /* Pointer to the subfont to use for the given * character */ + GetFontAttributes(Tk_Display(tkwin), thisSubFontPtr->fontStructPtr, &atts); *faPtr = atts.fa; } @@ -988,7 +989,7 @@ TkpGetFontAttrsForChar( int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ int numBytes, /* Maximum number of bytes to consider from * source string. */ @@ -1027,7 +1028,7 @@ Tk_MeasureChars( curX = 0; curByte = 0; } else if (maxLength < 0) { - CONST char *p, *end, *next; + const char *p, *end, *next; Tcl_UniChar ch; SubFont *thisSubFontPtr; FontFamily *familyPtr; @@ -1080,7 +1081,7 @@ Tk_MeasureChars( Tcl_DStringFree(&runString); curByte = numBytes; } else { - CONST char *p, *end, *next, *term; + const char *p, *end, *next, *term; int newX, termX, sawNonSpace, dstWrote; Tcl_UniChar ch; FontFamily *familyPtr; @@ -1202,7 +1203,7 @@ Tk_MeasureChars( int TkpMeasureCharsInContext( Tk_Font tkfont, /* Font in which characters will be drawn. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ int numBytes, /* Maximum number of bytes to consider from * source string in all. */ @@ -1255,7 +1256,7 @@ Tk_DrawChars( GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; * must be the same as font used in GC. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that @@ -1266,22 +1267,20 @@ Tk_DrawChars( int x, int y) /* Coordinates at which to place origin of * string when drawing. */ { - UnixFont *fontPtr; + UnixFont *fontPtr = (UnixFont *) tkfont; SubFont *thisSubFontPtr, *lastSubFontPtr; Tcl_DString runString; - CONST char *p, *end, *next; + const char *p, *end, *next; int xStart, needWidth, window_width, do_width; Tcl_UniChar ch; FontFamily *familyPtr; #ifdef TK_DRAW_CHAR_XWINDOW_CHECK int rx, ry; - unsigned int width, height, border_width, depth; + unsigned width, height, border_width, depth; Drawable root; #endif - fontPtr = (UnixFont *) tkfont; lastSubFontPtr = &fontPtr->subFontArray[0]; - xStart = x; #ifdef TK_DRAW_CHAR_XWINDOW_CHECK @@ -1394,7 +1393,7 @@ TkpDrawCharsInContext( GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; * must be the same as font used in GC. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that @@ -1443,9 +1442,9 @@ TkpDrawCharsInContext( static XFontStruct * CreateClosestFont( Tk_Window tkwin, /* For display where font will be used. */ - CONST TkFontAttributes *faPtr, + const TkFontAttributes *faPtr, /* Set of generic attributes to match. */ - CONST TkXLFDAttributes *xaPtr) + const TkXLFDAttributes *xaPtr) /* Set of X-specific attributes to match. */ { FontAttributes want; @@ -1453,7 +1452,7 @@ CreateClosestFont( int numNames, nameIdx, bestIdx[2]; Display *display; XFontStruct *fontStructPtr; - unsigned int bestScore[2]; + unsigned bestScore[2]; want.fa = *faPtr; want.xa = *xaPtr; @@ -1515,12 +1514,12 @@ CreateClosestFont( found: bestIdx[0] = -1; bestIdx[1] = -1; - bestScore[0] = (unsigned int) -1; - bestScore[1] = (unsigned int) -1; + bestScore[0] = (unsigned) -1; + bestScore[1] = (unsigned) -1; for (nameIdx = 0; nameIdx < numNames; nameIdx++) { FontAttributes got; int scalable; - unsigned int score; + unsigned score; if (TkFontParseXLFD(nameList[nameIdx], &got.fa, &got.xa) != TCL_OK) { continue; @@ -1576,7 +1575,7 @@ InitFont( UnixFont *fontPtr) /* Filled with information constructed from * the above arguments. */ { - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); unsigned long value; int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n; @@ -1829,7 +1828,7 @@ AllocFontFamily( FontFamily *familyPtr; FontAttributes fa; Tcl_Encoding encoding; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); GetFontAttributes(display, fontStructPtr, &fa); @@ -1903,7 +1902,7 @@ FreeFontFamily( FontFamily *familyPtr) /* The FontFamily to delete. */ { FontFamily **familyPtrPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; @@ -2206,7 +2205,7 @@ FontMapLoadPage( Tcl_Encoding encoding; XFontStruct *fontStructPtr; XCharStruct *widths; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); subFontPtr->fontMap[row] = (char *) ckalloc(FONTMAP_BITSPERPAGE / 8); @@ -2343,11 +2342,11 @@ CanUseFallbackWithAliases( static int SeenName( - CONST char *name, /* The name to check. */ + const char *name, /* The name to check. */ Tcl_DString *dsPtr) /* Contains names that have already been * seen. */ { - CONST char *seen, *end; + const char *seen, *end; seen = Tcl_DStringValue(dsPtr); end = seen + Tcl_DStringLength(dsPtr); @@ -2392,7 +2391,7 @@ static SubFont * CanUseFallback( UnixFont *fontPtr, /* The font object that will own the new * screen font. */ - CONST char *faceName, /* Desired face name for new screen font. */ + const char *faceName, /* Desired face name for new screen font. */ int ch, /* The Unicode character that the new screen * font must be able to display. */ SubFont **fixSubFontPtrPtr) /* Subfont reference to fix up if we @@ -2400,8 +2399,8 @@ CanUseFallback( { int i, nameIdx, numNames, srcLen, numEncodings, bestIdx[2]; Tk_Uid hateFoundry; - CONST char *charset, *hateCharset; - unsigned int bestScore[2]; + const char *charset, *hateCharset; + unsigned bestScore[2]; char **nameList, **nameListOrig, src[TCL_UTF_MAX]; FontAttributes want, got; Display *display; @@ -2450,13 +2449,13 @@ CanUseFallback( retry: bestIdx[0] = -1; bestIdx[1] = -1; - bestScore[0] = (unsigned int) -1; - bestScore[1] = (unsigned int) -1; + bestScore[0] = (unsigned) -1; + bestScore[1] = (unsigned) -1; for (nameIdx = 0; nameIdx < numNames; nameIdx++) { Tcl_Encoding encoding; char dst[16]; int scalable, srcRead, dstWrote; - unsigned int score; + unsigned score; if (nameList[nameIdx] == NULL) { continue; @@ -2624,12 +2623,12 @@ CanUseFallback( *--------------------------------------------------------------------------- */ -static unsigned int +static unsigned RankAttributes( FontAttributes *wantPtr, /* The desired attributes. */ FontAttributes *gotPtr) /* The attributes we have to live with. */ { - unsigned int penalty; + unsigned penalty; penalty = 0; if (gotPtr->xa.foundry != wantPtr->xa.foundry) { @@ -2676,7 +2675,7 @@ RankAttributes( } if (gotPtr->xa.charset != wantPtr->xa.charset) { int i; - CONST char *gotAlias, *wantAlias; + const char *gotAlias, *wantAlias; penalty += 65000; gotAlias = GetEncodingAlias(gotPtr->xa.charset); @@ -2721,7 +2720,7 @@ GetScreenFont( char **nameList, /* Array of XLFDs. */ int bestIdx[2], /* Indices into above array for XLFD of best * bitmapped and best scalable font. */ - unsigned int bestScore[2]) /* Scores of best bitmapped and best scalable + unsigned bestScore[2]) /* Scores of best bitmapped and best scalable * font. XLFD corresponding to lowest score * will be constructed. */ { @@ -2890,7 +2889,7 @@ GetFontAttributes( static char ** ListFonts( Display *display, /* Display to query. */ - CONST char *faceName, /* Desired face name, or "*" for all. */ + const char *faceName, /* Desired face name, or "*" for all. */ int *numNamesPtr) /* Filled with length of returned array, or 0 * if no names were found. */ { @@ -2903,7 +2902,7 @@ ListFonts( static char ** ListFontOrAlias( Display *display, /* Display to query. */ - CONST char *faceName, /* Desired face name, or "*" for all. */ + const char *faceName, /* Desired face name, or "*" for all. */ int *numNamesPtr) /* Filled with length of returned array, or 0 * if no names were found. */ { @@ -2995,9 +2994,9 @@ IdentifySymbolEncodings( *--------------------------------------------------------------------------- */ -static CONST char * +static const char * GetEncodingAlias( - CONST char *name) /* The name to look up. */ + const char *name) /* The name to look up. */ { EncodingAlias *aliasPtr; diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c index 50797f2..7c07e4d 100644 --- a/unix/tkUnixInit.c +++ b/unix/tkUnixInit.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: tkUnixInit.c,v 1.10 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixInit.c,v 1.11 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -69,7 +69,7 @@ TkpGetAppName( Tcl_Interp *interp, Tcl_DString *namePtr) /* A previously initialized Tcl_DString. */ { - CONST char *p, *name; + const char *p, *name; name = Tcl_GetVar(interp, "argv0", TCL_GLOBAL_ONLY); if ((name == NULL) || (*name == 0)) { @@ -102,10 +102,11 @@ TkpGetAppName( void TkpDisplayWarning( - CONST char *msg, /* Message to be displayed. */ - CONST char *title) /* Title of warning. */ + const char *msg, /* Message to be displayed. */ + const char *title) /* Title of warning. */ { Tcl_Channel errChannel = Tcl_GetStdChannel(TCL_STDERR); + if (errChannel) { Tcl_WriteChars(errChannel, title, -1); Tcl_WriteChars(errChannel, ": ", 2); diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 0fcadb6..ec77732 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixMenu.c,v 1.19 2007/12/13 15:28:50 dgp Exp $ + * RCS: @(#) $Id: tkUnixMenu.c,v 1.20 2008/04/27 22:39:13 dkf Exp $ */ #include "default.h" @@ -53,7 +53,7 @@ MODULE_SCOPE void TkpDrawCheckIndicator(Tk_Window tkwin, static void SetHelpMenu(TkMenu *menuPtr); static void DrawMenuEntryAccelerator(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d, GC gc, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, Tk_3DBorder activeBorder, int x, int y, int width, int height, int drawArrow); static void DrawMenuEntryBackground(TkMenu *menuPtr, @@ -64,42 +64,42 @@ static void DrawMenuEntryIndicator(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d, Tk_3DBorder border, XColor *indicatorColor, XColor *disableColor, Tk_Font tkfont, - CONST Tk_FontMetrics *fmPtr, int x, int y, + const Tk_FontMetrics *fmPtr, int x, int y, int width, int height); static void DrawMenuEntryLabel(TkMenu * menuPtr, TkMenuEntry *mePtr, Drawable d, GC gc, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y, int width, int height); static void DrawMenuSeparator(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d, GC gc, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y, int width, int height); static void DrawTearoffEntry(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d, GC gc, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y, int width, int height); static void DrawMenuUnderline(TkMenu *menuPtr, TkMenuEntry *mePtr, Drawable d, GC gc, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int x, int y, int width, int height); static void GetMenuAccelGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, - CONST Tk_FontMetrics *fmPtr, int *widthPtr, + const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetMenuLabelGeometry(TkMenuEntry *mePtr, - Tk_Font tkfont, CONST Tk_FontMetrics *fmPtr, + Tk_Font tkfont, const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetMenuIndicatorGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, - CONST Tk_FontMetrics *fmPtr, + const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetMenuSeparatorGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, - CONST Tk_FontMetrics *fmPtr, + const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); static void GetTearoffEntryGeometry(TkMenu *menuPtr, TkMenuEntry *mePtr, Tk_Font tkfont, - CONST Tk_FontMetrics *fmPtr, int *widthPtr, + const Tk_FontMetrics *fmPtr, int *widthPtr, int *heightPtr); /* @@ -326,7 +326,7 @@ GetMenuIndicatorGeometry( TkMenu *menuPtr, /* The menu we are drawing. */ TkMenuEntry *mePtr, /* The entry we are interested in. */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { @@ -393,7 +393,7 @@ GetMenuAccelGeometry( TkMenu *menuPtr, /* The menu was are drawing */ TkMenuEntry *mePtr, /* The entry we are getting the geometry for */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The width of the acclerator area */ int *heightPtr) /* The height of the accelerator area */ { @@ -485,7 +485,7 @@ DrawMenuEntryAccelerator( Drawable d, /* The drawable we are drawing into */ GC gc, /* The precalculated gc to draw with */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated metrics */ Tk_3DBorder activeBorder, /* The border for an active item */ int x, /* Left coordinate of entry rect */ int y, /* Top coordinate of entry rect */ @@ -559,7 +559,7 @@ DrawMenuEntryIndicator( XColor *indicatorColor, /* The color to draw indicators with */ XColor *disableColor, /* The color use use when disabled */ Tk_Font tkfont, /* The font to draw with */ - CONST Tk_FontMetrics *fmPtr,/* The font metrics of the font */ + const Tk_FontMetrics *fmPtr,/* The font metrics of the font */ int x, /* The left of the entry rect */ int y, /* The top of the entry rect */ int width, /* Width of menu entry */ @@ -631,7 +631,7 @@ DrawMenuSeparator( Drawable d, /* The drawable we are using */ GC gc, /* The gc to draw into */ Tk_Font tkfont, /* The font to draw with */ - CONST Tk_FontMetrics *fmPtr,/* The font metrics from the font */ + const Tk_FontMetrics *fmPtr,/* The font metrics from the font */ int x, int y, int width, int height) { @@ -674,7 +674,7 @@ DrawMenuEntryLabel( Drawable d, /* What we are drawing into. */ GC gc, /* The gc we are drawing into.*/ Tk_Font tkfont, /* The precalculated font. */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */ + const Tk_FontMetrics *fmPtr,/* The precalculated font metrics. */ int x, /* Left edge. */ int y, /* Top edge. */ int width, /* width of entry. */ @@ -851,7 +851,7 @@ DrawMenuUnderline( Drawable d, /* What we are drawing into */ GC gc, /* The gc to draw into */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, int width, int height) { @@ -865,7 +865,7 @@ DrawMenuUnderline( Tcl_GetUnicodeFromObj(mePtr->labelPtr, &len); if (mePtr->underline < len) { int activeBorderWidth, leftEdge; - CONST char *label, *start, *end; + const char *label, *start, *end; label = Tcl_GetStringFromObj(mePtr->labelPtr, NULL); start = Tcl_UtfAtIndex(label, mePtr->underline); @@ -931,7 +931,7 @@ GetMenuSeparatorGeometry( TkMenu *menuPtr, /* The menu we are measuring */ TkMenuEntry *mePtr, /* The entry we are measuring */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */ + const Tk_FontMetrics *fmPtr,/* The precalcualted font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { @@ -960,7 +960,7 @@ GetTearoffEntryGeometry( TkMenu *menuPtr, /* The menu we are drawing */ TkMenuEntry *mePtr, /* The entry we are measuring */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { @@ -1181,7 +1181,7 @@ DrawTearoffEntry( Drawable d, /* The drawable we are drawing into */ GC gc, /* The gc we are drawing with */ Tk_Font tkfont, /* The font we are drawing with */ - CONST Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */ + const Tk_FontMetrics *fmPtr,/* The metrics we are drawing with */ int x, int y, int width, int height) { @@ -1310,7 +1310,7 @@ TkpDrawMenuEntry( TkMenuEntry *mePtr, /* The entry to draw */ Drawable d, /* What to draw into */ Tk_Font tkfont, /* Precalculated font for menu */ - CONST Tk_FontMetrics *menuMetricsPtr, + const Tk_FontMetrics *menuMetricsPtr, /* Precalculated metrics for menu */ int x, /* X-coordinate of topleft of entry */ int y, /* Y-coordinate of topleft of entry */ @@ -1325,7 +1325,7 @@ TkpDrawMenuEntry( XColor *indicatorColor, *disableColor = NULL; TkMenu *menuPtr = mePtr->menuPtr; Tk_3DBorder bgBorder, activeBorder; - CONST Tk_FontMetrics *fmPtr; + const Tk_FontMetrics *fmPtr; Tk_FontMetrics entryMetrics; int padY = (menuPtr->menuType == MENUBAR) ? 3 : 0; int adjustedY = y + padY; @@ -1460,7 +1460,7 @@ static void GetMenuLabelGeometry( TkMenuEntry *mePtr, /* The entry we are computing */ Tk_Font tkfont, /* The precalculated font */ - CONST Tk_FontMetrics *fmPtr,/* The precalculated metrics */ + const Tk_FontMetrics *fmPtr,/* The precalculated metrics */ int *widthPtr, /* The resulting width of the label portion */ int *heightPtr) /* The resulting height of the label * portion */ diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index 73e091c..3bea31f 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.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: tkUnixRFont.c,v 1.24 2008/03/12 16:35:27 jenglish Exp $ + * RCS: @(#) $Id: tkUnixRFont.c,v 1.25 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -303,7 +303,7 @@ FinishedWithFont( TkFont * TkpGetNativeFont( Tk_Window tkwin, /* For display where font will be used. */ - CONST char *name) /* Platform-specific font name. */ + const char *name) /* Platform-specific font name. */ { UnixFtFont *fontPtr; FcPattern *pattern; @@ -337,7 +337,7 @@ TkpGetFontFromAttributes( * will be released. If NULL, a new TkFont * structure is allocated. */ Tk_Window tkwin, /* For display where font will be used. */ - CONST TkFontAttributes *faPtr) + const TkFontAttributes *faPtr) /* Set of attributes to match. */ { XftPattern *pattern; @@ -524,7 +524,7 @@ TkpGetFontAttrsForChar( int Tk_MeasureChars( Tk_Font tkfont, /* Font in which characters will be drawn. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. */ int numBytes, /* Maximum number of bytes to consider from * source string. */ @@ -620,7 +620,7 @@ Tk_MeasureChars( int TkpMeasureCharsInContext( Tk_Font tkfont, - CONST char *source, + const char *source, int numBytes, int rangeStart, int rangeLength, @@ -643,7 +643,7 @@ Tk_DrawChars( GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; * must be the same as font used in GC. */ - CONST char *source, /* UTF-8 string to be displayed. Need not be + const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index b2083f3..9a0aacf 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.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: tkUnixSend.c,v 1.20 2007/12/13 15:28:51 dgp Exp $ + * RCS: @(#) $Id: tkUnixSend.c,v 1.21 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -79,7 +79,7 @@ typedef struct NameRegistry { typedef struct PendingCommand { int serial; /* Serial number expected in result. */ TkDisplay *dispPtr; /* Display being used for communication. */ - CONST char *target; /* Name of interpreter command is being sent + const char *target; /* Name of interpreter command is being sent * to. */ Window commWindow; /* Target's communication window. */ Tcl_Interp *interp; /* Interpreter from which the send was @@ -212,10 +212,10 @@ static void AppendPropCarefully(Display *display, int length, PendingCommand *pendingPtr); static void DeleteProc(ClientData clientData); static void RegAddName(NameRegistry *regPtr, - CONST char *name, Window commWindow); + const char *name, Window commWindow); static void RegClose(NameRegistry *regPtr); -static void RegDeleteName(NameRegistry *regPtr, CONST char *name); -static Window RegFindName(NameRegistry *regPtr, CONST char *name); +static void RegDeleteName(NameRegistry *regPtr, const char *name); +static Window RegFindName(NameRegistry *regPtr, const char *name); static NameRegistry * RegOpen(Tcl_Interp *interp, TkDisplay *dispPtr, int lock); static void SendEventProc(ClientData clientData, XEvent *eventPtr); @@ -224,7 +224,7 @@ static Tk_RestrictAction SendRestrictProc(ClientData clientData, XEvent *eventPtr); static int ServerSecure(TkDisplay *dispPtr); static void UpdateCommWindow(TkDisplay *dispPtr); -static int ValidateName(TkDisplay *dispPtr, CONST char *name, +static int ValidateName(TkDisplay *dispPtr, const char *name, Window commWindow, int oldOK); /* @@ -349,7 +349,7 @@ static Window RegFindName( NameRegistry *regPtr, /* Pointer to a registry opened with a * previous call to RegOpen. */ - CONST char *name) /* Name of an application. */ + const char *name) /* Name of an application. */ { char *p; @@ -360,7 +360,7 @@ RegFindName( p++; } if ((*p != 0) && (strcmp(name, p+1) == 0)) { - unsigned int id; + unsigned id; if (sscanf(entry, "%x", &id) == 1) { /* @@ -402,7 +402,7 @@ static void RegDeleteName( NameRegistry *regPtr, /* Pointer to a registry opened with a * previous call to RegOpen. */ - CONST char *name) /* Name of an application. */ + const char *name) /* Name of an application. */ { char *p; @@ -464,7 +464,7 @@ static void RegAddName( NameRegistry *regPtr, /* Pointer to a registry opened with a * previous call to RegOpen. */ - CONST char *name, /* Name of an application. The caller must + const char *name, /* Name of an application. The caller must * ensure that this name isn't already * registered. */ Window commWindow) /* X identifier for comm. window of @@ -473,7 +473,7 @@ RegAddName( char id[30], *newProp; int idLength, newBytes; - sprintf(id, "%x ", (unsigned int) commWindow); + sprintf(id, "%x ", (unsigned) commWindow); idLength = strlen(id); newBytes = idLength + strlen(name) + 1; newProp = ckalloc((unsigned) (regPtr->propLength + newBytes)); @@ -575,7 +575,7 @@ static int ValidateName( TkDisplay *dispPtr, /* Display for which to perform the * validation. */ - CONST char *name, /* The name of an application. */ + const char *name, /* The name of an application. */ Window commWindow, /* X identifier for the application's comm. * window. */ int oldOK) /* Non-zero means that we should consider an @@ -588,7 +588,7 @@ ValidateName( Atom actualType; char *property, **propertyPtr = &property; Tk_ErrorHandler handler; - CONST char **argv; + const char **argv; property = NULL; @@ -716,12 +716,12 @@ ServerSecure( *-------------------------------------------------------------- */ -CONST char * +const char * Tk_SetAppName( Tk_Window tkwin, /* Token for any window in the application to * be named: it is just used to identify the * application and the display. */ - CONST char *name) /* The name that will be used to refer to the + const char *name) /* The name that will be used to refer to the * interpreter in later "send" commands. Must * be globally unique. */ { @@ -731,10 +731,10 @@ Tk_SetAppName( TkDisplay *dispPtr = winPtr->dispPtr; NameRegistry *regPtr; Tcl_Interp *interp; - CONST char *actualName; + const char *actualName; Tcl_DString dString; int offset, i; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); interp = winPtr->mainPtr->interp; @@ -762,8 +762,7 @@ Tk_SetAppName( riPtr->nextPtr = tsdPtr->interpListPtr; tsdPtr->interpListPtr = riPtr; riPtr->name = NULL; - Tcl_CreateCommand(interp, "send", Tk_SendCmd, (ClientData) riPtr, - DeleteProc); + Tcl_CreateCommand(interp, "send", Tk_SendCmd, riPtr, DeleteProc); if (Tcl_IsSafe(interp)) { Tcl_HideCommand(interp, "send", "send"); } @@ -874,13 +873,13 @@ Tk_SendCmd( * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ - CONST char **argv) /* Argument strings. */ + const char **argv) /* Argument strings. */ { TkWindow *winPtr; Window commWindow; PendingCommand pending; register RegisteredInterp *riPtr; - CONST char *destName; + const char *destName; int result, c, async, i, firstArg; size_t length; Tk_RestrictProc *prevRestrictProc; @@ -889,7 +888,7 @@ Tk_SendCmd( Tcl_Time timeout; NameRegistry *regPtr; Tcl_DString request; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *localInterp; /* Used when the interpreter to send the * command to is within the same process. */ @@ -956,9 +955,9 @@ Tk_SendCmd( || (strcmp(riPtr->name, destName) != 0)) { continue; } - Tcl_Preserve((ClientData) riPtr); + Tcl_Preserve(riPtr); localInterp = riPtr->interp; - Tcl_Preserve((ClientData) localInterp); + Tcl_Preserve(localInterp); if (firstArg == (argc-1)) { result = Tcl_GlobalEval(localInterp, argv[firstArg]); } else { @@ -994,8 +993,8 @@ Tk_SendCmd( Tcl_SetObjResult(interp, Tcl_GetObjResult(localInterp)); Tcl_ResetResult(localInterp); } - Tcl_Release((ClientData) riPtr); - Tcl_Release((ClientData) localInterp); + Tcl_Release(riPtr); + Tcl_Release(localInterp); return result; } @@ -1024,7 +1023,7 @@ Tk_SendCmd( char buffer[TCL_INTEGER_SPACE * 2]; sprintf(buffer, "%x %d", - (unsigned int) Tk_WindowId(dispPtr->commTkwin), + (unsigned) Tk_WindowId(dispPtr->commTkwin), localData.sendSerial); Tcl_DStringAppend(&request, "\0-r ", 4); Tcl_DStringAppend(&request, buffer, -1); @@ -1178,9 +1177,9 @@ TkGetInterpNames( for (p=regPtr->property ; p-regPtr->property<(int)regPtr->propLength ;) { char *entry = p, *entryName; Window commWindow; - unsigned int id; + unsigned id; - if (sscanf(p, "%x",(unsigned int *) &id) != 1) { + if (sscanf(p, "%x", (unsigned *) &id) != 1) { commWindow = None; } else { commWindow = id; @@ -1250,9 +1249,9 @@ TkSendCleanup( { if (dispPtr->commTkwin != NULL) { Tk_DeleteEventHandler(dispPtr->commTkwin, PropertyChangeMask, - SendEventProc, (ClientData) dispPtr); + SendEventProc, dispPtr); Tk_DestroyWindow(dispPtr->commTkwin); - Tcl_Release((ClientData) dispPtr->commTkwin); + Tcl_Release(dispPtr->commTkwin); dispPtr->commTkwin = NULL; } } @@ -1293,12 +1292,12 @@ SendInit( if (dispPtr->commTkwin == NULL) { Tcl_Panic("Tk_CreateWindow failed in SendInit!"); } - Tcl_Preserve((ClientData) dispPtr->commTkwin); + Tcl_Preserve(dispPtr->commTkwin); atts.override_redirect = True; Tk_ChangeWindowAttributes(dispPtr->commTkwin, CWOverrideRedirect, &atts); Tk_CreateEventHandler(dispPtr->commTkwin, PropertyChangeMask, - SendEventProc, (ClientData) dispPtr); + SendEventProc, dispPtr); Tk_MakeWindowExist(dispPtr->commTkwin); /* @@ -1339,14 +1338,14 @@ SendEventProc( ClientData clientData, /* Display information. */ XEvent *eventPtr) /* Information about event. */ { - TkDisplay *dispPtr = (TkDisplay *) clientData; + TkDisplay *dispPtr = clientData; char *propInfo, **propInfoPtr = &propInfo; register char *p; int result, actualFormat; unsigned long numItems, bytesAfter; Atom actualType; Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */ - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((eventPtr->xproperty.atom != dispPtr->commProperty) @@ -1485,7 +1484,7 @@ SendEventProc( break; } } - Tcl_Preserve((ClientData) riPtr); + Tcl_Preserve(riPtr); /* * We must protect the interpreter because the script may enter @@ -1493,7 +1492,7 @@ SendEventProc( */ remoteInterp = riPtr->interp; - Tcl_Preserve((ClientData) remoteInterp); + Tcl_Preserve(remoteInterp); result = Tcl_GlobalEval(remoteInterp, script); @@ -1508,7 +1507,7 @@ SendEventProc( Tcl_DStringAppend(&reply, Tcl_GetStringResult(remoteInterp), -1); if (result == TCL_ERROR) { - CONST char *varValue; + const char *varValue; varValue = Tcl_GetVar2(remoteInterp, "errorInfo", NULL, TCL_GLOBAL_ONLY); @@ -1524,8 +1523,8 @@ SendEventProc( } } } - Tcl_Release((ClientData) remoteInterp); - Tcl_Release((ClientData) riPtr); + Tcl_Release(remoteInterp); + Tcl_Release(riPtr); /* * Return the result to the sender if a commWindow was specified @@ -1617,19 +1616,19 @@ SendEventProc( } pcPtr->code = code; if (resultString != NULL) { - pcPtr->result = (char *) ckalloc((unsigned) - (strlen(resultString) + 1)); + pcPtr->result = + ckalloc((unsigned) (strlen(resultString) + 1)); strcpy(pcPtr->result, resultString); } if (code == TCL_ERROR) { if (errorInfo != NULL) { - pcPtr->errorInfo = (char *) ckalloc((unsigned) - (strlen(errorInfo) + 1)); + pcPtr->errorInfo = + ckalloc((unsigned) (strlen(errorInfo) + 1)); strcpy(pcPtr->errorInfo, errorInfo); } if (errorCode != NULL) { - pcPtr->errorCode = (char *) ckalloc((unsigned) - (strlen(errorCode) + 1)); + pcPtr->errorCode = + ckalloc((unsigned) (strlen(errorCode) + 1)); strcpy(pcPtr->errorCode, errorCode); } } @@ -1685,7 +1684,7 @@ AppendPropCarefully( Tk_ErrorHandler handler; handler = Tk_CreateErrorHandler(display, -1, -1, -1, AppendErrorProc, - (ClientData) pendingPtr); + pendingPtr); XChangeProperty(display, window, property, XA_STRING, 8, PropModeAppend, (unsigned char *) value, length); Tk_DeleteErrorHandler(handler); @@ -1702,9 +1701,9 @@ AppendErrorProc( ClientData clientData, /* Command to mark complete, or NULL. */ XErrorEvent *errorPtr) /* Information about error. */ { - PendingCommand *pendingPtr = (PendingCommand *) clientData; + PendingCommand *pendingPtr = clientData; register PendingCommand *pcPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (pendingPtr == NULL) { @@ -1752,10 +1751,10 @@ DeleteProc( ClientData clientData) /* Info about registration, passed as * ClientData. */ { - RegisteredInterp *riPtr = (RegisteredInterp *) clientData; + RegisteredInterp *riPtr = clientData; register RegisteredInterp *riPtr2; NameRegistry *regPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1); @@ -1776,7 +1775,7 @@ DeleteProc( ckfree((char *) riPtr->name); riPtr->interp = NULL; UpdateCommWindow(riPtr->dispPtr); - Tcl_EventuallyFree((ClientData) riPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(riPtr, TCL_DYNAMIC); } /* @@ -1844,7 +1843,7 @@ UpdateCommWindow( { Tcl_DString names; RegisteredInterp *riPtr; - ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DStringInit(&names); @@ -1883,9 +1882,9 @@ TkpTestsendCmd( 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 = (TkWindow *) clientData; + TkWindow *winPtr = clientData; if (argc < 2) { Tcl_AppendResult(interp, "wrong # args; must be \"", argv[0], diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index d8082ff..e4c250c 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkUnixWm.c,v 1.58 2007/12/13 15:28:51 dgp Exp $ + * RCS: @(#) $Id: tkUnixWm.c,v 1.59 2008/04/27 22:39:13 dkf Exp $ */ #include "tkUnixInt.h" @@ -207,7 +207,7 @@ typedef struct TkWmInfo { ProtocolHandler *protPtr; /* First in list of protocol handlers for this * window (NULL means none). */ int cmdArgc; /* Number of elements in cmdArgv below. */ - CONST char **cmdArgv; /* Array of strings to store in the WM_COMMAND + const char **cmdArgv; /* Array of strings to store in the WM_COMMAND * property. NULL means nothing available. */ char *clientMachine; /* String to store in WM_CLIENT_MACHINE * property, or NULL. */ @@ -363,100 +363,100 @@ static void WrapperEventProc(ClientData clientData, static void WmWaitMapProc(ClientData clientData, XEvent *eventPtr); static int WmAspectCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmAttributesCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmClientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmColormapwindowsCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmCommandCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmDeiconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmFocusmodelCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmForgetCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmFrameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmGeometryCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmGridCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmGroupCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconbitmapCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconifyCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconmaskCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconnameCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconphotoCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconpositionCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmIconwindowCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmManageCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmMaxsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmMinsizeCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmOverrideredirectCmd(Tk_Window tkwin,TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmPositionfromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmProtocolCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmResizableCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmSizefromCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmStackorderCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmStateCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmTitleCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmTransientCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static int WmWithdrawCmd(Tk_Window tkwin, TkWindow *winPtr, Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[]); + Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); /* @@ -511,7 +511,7 @@ void TkWmCleanup( protPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr->nextPtr; - Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); } if (wmPtr->cmdArgv != NULL) { ckfree((char *) wmPtr->cmdArgv); @@ -569,6 +569,7 @@ TkWmNewWindow( /* * Initialize attributes. */ + wmPtr->attributes.alpha = 1.0; wmPtr->attributes.topmost = 0; wmPtr->attributes.zoomed = 0; @@ -724,16 +725,16 @@ TkWmMapWindow( */ if (wmPtr->flags & WM_UPDATE_PENDING) { - Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } - UpdateGeometryInfo((ClientData) winPtr); + UpdateGeometryInfo(winPtr); return; } wmPtr->flags |= WM_ABOUT_TO_MAP; if (wmPtr->flags & WM_UPDATE_PENDING) { - Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } - UpdateGeometryInfo((ClientData) winPtr); + UpdateGeometryInfo(winPtr); wmPtr->flags &= ~WM_ABOUT_TO_MAP; /* @@ -877,11 +878,10 @@ TkWmDeadWindow( Tk_DestroyWindow((Tk_Window) wmPtr->wrapperPtr); } while (wmPtr->protPtr != NULL) { - ProtocolHandler *protPtr; + ProtocolHandler *protPtr = wmPtr->protPtr; - protPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr->nextPtr; - Tcl_EventuallyFree((ClientData) protPtr, TCL_DYNAMIC); + Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); } if (wmPtr->cmdArgv != NULL) { ckfree((char *) wmPtr->cmdArgv); @@ -890,7 +890,7 @@ TkWmDeadWindow( ckfree((char *) wmPtr->clientMachine); } if (wmPtr->flags & WM_UPDATE_PENDING) { - Tcl_CancelIdleCall(UpdateGeometryInfo, (ClientData) winPtr); + Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } /* @@ -902,8 +902,7 @@ TkWmDeadWindow( if (wmPtr2->masterPtr == winPtr) { wmPtr->numTransients--; Tk_DeleteEventHandler((Tk_Window) wmPtr2->masterPtr, - StructureNotifyMask, - WmWaitMapProc, (ClientData) wmPtr2->winPtr); + StructureNotifyMask, WmWaitMapProc, wmPtr2->winPtr); wmPtr2->masterPtr = NULL; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { XDeleteProperty(winPtr->display, wmPtr2->wrapperPtr->window, @@ -999,10 +998,10 @@ Tk_WmObjCmd( 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[] = { + static const char *optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", "frame", "geometry", "grid", "group", "iconbitmap", @@ -1174,7 +1173,7 @@ WmAspectCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; @@ -1371,7 +1370,7 @@ WmAttributesCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int attribute = 0; @@ -1435,7 +1434,7 @@ WmClientCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -1466,8 +1465,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree((char *) wmPtr->clientMachine); } - wmPtr->clientMachine = (char *) - ckalloc((unsigned) (length + 1)); + wmPtr->clientMachine = ckalloc((unsigned) (length + 1)); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -1521,7 +1519,7 @@ WmColormapwindowsCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Window *cmapList; @@ -1621,12 +1619,12 @@ WmCommandCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; int cmdArgc; - CONST char **cmdArgv; + const char **cmdArgv; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -1689,7 +1687,7 @@ WmDeiconifyCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -1735,10 +1733,10 @@ WmFocusmodelCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "active", "passive", NULL }; enum options { OPT_ACTIVE, OPT_PASSIVE }; @@ -1785,12 +1783,12 @@ WmFocusmodelCmd( */ static int -WmForgetCmd(tkwin, winPtr, interp, objc, objv) - Tk_Window tkwin; /* Main window of the application. */ - TkWindow *winPtr; /* Toplevel or Frame to work with */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +WmForgetCmd( + Tk_Window tkwin, /* Main window of the application. */ + TkWindow *winPtr, /* Toplevel or Frame to work with */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Tk_Window frameWin = (Tk_Window)winPtr; @@ -1798,7 +1796,8 @@ WmForgetCmd(tkwin, winPtr, interp, objc, objv) TkFocusJoin(winPtr); Tk_UnmapWindow(frameWin); TkWmDeadWindow(winPtr); - winPtr->flags &= ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); + winPtr->flags &= + ~(TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); RemapWindows(winPtr, winPtr->parentPtr); /* flags (above) must be cleared before calling */ /* TkMapTopFrame (below) */ @@ -1832,7 +1831,7 @@ WmFrameCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; @@ -1874,7 +1873,7 @@ WmGeometryCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; @@ -1937,7 +1936,7 @@ WmGridCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; @@ -2027,7 +2026,7 @@ WmGroupCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; @@ -2103,7 +2102,7 @@ WmIconbitmapCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; @@ -2163,7 +2162,7 @@ WmIconifyCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { @@ -2222,7 +2221,7 @@ WmIconmaskCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; @@ -2281,7 +2280,7 @@ WmIconnameCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -2333,7 +2332,7 @@ WmIconphotoCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_PhotoHandle photo; @@ -2483,7 +2482,7 @@ WmIconpositionCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; @@ -2540,7 +2539,7 @@ WmIconwindowCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; @@ -2650,12 +2649,12 @@ WmIconwindowCmd( */ static int -WmManageCmd(tkwin, winPtr, interp, objc, objv) - Tk_Window tkwin; /* Main window of the application. */ - TkWindow *winPtr; /* Toplevel or Frame to work with */ - Tcl_Interp *interp; /* Current interpreter. */ - int objc; /* Number of arguments. */ - Tcl_Obj *CONST objv[]; /* Argument objects. */ +WmManageCmd( + Tk_Window tkwin, /* Main window of the application. */ + TkWindow *winPtr, /* Toplevel or Frame to work with */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register Tk_Window frameWin = (Tk_Window)winPtr; register WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -2704,7 +2703,7 @@ WmMaxsizeCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -2762,7 +2761,7 @@ WmMinsizeCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -2812,7 +2811,7 @@ WmOverrideredirectCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { int boolean, curValue; XSetWindowAttributes atts; @@ -2870,10 +2869,10 @@ WmPositionfromCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "program", "user", NULL }; enum options { OPT_PROGRAM, OPT_USER }; @@ -2934,7 +2933,7 @@ WmProtocolCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; @@ -3039,7 +3038,7 @@ WmResizableCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; @@ -3099,10 +3098,10 @@ WmSizefromCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "program", "user", NULL }; enum options { OPT_PROGRAM, OPT_USER }; @@ -3164,10 +3163,10 @@ WmStackorderCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { TkWindow **windows, **window_ptr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "isabove", "isbelow", NULL }; enum options { OPT_ISABOVE, OPT_ISBELOW }; @@ -3284,10 +3283,10 @@ WmStateCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - static CONST char *optionStrings[] = { + static const char *optionStrings[] = { "normal", "iconic", "withdrawn", NULL }; enum options { OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN }; @@ -3378,7 +3377,7 @@ WmTitleCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; char *argv3; @@ -3431,7 +3430,7 @@ WmTransientCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr; @@ -3571,7 +3570,7 @@ WmWithdrawCmd( TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ - Tcl_Obj *CONST objv[]) /* Argument objects. */ + Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; @@ -6039,7 +6038,7 @@ TkWmProtocolEventProc( register ProtocolHandler *protPtr; Atom protocol; int result; - CONST char *protocolName; + const char *protocolName; Tcl_Interp *interp; protocol = (Atom) eventPtr->xclient.data.l[0]; diff --git a/unix/tkUnixXId.c b/unix/tkUnixXId.c index af43b7f..0131181 100644 --- a/unix/tkUnixXId.c +++ b/unix/tkUnixXId.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: tkUnixXId.c,v 1.10 2007/12/13 15:28:51 dgp Exp $ + * RCS: @(#) $Id: tkUnixXId.c,v 1.11 2008/04/27 22:39:14 dkf Exp $ */ /* @@ -76,7 +76,7 @@ TkInitXId( TkDisplay *dispPtr) /* Tk's information about the display. */ { dispPtr->idStackPtr = NULL; - dispPtr->defaultAllocProc = (XID (*) _ANSI_ARGS_((Display *display))) + dispPtr->defaultAllocProc = (XID (*) (Display *display)) dispPtr->display->resource_alloc; dispPtr->display->resource_alloc = AllocXId; dispPtr->windowStackPtr = NULL; @@ -324,7 +324,7 @@ TkFreeWindowId( if (!dispPtr->idCleanupScheduled) { dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(100, - WindowIdCleanup, (ClientData) dispPtr); + WindowIdCleanup, dispPtr); } } @@ -351,7 +351,7 @@ static void WindowIdCleanup( ClientData clientData) /* Pointer to TkDisplay for display */ { - TkDisplay *dispPtr = (TkDisplay *) clientData; + TkDisplay *dispPtr = clientData; int anyEvents, delta; Tk_RestrictProc *oldProc; ClientData oldData; @@ -379,8 +379,7 @@ WindowIdCleanup( XSync(dispPtr->display, False); } anyEvents = 0; - oldProc = Tk_RestrictEvents(CheckRestrictProc, (ClientData) &anyEvents, - &oldData); + oldProc = Tk_RestrictEvents(CheckRestrictProc, &anyEvents, &oldData); TkUnixDoOneXEvent(&timeout); Tk_RestrictEvents(oldProc, oldData, &oldData); if (anyEvents) { @@ -394,7 +393,7 @@ WindowIdCleanup( if (dispPtr->windowStackPtr != NULL) { Tcl_CreateTimerHandler(5000, WindowIdCleanup2, - (ClientData) dispPtr->windowStackPtr); + dispPtr->windowStackPtr); dispPtr->windowStackPtr = NULL; } return; @@ -405,7 +404,7 @@ WindowIdCleanup( tryAgain: dispPtr->idCleanupScheduled = Tcl_CreateTimerHandler(500, - WindowIdCleanup, (ClientData) dispPtr); + WindowIdCleanup, dispPtr); } /* @@ -430,7 +429,7 @@ static void WindowIdCleanup2( ClientData clientData) /* Pointer to TkIdStack list. */ { - TkIdStack *stackPtr = (TkIdStack *) clientData; + TkIdStack *stackPtr = clientData; TkIdStack *lastPtr; lastPtr = stackPtr; @@ -465,7 +464,8 @@ CheckRestrictProc( ClientData clientData, /* Pointer to flag to set. */ XEvent *eventPtr) /* Event to filter; not used. */ { - int *flag = (int *) clientData; + int *flag = clientData; + *flag = 1; return TK_DEFER_EVENT; } @@ -585,7 +585,7 @@ TkpWindowWasRecentlyDeleted( int TkpScanWindowId( Tcl_Interp *interp, - CONST char *string, + const char *string, Window *idPtr) { int value; |