From caa253fcf5871c9886ed214cfc4d68c5ab45d8f2 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 6 Oct 2020 06:01:14 +0000 Subject: More elimination of the "register" keyword, and more explicit typecasts --- generic/tk3d.c | 29 ++++--- generic/tkCanvLine.c | 6 +- tests/text.test | 8 +- unix/tkUnixCursor.c | 2 +- unix/tkUnixFont.c | 2 +- unix/tkUnixMenubu.c | 4 +- unix/tkUnixScale.c | 16 ++-- unix/tkUnixScrlbr.c | 20 ++--- unix/tkUnixSend.c | 57 +++++++------ unix/tkUnixWm.c | 223 +++++++++++++++++++++++++-------------------------- 10 files changed, 180 insertions(+), 187 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index 987bace..f1cc8f1 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -90,7 +90,7 @@ Tk_Alloc3DBorderFromObj( if (objPtr->typePtr != &tkBorderObjType) { InitBorderObj(objPtr); } - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBorder, see if it's the one we @@ -127,7 +127,7 @@ Tk_Alloc3DBorderFromObj( */ if (borderPtr != NULL) { - TkBorder *firstBorderPtr = Tcl_GetHashValue(borderPtr->hashPtr); + TkBorder *firstBorderPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); FreeBorderObj(objPtr); for (borderPtr = firstBorderPtr ; borderPtr != NULL; @@ -200,7 +200,7 @@ Tk_Get3DBorder( hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &isNew); if (!isNew) { - existingBorderPtr = Tcl_GetHashValue(hashPtr); + existingBorderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); for (borderPtr = existingBorderPtr; borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) @@ -420,12 +420,11 @@ Tk_Free3DBorder( Display *display = DisplayOfScreen(borderPtr->screen); TkBorder *prevPtr; - borderPtr->resourceRefCount--; - if (borderPtr->resourceRefCount > 0) { + if (borderPtr->resourceRefCount-- > 1) { return; } - prevPtr = Tcl_GetHashValue(borderPtr->hashPtr); + prevPtr = (TkBorder *)Tcl_GetHashValue(borderPtr->hashPtr); TkpFreeBorder(borderPtr); if (borderPtr->bgColorPtr != NULL) { Tk_FreeColor(borderPtr->bgColorPtr); @@ -527,7 +526,7 @@ static void FreeBorderObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBorder *borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if (borderPtr != NULL) { borderPtr->objRefCount--; @@ -562,7 +561,7 @@ DupBorderObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBorder *borderPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBorder *borderPtr = (TkBorder *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = borderPtr; @@ -594,7 +593,7 @@ Tk_SetBackgroundFromBorder( Tk_Window tkwin, /* Window whose background is to be set. */ Tk_3DBorder border) /* Token for border. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel); } @@ -759,7 +758,7 @@ Tk_Draw3DPolygon( { XPoint poly[4], b1, b2, newB1, newB2; XPoint perp, c, shift1, shift2; /* Used for handling parallel lines. */ - register XPoint *p1Ptr, *p2Ptr; + XPoint *p1Ptr, *p2Ptr; TkBorder *borderPtr = (TkBorder *) border; GC gc; int i, lightOnLeft, dx, dy, parallel, pointsSeen; @@ -956,7 +955,7 @@ Tk_Fill3DRectangle( int relief) /* Indicates 3D effect: TK_RELIEF_FLAT, * TK_RELIEF_RAISED, or TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; int doubleBorder; /* @@ -1027,7 +1026,7 @@ Tk_Fill3DPolygon( * TK_RELIEF_FLAT, TK_RELIEF_RAISED, or * TK_RELIEF_SUNKEN. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC, pointPtr, numPoints, Complex, CoordModeOrigin); @@ -1253,7 +1252,7 @@ Tk_Get3DBorderFromObj( * cached in the internal representation of the Tcl_Obj. Check it out... */ - borderPtr = objPtr->internalRep.twoPtrValue.ptr1; + borderPtr = (TkBorder *)objPtr->internalRep.twoPtrValue.ptr1; if ((borderPtr != NULL) && (borderPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == borderPtr->screen) @@ -1281,7 +1280,7 @@ Tk_Get3DBorderFromObj( if (hashPtr == NULL) { goto error; } - for (borderPtr = Tcl_GetHashValue(hashPtr); borderPtr != NULL; + for (borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); borderPtr != NULL; borderPtr = borderPtr->nextPtr) { if ((Tk_Screen(tkwin) == borderPtr->screen) && (Tk_Colormap(tkwin) == borderPtr->colormap)) { @@ -1371,7 +1370,7 @@ TkDebugBorder( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name); if (hashPtr != NULL) { - TkBorder *borderPtr = Tcl_GetHashValue(hashPtr); + TkBorder *borderPtr = (TkBorder *)Tcl_GetHashValue(hashPtr); if (borderPtr == NULL) { Tcl_Panic("TkDebugBorder found empty hash table entry"); diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index ba7753e..ba4cda1 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -831,9 +831,9 @@ DisplayLine( Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ TCL_UNUSED(int), /* Describes region of canvas that must be */ - TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), /* redisplayed (not used). */ TCL_UNUSED(int), - TCL_UNUSED(int)) + TCL_UNUSED(int)) { LineItem *linePtr = (LineItem *) itemPtr; XPoint staticPoints[MAX_STATIC_POINTS*3]; @@ -1949,7 +1949,7 @@ PrintArrowShape( * string here. */ { LineItem *linePtr = (LineItem *) recordPtr; - char *buffer = ckalloc(120); + char *buffer = (char *)ckalloc(120); sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA, linePtr->arrowShapeB, linePtr->arrowShapeC); diff --git a/tests/text.test b/tests/text.test index 2dbc78b..6bd0ae4 100644 --- a/tests/text.test +++ b/tests/text.test @@ -5066,11 +5066,11 @@ test text-22.132 {TextSearchCmd, multiline regexp matching} -body { void Tcl_SetObjLength(objPtr, length) - register Tcl_Obj *objPtr; /* Pointer to object. This object must - * not currently be shared. */ - register int length; /* Number of bytes desired for string + Tcl_Obj *objPtr; /* Pointer to object. This object must + * not currently be shared. */ + int length; /* Number of bytes desired for string * representation of object, not including - * terminating null byte. */ + * terminating null byte. */ \{ char *new; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 8afb92d..4c58adf 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -245,7 +245,7 @@ TkGetCursorByName( if ((argv[0][0] != '@') && !inTkTable) { XColor fg, bg; unsigned int maskIndex; - register const struct CursorName *namePtr; + const struct CursorName *namePtr; TkDisplay *dispPtr; /* diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index d524bfd..234b282 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -2636,7 +2636,7 @@ CanUseFallback( memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { - register SubFont *fixSubFontPtr = *fixSubFontPtrPtr; + SubFont *fixSubFontPtr = *fixSubFontPtrPtr; if (fixSubFontPtr != &fontPtr->controlSubFont) { *fixSubFontPtrPtr = diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index 6677e83..b212aea 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -58,14 +58,14 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization needed only to stop compiler * warning. */ int y = 0; - register Tk_Window tkwin = mbPtr->tkwin; + Tk_Window tkwin = mbPtr->tkwin; int fullWidth, fullHeight; int textXOffset, textYOffset; int imageWidth, imageHeight; diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index 9c6e4f3..a603432 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -50,9 +50,9 @@ static void DisplayVerticalValue(TkScale *scalePtr, TkScale * TkpCreateScale( - Tk_Window tkwin) + TCL_UNUSED(Tk_Window)) { - return ckalloc(sizeof(TkScale)); + return (TkScale *)ckalloc(sizeof(TkScale)); } /* @@ -256,7 +256,7 @@ DisplayVerticalScale( static void DisplayVerticalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -267,7 +267,7 @@ DisplayVerticalValue( * specified in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; @@ -325,7 +325,7 @@ DisplayHorizontalScale( * to reflect the part of the window that was * redrawn. */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, width, height, shadowWidth; double tickInterval = scalePtr->tickInterval; Tk_3DBorder sliderBorder; @@ -479,7 +479,7 @@ DisplayHorizontalScale( static void DisplayHorizontalValue( - register TkScale *scalePtr, /* Information about widget in which to + TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ @@ -490,7 +490,7 @@ DisplayHorizontalValue( * in pixels. */ const char *format) /* Format string to use for the value */ { - register Tk_Window tkwin = scalePtr->tkwin; + Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; @@ -546,7 +546,7 @@ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { - TkScale *scalePtr = (TkScale *) clientData; + TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; diff --git a/unix/tkUnixScrlbr.c b/unix/tkUnixScrlbr.c index 9b75431..69843db 100644 --- a/unix/tkUnixScrlbr.c +++ b/unix/tkUnixScrlbr.c @@ -63,7 +63,7 @@ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { - UnixScrollbar *scrollPtr = ckalloc(sizeof(UnixScrollbar)); + UnixScrollbar *scrollPtr = (UnixScrollbar *)ckalloc(sizeof(UnixScrollbar)); scrollPtr->troughGC = NULL; scrollPtr->copyGC = NULL; @@ -97,8 +97,8 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - register TkScrollbar *scrollPtr = (TkScrollbar *) clientData; - register Tk_Window tkwin = scrollPtr->tkwin; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; + Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; int relief, width, elementBorderWidth; @@ -277,7 +277,7 @@ TkpDisplayScrollbar( extern void TkpComputeScrollbarGeometry( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { @@ -394,22 +394,22 @@ TkpDestroyScrollbar( void TkpConfigureScrollbar( - register TkScrollbar *scrollPtr) + TkScrollbar *scrollPtr) /* Information about widget; may or may not * already have values for some fields. */ { XGCValues gcValues; - GC new; + GC newGC; UnixScrollbar *unixScrollPtr = (UnixScrollbar *) scrollPtr; Tk_SetBackgroundFromBorder(scrollPtr->tkwin, scrollPtr->bgBorder); gcValues.foreground = scrollPtr->troughColorPtr->pixel; - new = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); + newGC = Tk_GetGC(scrollPtr->tkwin, GCForeground, &gcValues); if (unixScrollPtr->troughGC != NULL) { Tk_FreeGC(scrollPtr->display, unixScrollPtr->troughGC); } - unixScrollPtr->troughGC = new; + unixScrollPtr->troughGC = newGC; if (unixScrollPtr->copyGC == NULL) { gcValues.graphics_exposures = False; unixScrollPtr->copyGC = Tk_GetGC(scrollPtr->tkwin, @@ -437,12 +437,12 @@ TkpConfigureScrollbar( int TkpScrollbarPosition( - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { int length, width, tmp; - register const int inset = scrollPtr->inset; + const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 1ee4bba..03d124f 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -269,7 +269,7 @@ RegOpen( handler = Tk_CreateErrorHandler(dispPtr->display, -1, -1, -1, NULL, NULL); - regPtr = ckalloc(sizeof(NameRegistry)); + regPtr = (NameRegistry *)ckalloc(sizeof(NameRegistry)); regPtr->dispPtr = dispPtr; regPtr->locked = 0; regPtr->modified = 0; @@ -479,7 +479,7 @@ RegAddName( sprintf(id, "%x ", (unsigned) commWindow); idLength = strlen(id); newBytes = idLength + strlen(name) + 1; - newProp = ckalloc(regPtr->propLength + newBytes); + newProp = (char *)ckalloc(regPtr->propLength + newBytes); strcpy(newProp, id); strcpy(newProp+idLength, name); if (regPtr->property != NULL) { @@ -808,7 +808,7 @@ Tk_SetAppName( const char *actualName; Tcl_DString dString; int offset, i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); interp = winPtr->mainPtr->interp; @@ -830,7 +830,7 @@ Tk_SetAppName( * the "send" command to the interpreter. */ - riPtr = ckalloc(sizeof(RegisteredInterp)); + riPtr = (RegisteredInterp *)ckalloc(sizeof(RegisteredInterp)); riPtr->interp = interp; riPtr->dispPtr = winPtr->dispPtr; riPtr->nextPtr = tsdPtr->interpListPtr; @@ -914,7 +914,7 @@ Tk_SetAppName( RegAddName(regPtr, actualName, Tk_WindowId(dispPtr->commTkwin)); RegClose(regPtr); - riPtr->name = ckalloc(strlen(actualName) + 1); + riPtr->name = (char *)ckalloc(strlen(actualName) + 1); strcpy(riPtr->name, actualName); if (actualName != name) { Tcl_DStringFree(&dString); @@ -943,7 +943,7 @@ Tk_SetAppName( int Tk_SendObjCmd( - ClientData clientData, /* Information about sender (only dispPtr + TCL_UNUSED(void *), /* Information about sender (only dispPtr * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -958,7 +958,7 @@ Tk_SendObjCmd( TkWindow *winPtr; Window commWindow; PendingCommand pending; - register RegisteredInterp *riPtr; + RegisteredInterp *riPtr; const char *destName; int result, index, async, i, firstArg; Tk_RestrictProc *prevProc; @@ -967,7 +967,7 @@ Tk_SendObjCmd( Tcl_Time timeout; NameRegistry *regPtr; Tcl_DString request; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Interp *localInterp; /* Used when the interpreter to send the * command to is within the same process. */ @@ -1175,7 +1175,7 @@ Tk_SendObjCmd( msg = "target application died"; } pending.code = TCL_ERROR; - pending.result = ckalloc(strlen(msg) + 1); + pending.result = (char *)ckalloc(strlen(msg) + 1); strcpy(pending.result, msg); pending.gotResponse = 1; } else { @@ -1356,7 +1356,7 @@ TkSendCleanup( static int SendInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting (no + TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting (no * errors are ever returned, but the * interpreter is needed anyway). */ TkDisplay *dispPtr) /* Display to initialize. */ @@ -1419,14 +1419,14 @@ SendEventProc( ClientData clientData, /* Display information. */ XEvent *eventPtr) /* Information about event. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; char *propInfo, **propInfoPtr = &propInfo; const char *p; int result, actualFormat; unsigned long numItems, bytesAfter; Atom actualType; Tcl_Interp *remoteInterp; /* Interp in which to execute the command. */ - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((eventPtr->xproperty.atom != dispPtr->commProperty) @@ -1698,16 +1698,16 @@ SendEventProc( } pcPtr->code = code; if (resultString != NULL) { - pcPtr->result = ckalloc(strlen(resultString) + 1); + pcPtr->result = (char *)ckalloc(strlen(resultString) + 1); strcpy(pcPtr->result, resultString); } if (code == TCL_ERROR) { if (errorInfo != NULL) { - pcPtr->errorInfo = ckalloc(strlen(errorInfo) + 1); + pcPtr->errorInfo = (char *)ckalloc(strlen(errorInfo) + 1); strcpy(pcPtr->errorInfo, errorInfo); } if (errorCode != NULL) { - pcPtr->errorCode = ckalloc(strlen(errorCode) + 1); + pcPtr->errorCode = (char *)ckalloc(strlen(errorCode) + 1); strcpy(pcPtr->errorCode, errorCode); } } @@ -1774,15 +1774,14 @@ AppendPropCarefully( * operation above. */ - /* ARGSUSED */ static int AppendErrorProc( ClientData clientData, /* Command to mark complete, or NULL. */ - XErrorEvent *errorPtr) /* Information about error. */ + TCL_UNUSED(XErrorEvent *)) /* Information about error. */ { - PendingCommand *pendingPtr = clientData; - register PendingCommand *pcPtr; - ThreadSpecificData *tsdPtr = + PendingCommand *pendingPtr = (PendingCommand *)clientData; + PendingCommand *pcPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (pendingPtr == NULL) { @@ -1796,7 +1795,7 @@ AppendErrorProc( for (pcPtr = tsdPtr->pendingCommands; pcPtr != NULL; pcPtr = pcPtr->nextPtr) { if ((pcPtr == pendingPtr) && (pcPtr->result == NULL)) { - pcPtr->result = ckalloc(strlen(pcPtr->target) + 50); + pcPtr->result = (char *)ckalloc(strlen(pcPtr->target) + 50); sprintf(pcPtr->result, "no application named \"%s\"", pcPtr->target); pcPtr->code = TCL_ERROR; @@ -1829,10 +1828,10 @@ DeleteProc( ClientData clientData) /* Info about registration, passed as * ClientData. */ { - RegisteredInterp *riPtr = clientData; - register RegisteredInterp *riPtr2; + RegisteredInterp *riPtr = (RegisteredInterp *)clientData; + RegisteredInterp *riPtr2; NameRegistry *regPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); regPtr = RegOpen(riPtr->interp, riPtr->dispPtr, 1); @@ -1874,11 +1873,10 @@ DeleteProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static Tk_RestrictAction SendRestrictProc( - ClientData clientData, /* Not used. */ - register XEvent *eventPtr) /* Event that just arrived. */ + TCL_UNUSED(void *), /* Not used. */ + XEvent *eventPtr) /* Event that just arrived. */ { TkDisplay *dispPtr; @@ -1921,7 +1919,7 @@ UpdateCommWindow( { Tcl_DString names; RegisteredInterp *riPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DStringInit(&names); @@ -1954,7 +1952,6 @@ UpdateCommWindow( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int TkpTestsendCmd( ClientData clientData, /* Main window for application. */ @@ -1968,7 +1965,7 @@ TkpTestsendCmd( static const char *const testsendOptions[] = { "bogus", "prop", "serial", NULL }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Tk_ErrorHandler handler; int index; diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c index f1d1fe0..83b36e3 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -36,7 +36,7 @@ typedef struct ProtocolHandler { } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ - ((unsigned) ((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)) + ((unsigned)((Tk_Offset(ProtocolHandler, command) + 1) + cmdLength)) /* * Data for [wm attributes] command: @@ -564,10 +564,10 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - register WmInfo *wmPtr; + WmInfo *wmPtr; TkDisplay *dispPtr = winPtr->dispPtr; - wmPtr = ckalloc(sizeof(WmInfo)); + wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); memset(wmPtr, 0, sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; @@ -659,7 +659,7 @@ TkWmMapWindow( TkWindow *winPtr) /* Top-level window that's about to be * mapped. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XTextProperty textProp; if (wmPtr->flags & WM_NEVER_MAPPED) { @@ -827,7 +827,7 @@ void TkWmDeadWindow( TkWindow *winPtr) /* Top-level window that's being deleted. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; WmInfo *wmPtr2; if (wmPtr == NULL) { @@ -836,7 +836,7 @@ TkWmDeadWindow( if ((WmInfo *) winPtr->dispPtr->firstWmPtr == wmPtr) { winPtr->dispPtr->firstWmPtr = wmPtr->nextPtr; } else { - register WmInfo *prevPtr; + WmInfo *prevPtr; for (prevPtr = (WmInfo *) winPtr->dispPtr->firstWmPtr; ; prevPtr = prevPtr->nextPtr) { @@ -1005,7 +1005,6 @@ TkWmSetClass( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_WmObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -1013,7 +1012,7 @@ Tk_WmObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const char *const optionStrings[] = { "aspect", "attributes", "client", "colormapwindows", "command", "deiconify", "focusmodel", "forget", @@ -1182,13 +1181,13 @@ Tk_WmObjCmd( static int WmAspectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; if ((objc != 3) && (objc != 7)) { @@ -1315,7 +1314,7 @@ WmSetAttribute( SetNetWmState(winPtr, "_NET_WM_STATE_FULLSCREEN", wmPtr->reqState.fullscreen); break; - case _WMATT_LAST_ATTRIBUTE: /* NOTREACHED */ + case _WMATT_LAST_ATTRIBUTE: return TCL_ERROR; } return TCL_OK; @@ -1352,10 +1351,9 @@ WmGetAttribute( return Tcl_NewBooleanObj(wmPtr->attributes.fullscreen); case WMATT_TYPE: return GetNetWmType(winPtr); - case _WMATT_LAST_ATTRIBUTE: /*NOTREACHED*/ + case _WMATT_LAST_ATTRIBUTE: break; } - /*NOTREACHED*/ return NULL; } @@ -1385,7 +1383,7 @@ WmGetAttribute( static int WmAttributesCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -1449,13 +1447,13 @@ WmAttributesCmd( static int WmClientCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -1486,7 +1484,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -1541,7 +1539,7 @@ WmColormapwindowsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window *cmapList; TkWindow *winPtr2; int count, i, windowObjc, gotToplevel; @@ -1584,7 +1582,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc+1) * sizeof(Window)); + cmapList = (Window *)ckalloc((windowObjc+1) * sizeof(Window)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { Tk_Window mapWin; @@ -1636,13 +1634,13 @@ WmColormapwindowsCmd( static int WmCommandCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int cmdArgc; const char **cmdArgv; @@ -1705,13 +1703,13 @@ WmCommandCmd( static int WmDeiconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1755,13 +1753,13 @@ WmDeiconifyCmd( static int WmFocusmodelCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "active", "passive", NULL }; enum options { @@ -1810,13 +1808,13 @@ WmFocusmodelCmd( static int WmForgetCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* 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. */ + TCL_UNUSED(Tcl_Interp *), /* Current interpreter. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; + Tk_Window frameWin = (Tk_Window) winPtr; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); @@ -1863,13 +1861,13 @@ WmForgetCmd( static int WmFrameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; @@ -1905,13 +1903,13 @@ WmFrameCmd( static int WmGeometryCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; char xSign, ySign; int width, height; const char *argv3; @@ -1965,13 +1963,13 @@ WmGeometryCmd( static int WmGridCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; if ((objc != 3) && (objc != 7)) { @@ -2070,7 +2068,7 @@ WmGroupCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; @@ -2114,7 +2112,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); @@ -2140,13 +2138,13 @@ WmGroupCmd( static int WmIconbitmapCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2200,13 +2198,13 @@ WmIconbitmapCmd( static int WmIconifyCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -2275,7 +2273,7 @@ WmIconmaskCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; @@ -2328,13 +2326,13 @@ WmIconmaskCmd( static int WmIconnameCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -2380,13 +2378,13 @@ WmIconnameCmd( static int WmIconphotoCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_PhotoHandle photo; Tk_PhotoImageBlock block; int i, size = 0, width, height, index = 0, x, y, isDefault = 0; @@ -2437,7 +2435,7 @@ WmIconphotoCmd( * defines CARD32 arrays to use. [Bug 2902814] */ - iconPropertyData = attemptckalloc(sizeof(unsigned long) * size); + iconPropertyData = (unsigned long *)attemptckalloc(sizeof(unsigned long) * size); if (iconPropertyData == NULL) { return TCL_ERROR; } @@ -2479,9 +2477,9 @@ WmIconphotoCmd( iconPropertyData[index++] = (unsigned long) height; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { - register unsigned char *pixelPtr = + unsigned char *pixelPtr = block.pixelPtr + x*block.pixelSize + y*block.pitch; - register unsigned long R, G, B, A; + unsigned long R, G, B, A; R = pixelPtr[block.offset[0]]; G = pixelPtr[block.offset[1]]; @@ -2530,13 +2528,13 @@ WmIconphotoCmd( static int WmIconpositionCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; if ((objc != 3) && (objc != 5)) { @@ -2593,7 +2591,7 @@ WmIconwindowCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; XSetWindowAttributes atts; @@ -2707,14 +2705,14 @@ WmIconwindowCmd( static int WmManageCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* 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. */ + TCL_UNUSED(int), /* Number of arguments. */ + TCL_UNUSED(Tcl_Obj *const *)) /* Argument objects. */ { - register Tk_Window frameWin = (Tk_Window) winPtr; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + Tk_Window frameWin = (Tk_Window) winPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -2769,13 +2767,13 @@ WmManageCmd( static int WmMaxsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2828,13 +2826,13 @@ WmMaxsizeCmd( static int WmMinsizeCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -2879,7 +2877,7 @@ WmMinsizeCmd( static int WmOverrideredirectCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -2937,13 +2935,13 @@ WmOverrideredirectCmd( static int WmPositionfromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3004,14 +3002,14 @@ WmPositionfromCmd( static int WmProtocolCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; - register ProtocolHandler *protPtr, *prevPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; + ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; int cmdLength; @@ -3082,7 +3080,7 @@ WmProtocolCmd( } cmd = Tcl_GetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { - protPtr = ckalloc(HANDLER_SIZE(cmdLength)); + protPtr = (ProtocolHandler *)ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; @@ -3114,13 +3112,13 @@ WmProtocolCmd( static int WmResizableCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; if ((objc != 3) && (objc != 5)) { @@ -3173,13 +3171,13 @@ WmResizableCmd( static int WmSizefromCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "program", "user", NULL }; enum options { @@ -3365,13 +3363,13 @@ WmStackorderCmd( static int WmStateCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; static const char *const optionStrings[] = { "normal", "iconic", "withdrawn", NULL }; enum options { @@ -3471,13 +3469,13 @@ WmStateCmd( static int WmTitleCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; int length; @@ -3496,7 +3494,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = Tcl_GetStringFromObj(objv[3], &length); - wmPtr->title = ckalloc(length + 1); + wmPtr->title = (char *)ckalloc(length + 1); strcpy(wmPtr->title, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { @@ -3531,7 +3529,7 @@ WmTransientCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *containerPtr = wmPtr->containerPtr, *w; WmInfo *wmPtr2; @@ -3674,13 +3672,13 @@ WmTransientCmd( static int WmWithdrawCmd( - Tk_Window tkwin, /* Main window of the application. */ + TCL_UNUSED(Tk_Window), /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3729,7 +3727,7 @@ WmWaitMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *containerPtr = winPtr->wmInfoPtr->containerPtr; if (containerPtr == NULL) { @@ -3780,7 +3778,7 @@ Tk_SetGrid( * of one grid unit. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Ensure widthInc and heightInc are greater than 0 @@ -3885,7 +3883,7 @@ Tk_UnsetGrid( * controlling gridding. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr; + WmInfo *wmPtr; /* * Find the top-level window for tkwin, plus the window manager @@ -4418,7 +4416,7 @@ WrapperEventProc( ClientData clientData, /* Information about toplevel window. */ XEvent *eventPtr) /* Event that just happened. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; XEvent mapEvent; TkDisplay *dispPtr = wmPtr->winPtr->dispPtr; @@ -4498,10 +4496,9 @@ WrapperEventProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void TopLevelReqProc( - ClientData dummy, /* Not used. */ + TCL_UNUSED(void *), /* Not used. */ Tk_Window tkwin) /* Information about window. */ { TkWindow *winPtr = (TkWindow *) tkwin; @@ -4568,8 +4565,8 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - register TkWindow *winPtr = clientData; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + TkWindow *winPtr = (TkWindow *)clientData; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; @@ -4830,7 +4827,7 @@ UpdateSizeHints( int newWidth, int newHeight) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; XSizeHints *hintsPtr; int maxWidth, maxHeight; @@ -5307,7 +5304,7 @@ WaitRestrictProc( ClientData clientData, /* Pointer to WaitRestrictInfo structure. */ XEvent *eventPtr) /* Event that is about to be handled. */ { - WaitRestrictInfo *infoPtr = clientData; + WaitRestrictInfo *infoPtr = (WaitRestrictInfo *)clientData; if (eventPtr->type == ReparentNotify) { return TK_PROCESS_EVENT; @@ -5463,7 +5460,7 @@ SetNetWmType( } if (objc > 0) { - atoms = ckalloc(sizeof(Atom) * objc); + atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { @@ -5576,10 +5573,10 @@ ParseGeometry( TkWindow *winPtr) /* Pointer to top-level window whose geometry * is to be changed. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, flags; char *end; - register const char *p = string; + const char *p = string; /* * The leading "=" is optional. @@ -5712,7 +5709,7 @@ Tk_GetRootCoords( int *yPtr) /* Where to store y-displacement of (0,0). */ { int x, y; - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * Search back through this window's parents all the way to a top-level @@ -6179,7 +6176,7 @@ Tk_MoveToplevelWindow( int x, int y) /* New location for window (within parent). */ { TkWindow *winPtr = (TkWindow *) tkwin; - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); @@ -6227,9 +6224,9 @@ Tk_MoveToplevelWindow( static void UpdateWmProtocols( - register WmInfo *wmPtr) /* Information about top-level window. */ + WmInfo *wmPtr) /* Information about top-level window. */ { - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom deleteWindowAtom, pingAtom; int count; Atom *arrayPtr, *atomPtr; @@ -6246,7 +6243,7 @@ UpdateWmProtocols( protPtr = protPtr->nextPtr, count++) { /* Empty loop body; we're just counting the handlers. */ } - arrayPtr = ckalloc(count * sizeof(Atom)); + arrayPtr = (Atom *)ckalloc(count * sizeof(Atom)); deleteWindowAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "WM_DELETE_WINDOW"); pingAtom = Tk_InternAtom((Tk_Window) wmPtr->winPtr, "_NET_WM_PING"); @@ -6288,7 +6285,7 @@ TkWmProtocolEventProc( XEvent *eventPtr) /* X event. */ { WmInfo *wmPtr; - register ProtocolHandler *protPtr; + ProtocolHandler *protPtr; Atom protocol; int result; const char *protocolName; @@ -6437,7 +6434,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - window_ptr = windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + window_ptr = windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); if (windows == NULL) { return NULL; } @@ -6453,7 +6450,7 @@ TkWmStackorderToplevel( goto done; case 1: hPtr = Tcl_FirstHashEntry(&table, &search); - windows[0] = Tcl_GetHashValue(hPtr); + windows[0] = (TkWindow *)Tcl_GetHashValue(hPtr); windows[1] = NULL; goto done; } @@ -6469,9 +6466,9 @@ TkWmStackorderToplevel( windows = NULL; } else { for (i = 0; i < numChildren; i++) { - hPtr = Tcl_FindHashEntry(&table, (char *) children[i]); + hPtr = Tcl_FindHashEntry(&table, (char *)children[i]); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; } } @@ -6644,7 +6641,7 @@ TkWmAddToColormapWindows( * add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(Window)); + newPtr = (Window *)ckalloc((count+2) * sizeof(Window)); for (i = 0; i < count; i++) { newPtr[i] = oldPtr[i]; } @@ -6879,7 +6876,7 @@ GetMaxSize( static void TkSetTransientFor(Tk_Window tkwin, Tk_Window parent) { - if (parent == None) { + if (parent == NULL) { parent = Tk_Parent(tkwin); while (!Tk_IsTopLevel(parent)) parent = Tk_Parent(parent); @@ -6997,7 +6994,7 @@ CreateWrapper( TkWindow *winPtr, *wrapperPtr; Window parent; Tcl_HashEntry *hPtr; - int new; + int isNew; winPtr = wmPtr->winPtr; if (winPtr->window == None) { @@ -7041,7 +7038,7 @@ CreateWrapper( InputOutput, wrapperPtr->visual, wrapperPtr->dirtyAtts|CWOverrideRedirect, &wrapperPtr->atts); hPtr = Tcl_CreateHashEntry(&wrapperPtr->dispPtr->winTable, - (char *) wrapperPtr->window, &new); + (char *) wrapperPtr->window, &isNew); Tcl_SetHashValue(hPtr, wrapperPtr); wrapperPtr->mainPtr = winPtr->mainPtr; wrapperPtr->mainPtr->refCount++; @@ -7260,7 +7257,7 @@ MenubarReqProc( * for tkwin's toplevel. */ Tk_Window tkwin) /* Handle for menubar window. */ { - WmInfo *wmPtr = clientData; + WmInfo *wmPtr = (WmInfo *)clientData; wmPtr->menuHeight = Tk_ReqHeight(tkwin); if (wmPtr->menuHeight <= 0) { @@ -7295,7 +7292,7 @@ TkWindow * TkpGetWrapperWindow( TkWindow *winPtr) /* A toplevel window pointer. */ { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; if ((winPtr == NULL) || (wmPtr == NULL)) { return NULL; @@ -7325,7 +7322,7 @@ static void UpdateCommand( TkWindow *winPtr) { - register WmInfo *wmPtr = winPtr->wmInfoPtr; + WmInfo *wmPtr = winPtr->wmInfoPtr; Tcl_DString cmds, ds; int i, *offsets; char **cmdArgv; @@ -7342,8 +7339,8 @@ UpdateCommand( * entire DString is done. */ - cmdArgv = ckalloc(sizeof(char *) * wmPtr->cmdArgc); - offsets = ckalloc(sizeof(int) * wmPtr->cmdArgc); + cmdArgv = (char **)ckalloc(sizeof(char *) * wmPtr->cmdArgc); + offsets = (int *)ckalloc(sizeof(int) * wmPtr->cmdArgc); Tcl_DStringInit(&cmds); for (i = 0; i < wmPtr->cmdArgc; i++) { Tcl_UtfToExternalDString(NULL, wmPtr->cmdArgv[i], -1, &ds); -- cgit v0.12