From 4ee5781a03c8e0291da78312759c0d170f25dd02 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Tue, 15 Sep 2020 08:44:54 +0000 Subject: More usage of TCL_UNUSED() and explicit type-casts --- generic/tkBind.c | 80 +++++++++++++++++++++++++------------------------- generic/tkBusy.c | 34 ++++++++++----------- generic/tkClipboard.c | 25 ++++++++-------- generic/tkCmds.c | 81 +++++++++++++++++++++++---------------------------- generic/tkConfig.c | 28 +++++++++--------- generic/tkConsole.c | 68 ++++++++++++++++++++---------------------- generic/tkEvent.c | 72 ++++++++++++++++++++++----------------------- generic/tkGet.c | 8 ++--- generic/tkGrab.c | 39 ++++++++++++------------- generic/tkObj.c | 40 ++++++++++++------------- generic/tkOldConfig.c | 29 +++++++++--------- generic/tkStyle.c | 73 ++++++++++++++++++++++------------------------ 12 files changed, 278 insertions(+), 299 deletions(-) diff --git a/generic/tkBind.c b/generic/tkBind.c index bdc1f45..979d61e 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -790,7 +790,7 @@ GetButtonNumber( } static Time -CurrentTimeInMilliSecs() +CurrentTimeInMilliSecs(void) { Tcl_Time now; Tcl_GetTime(&now); @@ -942,7 +942,7 @@ ClearList( static PSEntry * FreePatSeqEntry( - PSList *pool, + TCL_UNUSED(PSList *), PSEntry *entry) { PSEntry *next = PSList_Next(entry); @@ -1043,7 +1043,7 @@ MakeListEntry( assert(TEST_PSENTRY(psPtr)); if (PSList_IsEmpty(pool)) { - newEntry = ckalloc(sizeof(PSEntry)); + newEntry = (PSEntry *)ckalloc(sizeof(PSEntry)); newEntry->lastModMaskArr = NULL; DEBUG(countEntryItems += 1;) } else { @@ -1120,7 +1120,7 @@ GetLookupForEvent( key.object = object; key.type = eventPtr->xev.type; hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key); - return hPtr ? Tcl_GetHashValue(hPtr) : NULL; + return hPtr ? (PSList *)Tcl_GetHashValue(hPtr) : NULL; } /* @@ -1158,13 +1158,13 @@ ClearLookupTable( nextPtr = Tcl_NextHashEntry(&search); if (object) { - const PatternTableKey *key = Tcl_GetHashKey(&lookupTables->listTable, hPtr); + const PatternTableKey *key = (const PatternTableKey *)Tcl_GetHashKey(&lookupTables->listTable, hPtr); if (key->object != object) { continue; } } - psList = Tcl_GetHashValue(hPtr); + psList = (PSList *)Tcl_GetHashValue(hPtr); PSList_Move(pool, psList); ckfree(psList); DEBUG(countListItems -= 1;) @@ -1375,7 +1375,7 @@ TkBindInit( mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp); - bindInfoPtr = ckalloc(sizeof(BindInfo)); + bindInfoPtr = (BindInfo *)ckalloc(sizeof(BindInfo)); InitVirtualEventTable(&bindInfoPtr->virtualEventTable); bindInfoPtr->screenInfo.curDispPtr = NULL; bindInfoPtr->screenInfo.curScreenIndex = -1; @@ -1451,7 +1451,7 @@ Tk_CreateBindingTable( Tcl_Interp *interp) /* Interpreter to associate with the binding table: commands are * executed in this interpreter. */ { - BindingTable *bindPtr = ckalloc(sizeof(BindingTable)); + BindingTable *bindPtr = (BindingTable *)ckalloc(sizeof(BindingTable)); unsigned i; assert(interp); @@ -1510,7 +1510,7 @@ Tk_DeleteBindingTable( PatSeq *nextPtr; PatSeq *psPtr; - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; FreePatSeq(psPtr); @@ -1577,12 +1577,12 @@ InsertPatSeq( hPtr = Tcl_CreateHashEntry(&lookupTables->listTable, (char *) &key, &isNew); if (isNew) { - psList = ckalloc(sizeof(PSList)); + psList = (PSList *)ckalloc(sizeof(PSList)); PSList_Init(psList); Tcl_SetHashValue(hPtr, psList); DEBUG(countListItems += 1;) } else { - psList = Tcl_GetHashValue(hPtr); + psList = (PSList *)Tcl_GetHashValue(hPtr); } psEntry = MakeListEntry(&lookupTables->entryPool, psPtr, 0); @@ -1670,7 +1670,7 @@ Tk_CreateBinding( */ hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object, &isNew); - psPtr->ptr.nextObj = isNew ? NULL : Tcl_GetHashValue(hPtr); + psPtr->ptr.nextObj = isNew ? NULL : (PatSeq *)Tcl_GetHashValue(hPtr); Tcl_SetHashValue(hPtr, psPtr); InsertPatSeq(&bindPtr->lookupTables, psPtr); } @@ -1680,14 +1680,14 @@ Tk_CreateBinding( size_t length1 = strlen(oldStr); size_t length2 = strlen(script); - newStr = ckalloc(length1 + length2 + 2); + newStr = (char *)ckalloc(length1 + length2 + 2); memcpy(newStr, oldStr, length1); newStr[length1] = '\n'; memcpy(newStr + length1 + 1, script, length2 + 1); } else { size_t length = strlen(script); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); memcpy(newStr, script, length + 1); } ckfree(oldStr); @@ -1742,7 +1742,7 @@ Tk_DeleteBinding( if (!(hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object))) { Tcl_Panic("Tk_DeleteBinding couldn't find object table entry"); } - prevPtr = Tcl_GetHashValue(hPtr); + prevPtr = (PatSeq *)Tcl_GetHashValue(hPtr); if (prevPtr == psPtr) { Tcl_SetHashValue(hPtr, psPtr->ptr.nextObj); } else { @@ -1843,7 +1843,7 @@ Tk_GetAllBindings( * For each binding, output information about each of the patterns in its sequence. */ - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) { + for (psPtr = (const PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) { assert(TEST_PSENTRY(psPtr)); Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(psPtr)); } @@ -1882,7 +1882,7 @@ RemovePatSeqFromLookup( SetupPatternKey(&key, psPtr); if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) { - PSList *psList = Tcl_GetHashValue(hPtr); + PSList *psList = (PSList *)Tcl_GetHashValue(hPtr); PSEntry *psEntry; TK_DLIST_FOREACH(psEntry, psList) { @@ -1966,7 +1966,7 @@ DeletePatSeq( assert(!psPtr->added); assert(!psPtr->owned); - prevPtr = Tcl_GetHashValue(psPtr->hPtr); + prevPtr = (PatSeq *)Tcl_GetHashValue(psPtr->hPtr); nextPtr = psPtr->ptr.nextObj; /* @@ -2037,7 +2037,7 @@ Tk_DeleteAllBindings( ClearLookupTable(&bindPtr->lookupTables, object); ClearPromotionLists(bindPtr, object); - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); DEBUG(psPtr->added = 0;) nextPtr = DeletePatSeq(psPtr); @@ -2362,7 +2362,7 @@ Tk_BindEvent( if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) { /* it's unrealistic that the buffer size is too small, but who knows? */ - matchPtrArr = ckalloc(numObjects*sizeof(matchPtrArr[0])); + matchPtrArr = (PatSeq **)ckalloc(numObjects*sizeof(matchPtrArr[0])); } memset(matchPtrArr, 0, numObjects*sizeof(matchPtrArr[0])); @@ -2403,8 +2403,8 @@ Tk_BindEvent( PSList *psSuccList = PromArr_First(bindPtr->promArr); PatSeq *bestPtr; - psl[0] = GetLookupForEvent(physTables, curEvent, objArr[k], 1); - psl[1] = GetLookupForEvent(physTables, curEvent, objArr[k], 0); + psl[0] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 1); + psl[1] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 0); assert(psl[0] == NULL || psl[0] != psl[1]); @@ -3468,7 +3468,7 @@ DeleteVirtualEventTable( PatSeq *nextPtr; PatSeq *psPtr; - for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { + for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; DEBUG(psPtr->owned = 0;) @@ -3550,7 +3550,7 @@ CreateVirtualEvent( * Make virtual event own the physical event. */ - owned = Tcl_GetHashValue(vhPtr); + owned = (PhysOwned *)Tcl_GetHashValue(vhPtr); if (!PhysOwned_Contains(owned, psPtr)) { PhysOwned_Append(&owned, psPtr); @@ -3612,7 +3612,7 @@ DeleteVirtualEvent( if (!(vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid))) { return TCL_OK; } - owned = Tcl_GetHashValue(vhPtr); + owned = (PhysOwned *)Tcl_GetHashValue(vhPtr); eventPSPtr = NULL; if (eventString) { @@ -3744,7 +3744,7 @@ GetVirtualEvent( } resultObj = Tcl_NewObj(); - owned = Tcl_GetHashValue(vhPtr); + owned = (const PhysOwned *)Tcl_GetHashValue(vhPtr); for (iPhys = 0; iPhys < PhysOwned_Size(owned); ++iPhys) { Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(PhysOwned_Get(owned, iPhys))); } @@ -3833,7 +3833,7 @@ HandleEventGenerate( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - union { XEvent general; XVirtualEvent virtual; } event; + union { XEvent general; XVirtualEvent virt; } event; const char *p; const char *name; @@ -3936,7 +3936,7 @@ HandleEventGenerate( } else if (flags & BUTTON) { event.general.xbutton.button = pat.info; } else if (flags & VIRTUAL) { - event.virtual.name = pat.name; + event.virt.name = pat.name; } } if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) { @@ -4376,7 +4376,7 @@ HandleEventGenerate( * refcount before firing it into the low-level event subsystem; the * refcount will be decremented once the event has been processed. */ - event.virtual.user_data = userDataObj; + event.virt.user_data = userDataObj; Tcl_IncrRefCount(userDataObj); } @@ -4636,7 +4636,7 @@ FindSequence( assert(lookupTables); assert(eventString); - psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize)); /* *------------------------------------------------------------------ @@ -4648,7 +4648,7 @@ FindSequence( if (numPats >= patsBufSize) { unsigned pos = patPtr - psPtr->pats; patsBufSize += patsBufSize; - psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize)); patPtr = psPtr->pats + pos; } @@ -4697,18 +4697,18 @@ FindSequence( return NULL; } if (patsBufSize > numPats) { - psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats)); + psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats)); } patPtr = psPtr->pats; - psPtr->object = object; + psPtr->object = (Tcl_Obj *)object; SetupPatternKey(&key, psPtr); hPtr = Tcl_CreateHashEntry(&lookupTables->patternTable, (char *) &key, &isNew); if (!isNew) { unsigned sequenceSize = numPats*sizeof(TkPattern); PatSeq *psPtr2; - for (psPtr2 = Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) { + for (psPtr2 = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) { assert(TEST_PSENTRY(psPtr2)); if (numPats == psPtr2->numPats && memcmp(patPtr, psPtr2->pats, sequenceSize) == 0) { ckfree(psPtr); @@ -4744,7 +4744,7 @@ FindSequence( psPtr->added = 0; psPtr->modMaskUsed = (modMask != 0); psPtr->script = NULL; - psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr); + psPtr->nextSeqPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr->hPtr = hPtr; psPtr->ptr.nextObj = NULL; assert(psPtr->ptr.owners == NULL); @@ -4886,7 +4886,7 @@ ParseEventDescription( size = p - field; if (size >= sizeof(buf)) { - bufPtr = ckalloc(size + 1); + bufPtr = (char *)ckalloc(size + 1); } strncpy(bufPtr, field, size); bufPtr[size] = '\0'; @@ -4918,7 +4918,7 @@ ParseEventDescription( if (!(hPtr = Tcl_FindHashEntry(&modTable, field))) { break; } - modPtr = Tcl_GetHashValue(hPtr); + modPtr = (ModInfo *)Tcl_GetHashValue(hPtr); patPtr->modMask |= modPtr->mask; if (modPtr->flags & MULT_CLICKS) { unsigned i = modPtr->flags & MULT_CLICKS; @@ -4933,7 +4933,7 @@ ParseEventDescription( eventFlags = 0; if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) { - const EventInfo *eiPtr = Tcl_GetHashValue(hPtr); + const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr); patPtr->eventType = eiPtr->type; eventFlags = flagArray[eiPtr->type]; @@ -5169,7 +5169,7 @@ GetPatternObj( case ButtonPress: case ButtonRelease: assert(patPtr->info <= Button5); - Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info); + Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) patPtr->info); break; #if PRINT_SHORT_MOTION_SYNTAX case MotionNotify: { @@ -5257,7 +5257,7 @@ TkKeysymToString( Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym); if (hPtr) { - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } #endif /* REDO_KEYSYM_LOOKUP */ diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 7bd9a44..1e4e91f 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -54,7 +54,7 @@ static void MakeTransparentWindowExist(Tk_Window tkwin, Window parent); static inline Tk_Window NextChild(Tk_Window tkwin); static void RefWinEventProc(ClientData clientData, - register XEvent *eventPtr); + XEvent *eventPtr); static inline void SetWindowInstanceData(Tk_Window tkwin, ClientData instanceData); @@ -122,13 +122,12 @@ SetWindowInstanceData( *---------------------------------------------------------------------- */ -/* ARGSUSED */ static void BusyCustodyProc( ClientData clientData, /* Information about the busy window. */ - Tk_Window tkwin) /* Not used. */ + TCL_UNUSED(Tk_Window)) /* Not used. */ { - Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); @@ -156,12 +155,11 @@ BusyCustodyProc( *---------------------------------------------------------------------- */ -/* ARGSUSED */ static void BusyGeometryProc( - ClientData clientData, /* Information about window that got new + TCL_UNUSED(void *), /* Information about window that got new * preferred geometry. */ - Tk_Window tkwin) /* Other Tk-related information about the + TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ { /* Should never get here */ @@ -249,9 +247,9 @@ DoConfigureNotify( static void RefWinEventProc( ClientData clientData, /* Busy window record */ - register XEvent *eventPtr) /* Event which triggered call to routine */ + XEvent *eventPtr) /* Event which triggered call to routine */ { - register Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; switch (eventPtr->type) { case ReparentNotify: @@ -333,7 +331,7 @@ static void DestroyBusy( void *data) /* Busy window structure record */ { - register Busy *busyPtr = data; + Busy *busyPtr = (Busy *)data; if (busyPtr->hashPtr != NULL) { Tcl_DeleteHashEntry(busyPtr->hashPtr); @@ -377,7 +375,7 @@ BusyEventProc( ClientData clientData, /* Busy window record */ XEvent *eventPtr) /* Event which triggered call to routine */ { - Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; if (eventPtr->type == DestroyNotify) { busyPtr->tkBusy = NULL; @@ -527,10 +525,10 @@ CreateBusy( Window parent; Tk_FakeWin *winPtr; - busyPtr = ckalloc(sizeof(Busy)); + busyPtr = (Busy *)ckalloc(sizeof(Busy)); x = y = 0; length = strlen(Tk_Name(tkRef)); - name = ckalloc(length + 6); + name = (char *)ckalloc(length + 6); if (Tk_IsTopLevel(tkRef)) { fmt = "_Busy"; /* Child */ tkParent = tkRef; @@ -696,7 +694,7 @@ GetBusy( Tcl_GetString(windowObj), NULL); return NULL; } - return Tcl_GetHashValue(hPtr); + return (Busy *)Tcl_GetHashValue(hPtr); } /* @@ -746,7 +744,7 @@ HoldBusy( Tcl_SetHashValue(hPtr, busyPtr); busyPtr->hashPtr = hPtr; } else { - busyPtr = Tcl_GetHashValue(hPtr); + busyPtr = (Busy *)Tcl_GetHashValue(hPtr); } busyPtr->tablePtr = busyTablePtr; @@ -789,7 +787,7 @@ Tk_BusyObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable; Busy *busyPtr; Tcl_Obj *objPtr; @@ -855,7 +853,7 @@ Tk_BusyObjCmd( } Tcl_Preserve(busyPtr); if (objc <= 4) { - objPtr = Tk_GetOptionInfo(interp, (char *) busyPtr, + objPtr = Tk_GetOptionInfo(interp, (char *)busyPtr, busyPtr->optionTable, (objc == 4) ? objv[3] : NULL, busyPtr->tkBusy); if (objPtr == NULL) { @@ -877,7 +875,7 @@ Tk_BusyObjCmd( objPtr = Tcl_NewObj(); for (hPtr = Tcl_FirstHashEntry(busyTablePtr, &cursor); hPtr != NULL; hPtr = Tcl_NextHashEntry(&cursor)) { - busyPtr = Tcl_GetHashValue(hPtr); + busyPtr = (Busy *)Tcl_GetHashValue(hPtr); if (pattern == NULL || Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) { Tcl_ListObjAppendElement(interp, objPtr, diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 2e504eb..703ef41 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -56,7 +56,7 @@ ClipboardHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkClipboardTarget *targetPtr = clientData; + TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; size_t count = 0; @@ -173,11 +173,11 @@ ClipboardAppHandler( static int ClipboardWindowHandler( - ClientData clientData, /* Not used. */ - int offset, /* Return selection bytes starting at this + TCL_UNUSED(void *), /* Not used. */ + TCL_UNUSED(int), /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ - int maxBytes) /* Maximum # of bytes to store at buffer. */ + TCL_UNUSED(int)) /* Maximum # of bytes to store at buffer. */ { buffer[0] = '.'; buffer[1] = 0; @@ -206,7 +206,7 @@ static void ClipboardLostSel( ClientData clientData) /* Pointer to TkDisplay structure. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; dispPtr->clipboardActive = 0; } @@ -359,7 +359,7 @@ Tk_ClipboardAppend( } } if (targetPtr == NULL) { - targetPtr = ckalloc(sizeof(TkClipboardTarget)); + targetPtr = (TkClipboardTarget *)ckalloc(sizeof(TkClipboardTarget)); targetPtr->type = type; targetPtr->format = format; targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL; @@ -381,7 +381,7 @@ Tk_ClipboardAppend( * Append a new buffer to the buffer chain. */ - cbPtr = ckalloc(sizeof(TkClipboardBuffer)); + cbPtr = (TkClipboardBuffer *)ckalloc(sizeof(TkClipboardBuffer)); cbPtr->nextPtr = NULL; if (targetPtr->lastBufferPtr != NULL) { targetPtr->lastBufferPtr->nextPtr = cbPtr; @@ -391,7 +391,7 @@ Tk_ClipboardAppend( targetPtr->lastBufferPtr = cbPtr; cbPtr->length = strlen(buffer); - cbPtr->buffer = ckalloc(cbPtr->length + 1); + cbPtr->buffer = (char *)ckalloc(cbPtr->length + 1); strcpy(cbPtr->buffer, buffer); TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr); @@ -423,7 +423,7 @@ Tk_ClipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = (Tk_Window) clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; static const char *const optionStrings[] = { "append", "clear", "get", NULL }; @@ -636,8 +636,8 @@ Tk_ClipboardObjCmd( int TkClipInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkDisplay *dispPtr)/* Display to initialize. */ + TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting. */ + TkDisplay *dispPtr)/* Display to initialize. */ { XSetWindowAttributes atts; @@ -700,12 +700,11 @@ TkClipInit( *-------------------------------------------------------------- */ - /* ARGSUSED */ static int ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 89b5254..193c3d6 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -99,7 +99,7 @@ Tk_BellObjCmd( "-displayof", "-nice", NULL }; enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE }; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int i, index, nice = 0; Tk_ErrorHandler handler; @@ -163,7 +163,7 @@ Tk_BindObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; ClientData object; const char *string; @@ -187,7 +187,7 @@ Tk_BindObjCmd( } object = (ClientData) winPtr->pathName; } else { - winPtr = clientData; + winPtr = (TkWindow *)clientData; object = (ClientData) Tk_GetUid(string); } @@ -285,10 +285,10 @@ TkBindEventProc( */ if (winPtr->numTags > MAX_OBJS) { - objPtr = ckalloc(winPtr->numTags * sizeof(ClientData)); + objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *)); } for (i = 0; i < winPtr->numTags; i++) { - p = winPtr->tagPtr[i]; + p = (const char *)winPtr->tagPtr[i]; if (*p == '.') { hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p); if (hPtr != NULL) { @@ -347,7 +347,7 @@ Tk_BindtagsObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr, *winPtr2; int i, length; const char *p; @@ -399,7 +399,7 @@ Tk_BindtagsObjCmd( } winPtr->numTags = length; - winPtr->tagPtr = ckalloc(length * sizeof(ClientData)); + winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *)); for (i = 0; i < length; i++) { p = Tcl_GetString(tags[i]); if (p[0] == '.') { @@ -412,7 +412,7 @@ Tk_BindtagsObjCmd( * is one. */ - copy = ckalloc(strlen(p) + 1); + copy = (char *)ckalloc(strlen(p) + 1); strcpy(copy, p); winPtr->tagPtr[i] = (ClientData) copy; } else { @@ -448,7 +448,7 @@ TkFreeBindingTags( const char *p; for (i = 0; i < winPtr->numTags; i++) { - p = winPtr->tagPtr[i]; + p = (const char *)winPtr->tagPtr[i]; if (*p == '.') { /* * Names starting with "." are malloced rather than Uids, so they @@ -488,7 +488,7 @@ Tk_DestroyObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window window; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int i; for (i = 1; i < objc; i++) { @@ -527,7 +527,6 @@ Tk_DestroyObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_LowerObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -535,7 +534,7 @@ Tk_LowerObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window mainwin = clientData; + Tk_Window mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; if ((objc != 2) && (objc != 3)) { @@ -587,7 +586,6 @@ Tk_LowerObjCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_RaiseObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -595,7 +593,7 @@ Tk_RaiseObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window mainwin = clientData; + Tk_Window mainwin = (Tk_Window)clientData; Tk_Window tkwin, other; if ((objc != 2) && (objc != 3)) { @@ -683,7 +681,7 @@ AppnameCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr; const char *string; @@ -715,7 +713,7 @@ CaretCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int index; Tcl_Obj *objPtr; TkCaret *caretPtr; @@ -807,7 +805,7 @@ ScalingCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Screen *screenPtr; int skip, width, height; double d; @@ -858,7 +856,7 @@ UseinputmethodsCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkDisplay *dispPtr; int skip; @@ -906,7 +904,7 @@ UseinputmethodsCmd( int WindowingsystemCmd( - ClientData clientData, /* Main window associated with interpreter. */ + TCL_UNUSED(void *), /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -935,7 +933,7 @@ InactiveCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { @@ -991,7 +989,6 @@ InactiveCmd( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_TkwaitObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -999,7 +996,7 @@ Tk_TkwaitObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int done, index; int code = TCL_OK; static const char *const optionStrings[] = { @@ -1120,28 +1117,26 @@ Tk_TkwaitObjCmd( return code; } - /* ARGSUSED */ static char * WaitVariableProc( ClientData clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Name of variable. */ - const char *name2, /* Second part of variable name. */ - int flags) /* Information about what happened. */ + TCL_UNUSED(Tcl_Interp *), /* Interpreter containing variable. */ + TCL_UNUSED(const char *), /* Name of variable. */ + TCL_UNUSED(const char *), /* Second part of variable name. */ + TCL_UNUSED(int)) /* Information about what happened. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; *donePtr = 1; return NULL; } - /*ARGSUSED*/ static void WaitVisibilityProc( ClientData clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event (not used). */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; if (eventPtr->type == VisibilityNotify) { *donePtr = 1; @@ -1155,7 +1150,7 @@ WaitWindowProc( ClientData clientData, /* Pointer to integer to set to 1. */ XEvent *eventPtr) /* Information about event. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; if (eventPtr->type == DestroyNotify) { *donePtr = 1; @@ -1179,10 +1174,9 @@ WaitWindowProc( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_UpdateObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + TCL_UNUSED(void *), /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1288,7 +1282,7 @@ Tk_WinfoObjCmd( int index, x, y, width, height, useX, useY, c_class, skip; const char *string; TkWindow *winPtr; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; static const TkStateMap visualMap[] = { {PseudoColor, "pseudocolor"}, @@ -1579,11 +1573,11 @@ Tk_WinfoObjCmd( objv += skip; string = Tcl_GetString(objv[2]); Tcl_SetObjResult(interp, - Tcl_NewLongObj((long) Tk_InternAtom(tkwin, string))); + Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string))); break; case WIN_ATOMNAME: { const char *name; - long id; + Tcl_WideInt id; skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { @@ -1594,7 +1588,7 @@ Tk_WinfoObjCmd( return TCL_ERROR; } objv += skip; - if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) { + if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } name = Tk_GetAtomName(tkwin, (Atom) id); @@ -1774,7 +1768,7 @@ Tk_WinfoObjCmd( break; } case WIN_VISUALSAVAILABLE: { - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; int count, i; int includeVisualId; Tcl_Obj *strPtr, *resultPtr; @@ -1795,9 +1789,9 @@ Tk_WinfoObjCmd( return TCL_ERROR; } - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask, - &template, &count); + &templ, &count); if (visInfoPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't find any visuals for screen", -1)); @@ -2094,7 +2088,7 @@ TkGetDisplayOf( } string = Tcl_GetStringFromObj(objv[0], &length); if ((length >= 2) && - (strncmp(string, "-displayof", (unsigned) length) == 0)) { + (strncmp(string, "-displayof", length) == 0)) { if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-displayof\" missing", -1)); @@ -2128,12 +2122,11 @@ TkGetDisplayOf( *---------------------------------------------------------------------- */ - /* ARGSUSED */ int TkDeadAppObjCmd( - ClientData clientData, /* Dummy. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + TCL_UNUSED(int), /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tcl_SetObjResult(interp, Tcl_ObjPrintf( diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 7e0943d..46338e2 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -178,7 +178,7 @@ Tk_CreateOptionTable( const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; int numOptions, i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -202,7 +202,7 @@ Tk_CreateOptionTable( hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *) templatePtr, &newEntry); if (!newEntry) { - tablePtr = Tcl_GetHashValue(hashEntryPtr); + tablePtr = (OptionTable *)Tcl_GetHashValue(hashEntryPtr); tablePtr->refCount++; return (Tk_OptionTable) tablePtr; } @@ -216,7 +216,7 @@ Tk_CreateOptionTable( for (specPtr = templatePtr; specPtr->type != TK_OPTION_END; specPtr++) { numOptions++; } - tablePtr = ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option))); + tablePtr = (OptionTable *)ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option))); tablePtr->refCount = 1; tablePtr->hashEntryPtr = hashEntryPtr; tablePtr->nextPtr = NULL; @@ -266,7 +266,7 @@ Tk_CreateOptionTable( || (specPtr->type == TK_OPTION_BORDER)) && (specPtr->clientData != NULL)) { optionPtr->extra.monoColorPtr = - Tcl_NewStringObj(specPtr->clientData, -1); + Tcl_NewStringObj((const char *)specPtr->clientData, -1); Tcl_IncrRefCount(optionPtr->extra.monoColorPtr); } @@ -275,7 +275,7 @@ Tk_CreateOptionTable( * Get the custom parsing, etc., functions. */ - optionPtr->extra.custom = specPtr->clientData; + optionPtr->extra.custom = (const Tk_ObjCustomOption *)specPtr->clientData; } } if (((specPtr->type == TK_OPTION_STRING) @@ -300,7 +300,7 @@ Tk_CreateOptionTable( if (specPtr->clientData != NULL) { tablePtr->nextPtr = (OptionTable *) - Tk_CreateOptionTable(interp, specPtr->clientData); + Tk_CreateOptionTable(interp, (Tk_OptionSpec *)specPtr->clientData); } return (Tk_OptionTable) tablePtr; @@ -332,8 +332,7 @@ Tk_DeleteOptionTable( Option *optionPtr; int count; - tablePtr->refCount--; - if (tablePtr->refCount > 0) { + if (tablePtr->refCount-- > 1) { return; } @@ -1166,9 +1165,9 @@ TkGetOptionSpec( static void FreeOptionInternalRep( - register Tcl_Obj *objPtr) /* Object whose internal rep to free. */ + Tcl_Obj *objPtr) /* Object whose internal rep to free. */ { - register Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1; + Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1; Tk_DeleteOptionTable(tablePtr); objPtr->typePtr = NULL; @@ -1192,7 +1191,7 @@ DupOptionInternalRep( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - register OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1; + OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1; tablePtr->refCount++; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep = srcObjPtr->internalRep; @@ -1289,7 +1288,7 @@ Tk_SetOptions( * more space. */ - newSavePtr = ckalloc(sizeof(Tk_SavedOptions)); + newSavePtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions)); newSavePtr->recordPtr = recordPtr; newSavePtr->tkwin = tkwin; newSavePtr->numItems = 0; @@ -1529,7 +1528,6 @@ Tk_FreeSavedOptions( *---------------------------------------------------------------------- */ - /* ARGSUSED */ void Tk_FreeConfigOptions( char *recordPtr, /* Record whose fields contain current values @@ -2068,7 +2066,7 @@ Tk_GetOptionValue( Tcl_Obj * TkDebugConfig( - Tcl_Interp *interp, /* Interpreter in which the table is + TCL_UNUSED(Tcl_Interp *), /* Interpreter in which the table is * defined. */ Tk_OptionTable table) /* Table about which information is to be * returned. May not necessarily exist in the @@ -2078,7 +2076,7 @@ TkDebugConfig( Tcl_HashEntry *hashEntryPtr; Tcl_HashSearch search; Tcl_Obj *objPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); objPtr = Tcl_NewObj(); diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 701ce77..095d132 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -67,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ - TCL_CHANNEL_VERSION_5, /* v4 channel */ + TCL_CHANNEL_VERSION_5, /* v5 channel */ ConsoleClose, /* Close proc. */ ConsoleInput, /* Input proc. */ ConsoleOutput, /* Output proc. */ @@ -228,7 +228,7 @@ Tk_InitConsoleChannels( return; } - consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); + consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); if (*consoleInitPtr) { /* * We've already initialized console channels in this thread. @@ -256,13 +256,13 @@ Tk_InitConsoleChannels( * interp for it to live in. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo)); info->consoleInterp = NULL; info->interp = NULL; info->refCount = 0; if (doIn) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -279,7 +279,7 @@ Tk_InitConsoleChannels( } if (doOut) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -296,7 +296,7 @@ Tk_InitConsoleChannels( } if (doErr) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -378,7 +378,7 @@ Tk_CreateConsoleWindow( * New ConsoleInfo for a new console window. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; /* @@ -408,7 +408,7 @@ Tk_CreateConsoleWindow( } } } else { - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; } @@ -457,7 +457,7 @@ Tk_CreateConsoleWindow( if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { ckfree(info); } } @@ -498,7 +498,7 @@ ConsoleOutput( int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ { - ChannelData *data = instanceData; + ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; *errorCode = 0; @@ -559,14 +559,13 @@ ConsoleOutput( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ConsoleInput( - ClientData instanceData, /* Unused. */ - char *buf, /* Where to store data read. */ - int bufSize, /* How much space is available in the + TCL_UNUSED(void *), + TCL_UNUSED(char *), /* Where to store data read. */ + TCL_UNUSED(int), /* How much space is available in the * buffer? */ - int *errorCode) /* Where to store error code. */ + TCL_UNUSED(int *)) /* Where to store error code. */ { return 0; /* Always return EOF. */ } @@ -587,17 +586,16 @@ ConsoleInput( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ConsoleClose( - ClientData instanceData, /* Unused. */ - Tcl_Interp *interp) /* Unused. */ + ClientData instanceData, + TCL_UNUSED(Tcl_Interp *)) { - ChannelData *data = instanceData; + ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; if (info) { - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { /* * Assuming the Tcl_Interp * fields must already be NULL. */ @@ -639,11 +637,10 @@ Console2Close( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static void ConsoleWatch( - ClientData instanceData, /* Device ID for the channel. */ - int mask) /* OR-ed combination of TCL_READABLE, + TCL_UNUSED(void *), /* Device ID for the channel. */ + TCL_UNUSED(int)) /* OR-ed combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION, for the * events we are interested in. */ { @@ -666,14 +663,13 @@ ConsoleWatch( *---------------------------------------------------------------------- */ - /* ARGSUSED */ static int ConsoleHandle( - ClientData instanceData, /* Device ID for the channel. */ - int direction, /* TCL_READABLE or TCL_WRITABLE to indicate + TCL_UNUSED(void *), /* Device ID for the channel. */ + TCL_UNUSED(int), /* TCL_READABLE or TCL_WRITABLE to indicate * which direction of the channel is being * requested. */ - ClientData *handlePtr) /* Where to store handle */ + TCL_UNUSED(void **)) /* Where to store handle */ { return TCL_ERROR; } @@ -707,7 +703,7 @@ ConsoleObjCmd( "eval", "hide", "show", "title", NULL}; enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE}; Tcl_Obj *cmd = NULL; - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (objc < 2) { @@ -797,7 +793,7 @@ InterpreterObjCmd( int index, result = TCL_OK; static const char *const options[] = {"eval", "record", NULL}; enum option {OTHER_EVAL, OTHER_RECORD}; - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *otherInterp = info->interp; if (objc < 2) { @@ -865,7 +861,7 @@ static void DeleteConsoleInterp( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_DeleteInterp(interp); } @@ -892,13 +888,13 @@ InterpDeleteProc( ClientData clientData, Tcl_Interp *interp) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; } - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { ckfree(info); } } @@ -924,12 +920,12 @@ static void ConsoleDeleteProc( ClientData clientData) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); } - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { ckfree(info); } } @@ -959,14 +955,14 @@ ConsoleEventProc( XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } - if (--info->refCount <= 0) { + if (info->refCount-- <= 1) { ckfree(info); } } diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 0994a07..456b86d 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -685,8 +685,8 @@ Tk_CreateEventHandler( Tk_EventProc *proc, /* Function to call for each selected event */ ClientData clientData) /* Arbitrary data to pass to proc. */ { - register TkEventHandler *handlerPtr; - register TkWindow *winPtr = (TkWindow *) token; + TkEventHandler *handlerPtr; + TkWindow *winPtr = (TkWindow *)token; /* * Skim through the list of existing handlers to (a) compute the overall @@ -701,7 +701,7 @@ Tk_CreateEventHandler( * No event handlers defined at all, so must create. */ - handlerPtr = ckalloc(sizeof(TkEventHandler)); + handlerPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler)); winPtr->handlerList = handlerPtr; } else { int found = 0; @@ -732,7 +732,7 @@ Tk_CreateEventHandler( * No event handler matched, so create a new one. */ - handlerPtr->nextPtr = ckalloc(sizeof(TkEventHandler)); + handlerPtr->nextPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler)); handlerPtr = handlerPtr->nextPtr; } @@ -775,11 +775,11 @@ Tk_DeleteEventHandler( Tk_EventProc *proc, ClientData clientData) { - register TkEventHandler *handlerPtr; - register InProgress *ipPtr; + TkEventHandler *handlerPtr; + InProgress *ipPtr; TkEventHandler *prevPtr; - register TkWindow *winPtr = (TkWindow *) token; - ThreadSpecificData *tsdPtr = + TkWindow *winPtr = (TkWindow *) token; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -851,10 +851,10 @@ Tk_CreateGenericHandler( ClientData clientData) /* One-word value to pass to proc. */ { GenericHandler *handlerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - handlerPtr = ckalloc(sizeof(GenericHandler)); + handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler)); handlerPtr->proc = proc; handlerPtr->clientData = clientData; @@ -892,7 +892,7 @@ Tk_DeleteGenericHandler( ClientData clientData) { GenericHandler * handler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (handler=tsdPtr->genericList ; handler ; handler=handler->nextPtr) { @@ -925,7 +925,7 @@ Tk_CreateClientMessageHandler( Tk_ClientMessageProc *proc) /* Function to call on event. */ { GenericHandler *handlerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -933,7 +933,7 @@ Tk_CreateClientMessageHandler( * with an extra clientData field we'll never use. */ - handlerPtr = ckalloc(sizeof(GenericHandler)); + handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler)); handlerPtr->proc = (Tk_GenericProc *) proc; handlerPtr->clientData = NULL; /* never used */ @@ -971,7 +971,7 @@ Tk_DeleteClientMessageHandler( Tk_ClientMessageProc *proc) { GenericHandler * handler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (handler=tsdPtr->cmList ; handler!=NULL ; handler=handler->nextPtr) { @@ -1002,7 +1002,7 @@ Tk_DeleteClientMessageHandler( void TkEventInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->handlersActive = 0; @@ -1035,9 +1035,9 @@ TkEventInit(void) static int TkXErrorHandler( ClientData clientData, /* Pointer to flag we set. */ - XErrorEvent *errEventPtr) /* X error info. */ + TCL_UNUSED(XErrorEvent *)) /* X error info. */ { - int *error = clientData; + int *error = (int *)clientData; *error = 1; return 0; @@ -1124,12 +1124,12 @@ void Tk_HandleEvent( XEvent *eventPtr) /* Event to dispatch. */ { - register TkEventHandler *handlerPtr; + TkEventHandler *handlerPtr; TkWindow *winPtr; unsigned long mask; InProgress ip; Tcl_Interp *interp = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); #if !defined(MAC_OSX_TK) && !defined(_WIN32) @@ -1337,9 +1337,9 @@ TkEventDeadWindow( TkWindow *winPtr) /* Information about the window that is being * deleted. */ { - register TkEventHandler *handlerPtr; - register InProgress *ipPtr; - ThreadSpecificData *tsdPtr = + TkEventHandler *handlerPtr; + InProgress *ipPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1387,8 +1387,8 @@ Time TkCurrentTime( TkDisplay *dispPtr) /* Display for which the time is desired. */ { - register XEvent *eventPtr; - ThreadSpecificData *tsdPtr = + XEvent *eventPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->pendingPtr == NULL) { @@ -1442,7 +1442,7 @@ Tk_RestrictEvents( * argument. */ { Tk_RestrictProc *prev; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); prev = tsdPtr->restrictProc; @@ -1535,7 +1535,7 @@ Tk_QueueWindowEvent( */ if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) { - wevPtr = ckalloc(sizeof(TkWindowEvent)); + wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent)); wevPtr->header.proc = WindowEventProc; wevPtr->event = *eventPtr; Tcl_QueueEvent(&wevPtr->header, position); @@ -1567,7 +1567,7 @@ Tk_QueueWindowEvent( } } - wevPtr = ckalloc(sizeof(TkWindowEvent)); + wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent)); wevPtr->header.proc = WindowEventProc; wevPtr->event = *eventPtr; if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) { @@ -1698,7 +1698,7 @@ WindowEventProc( { TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr; Tk_RestrictAction result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(flags & TCL_WINDOW_EVENTS)) { @@ -1799,7 +1799,7 @@ DelayedMotionProc( ClientData clientData) /* Pointer to display containing a delayed * motion event to be serviced. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; if (dispPtr->delayedMotionPtr == NULL) { Tcl_Panic("DelayedMotionProc found no delayed mouse motion event"); @@ -1831,7 +1831,7 @@ TkCreateExitHandler( { ExitHandler *exitPtr; - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); @@ -1927,10 +1927,10 @@ TkCreateThreadExitHandler( ClientData clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; @@ -1968,7 +1968,7 @@ TkDeleteThreadExitHandler( ClientData clientData) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr, *prevPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (prevPtr = NULL, exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL; @@ -2007,7 +2007,7 @@ TkDeleteThreadExitHandler( void TkFinalize( - ClientData clientData) /* Arbitrary value to pass to proc. */ + TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; @@ -2059,10 +2059,10 @@ TkFinalize( void TkFinalizeThread( - ClientData clientData) /* Arbitrary value to pass to proc. */ + TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL); diff --git a/generic/tkGet.c b/generic/tkGet.c index 6eff3a3..f2aed2c 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -493,10 +493,10 @@ Tk_NameOfJustify( static void FreeUidThreadExitProc( - ClientData clientData) /* Not used. */ + TCL_UNUSED(void *)) { - ThreadSpecificData *tsdPtr = - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DeleteHashTable(&tsdPtr->uidTable); tsdPtr->initialized = 0; @@ -529,7 +529,7 @@ Tk_GetUid( const char *string) /* String to convert. */ { int dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashTable *tablePtr = &tsdPtr->uidTable; diff --git a/generic/tkGrab.c b/generic/tkGrab.c index 2855637..a1ff46c 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -166,7 +166,6 @@ static void ReleaseButtonGrab(TkDisplay *dispPtr); *---------------------------------------------------------------------- */ - /* ARGSUSED */ int Tk_GrabObjCmd( ClientData clientData, /* Main window associated with interpreter. */ @@ -223,7 +222,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, arg, clientData); + tkwin = Tk_NameToWindow(interp, arg, (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -239,7 +238,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -265,7 +264,7 @@ Tk_GrabObjCmd( } if (objc == 3) { tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); if (tkwin == NULL) { return TCL_ERROR; } @@ -294,7 +293,7 @@ Tk_GrabObjCmd( Tcl_WrongNumArgs(interp, 1, objv, "release window"); return TCL_ERROR; } - tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData); + tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData); if (tkwin == NULL) { Tcl_ResetResult(interp); } else { @@ -311,7 +310,7 @@ Tk_GrabObjCmd( if (objc == 3) { globalGrab = 0; tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); } else { globalGrab = 1; @@ -327,7 +326,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]), - clientData); + (Tk_Window)clientData); } if (tkwin == NULL) { return TCL_ERROR; @@ -344,7 +343,7 @@ Tk_GrabObjCmd( return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), - clientData); + (Tk_Window)clientData); if (winPtr == NULL) { return TCL_ERROR; } @@ -638,7 +637,7 @@ Tk_Ungrab( static void ReleaseButtonGrab( - register TkDisplay *dispPtr)/* Display whose button grab is to be + TkDisplay *dispPtr)/* Display whose button grab is to be * released. */ { unsigned int serial; @@ -684,11 +683,11 @@ ReleaseButtonGrab( int TkPointerEvent( - register XEvent *eventPtr, /* Pointer to the event. */ + XEvent *eventPtr, /* Pointer to the event. */ TkWindow *winPtr) /* Tk's information for window where event was * reported. */ { - register TkWindow *winPtr2; + TkWindow *winPtr2; TkDisplay *dispPtr = winPtr->dispPtr; unsigned int serial; int outsideGrabTree = 0; @@ -872,7 +871,7 @@ TkPointerEvent( } else { if (eventPtr->xbutton.button != AnyButton && ((eventPtr->xbutton.state & ALL_BUTTONS) - == (unsigned int)TkGetButtonMask(eventPtr->xbutton.button))) { + == TkGetButtonMask(eventPtr->xbutton.button))) { ReleaseButtonGrab(dispPtr); /* Note 4. */ } } @@ -907,14 +906,14 @@ TkPointerEvent( void TkChangeEventWindow( - register XEvent *eventPtr, /* Event to retarget. Must have type + XEvent *eventPtr, /* Event to retarget. Must have type * ButtonPress, ButtonRelease, KeyPress, * KeyRelease, MotionNotify, EnterNotify, or * LeaveNotify. */ TkWindow *winPtr) /* New target window for event. */ { int x, y, sameScreen, bd; - register TkWindow *childPtr; + TkWindow *childPtr; eventPtr->xmotion.window = Tk_WindowId(winPtr); if (eventPtr->xmotion.root == @@ -995,7 +994,7 @@ TkInOutEvents( Tcl_QueuePosition position) /* Position at which events are added to the * system event queue. */ { - register TkWindow *winPtr; + TkWindow *winPtr; int upLevels, downLevels, i, j, focus; /* @@ -1188,7 +1187,7 @@ MovePointer2( void TkGrabDeadWindow( - register TkWindow *winPtr) /* Window that is in the process of being + TkWindow *winPtr) /* Window that is in the process of being * deleted. */ { TkDisplay *dispPtr = winPtr->dispPtr; @@ -1278,7 +1277,7 @@ GrabRestrictProc( ClientData arg, XEvent *eventPtr) { - GrabInfo *info = arg; + GrabInfo *info = (GrabInfo *)arg; int mode, diff; /* @@ -1336,7 +1335,7 @@ QueueGrabWindowChange( { NewGrabWinEvent *grabEvPtr; - grabEvPtr = ckalloc(sizeof(NewGrabWinEvent)); + grabEvPtr = (NewGrabWinEvent *)ckalloc(sizeof(NewGrabWinEvent)); grabEvPtr->header.proc = GrabWinEventProc; grabEvPtr->dispPtr = dispPtr; if (grabWinPtr == NULL) { @@ -1371,7 +1370,7 @@ QueueGrabWindowChange( static int GrabWinEventProc( Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */ - int flags) /* Flags argument to Tcl_DoOneEvent: indicates + TCL_UNUSED(int)) /* Flags argument to Tcl_DoOneEvent: indicates * what kinds of events are being processed * right now. */ { @@ -1416,7 +1415,7 @@ FindCommonAncestor( int *countPtr2) /* Store nesting level of winPtr2 within * common ancestor here. */ { - register TkWindow *winPtr; + TkWindow *winPtr; TkWindow *ancestorPtr; int count1, count2, i; diff --git a/generic/tkObj.c b/generic/tkObj.c index 559f0e2..716c7e1 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -149,7 +149,7 @@ static const Tcl_ObjType windowObjType = { static ThreadSpecificData * GetTypeCache(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { @@ -408,8 +408,8 @@ FreePixelInternalRep( static void DupPixelInternalRep( - register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ + Tcl_Obj *copyPtr) /* Object with internal rep to set. */ { copyPtr->typePtr = srcPtr->typePtr; @@ -419,7 +419,7 @@ DupPixelInternalRep( PixelRep *oldPtr, *newPtr; oldPtr = GET_COMPLEXPIXEL(srcPtr); - newPtr = ckalloc(sizeof(PixelRep)); + newPtr = (PixelRep *)ckalloc(sizeof(PixelRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; @@ -503,7 +503,7 @@ SetPixelFromAny( if ((units < 0) && (i == d)) { SET_SIMPLEPIXEL(objPtr, i); } else { - PixelRep *pixelPtr = ckalloc(sizeof(PixelRep)); + PixelRep *pixelPtr = (PixelRep *)ckalloc(sizeof(PixelRep)); pixelPtr->value = d; pixelPtr->units = units; @@ -564,7 +564,7 @@ Tk_GetMMFromObj( } } - mmPtr = objPtr->internalRep.twoPtrValue.ptr1; + mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; if (mmPtr->tkwin != tkwin) { d = mmPtr->value; if (mmPtr->units == -1) { @@ -628,14 +628,14 @@ FreeMMInternalRep( static void DupMMInternalRep( - register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ - register Tcl_Obj *copyPtr) /* Object with internal rep to set. */ + Tcl_Obj *srcPtr, /* Object with internal rep to copy. */ + Tcl_Obj *copyPtr) /* Object with internal rep to set. */ { MMRep *oldPtr, *newPtr; copyPtr->typePtr = srcPtr->typePtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(MMRep)); + oldPtr = (MMRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (MMRep *)ckalloc(sizeof(MMRep)); newPtr->value = oldPtr->value; newPtr->units = oldPtr->units; newPtr->tkwin = oldPtr->tkwin; @@ -664,13 +664,13 @@ DupMMInternalRep( static void UpdateStringOfMM( - register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ + Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; size_t len; - mmPtr = objPtr->internalRep.twoPtrValue.ptr1; + mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); @@ -679,7 +679,7 @@ UpdateStringOfMM( Tcl_PrintDouble(NULL, mmPtr->value, buffer); len = strlen(buffer); - objPtr->bytes = ckalloc(len + 1); + objPtr->bytes = (char *)ckalloc(len + 1); strcpy(objPtr->bytes, buffer); objPtr->length = len; } @@ -787,7 +787,7 @@ SetMMFromAny( objPtr->typePtr = &mmObjType; - mmPtr = ckalloc(sizeof(MMRep)); + mmPtr = (MMRep *)ckalloc(sizeof(MMRep)); mmPtr->value = d; mmPtr->units = units; mmPtr->tkwin = NULL; @@ -827,7 +827,7 @@ TkGetWindowFromObj( Tk_Window *windowPtr) /* Place to store resulting window. */ { TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; - register WindowRep *winPtr; + WindowRep *winPtr; if (objPtr->typePtr != &windowObjType) { int result = SetWindowFromAny(interp, objPtr); @@ -836,7 +836,7 @@ TkGetWindowFromObj( } } - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; if (winPtr->tkwin == NULL || winPtr->mainPtr == NULL || winPtr->mainPtr != mainPtr @@ -882,8 +882,8 @@ TkGetWindowFromObj( static int SetWindowFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ + TCL_UNUSED(Tcl_Interp *), + Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; WindowRep *winPtr; @@ -898,7 +898,7 @@ SetWindowFromAny( typePtr->freeIntRepProc(objPtr); } - winPtr = ckalloc(sizeof(WindowRep)); + winPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); winPtr->tkwin = NULL; winPtr->mainPtr = NULL; winPtr->epoch = 0; @@ -993,7 +993,7 @@ TkNewWindowObj( { Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; - register WindowRep *winPtr; + WindowRep *winPtr; SetWindowFromAny(NULL, objPtr); diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index d05a2c7..d01da95 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -82,7 +82,7 @@ Tk_ConfigureWidget( * considered. Also, may have * TK_CONFIG_ARGV_ONLY set. */ { - register Tk_ConfigSpec *specPtr, *staticSpecs; + Tk_ConfigSpec *specPtr, *staticSpecs; Tk_Uid value; /* Value of option from database. */ int needFlags; /* Specs must contain this set of flags or * else they are not considered. */ @@ -245,8 +245,8 @@ FindConfigSpec( int hateFlags) /* Flags that must NOT be present in matching * entry. */ { - register Tk_ConfigSpec *specPtr; - register char c; /* First character of current argument. */ + Tk_ConfigSpec *specPtr; + char c; /* First character of current argument. */ Tk_ConfigSpec *matchPtr; /* Matching spec, or NULL. */ size_t length; @@ -376,7 +376,7 @@ DoConfig( if (nullValue) { newStr = NULL; } else { - newStr = ckalloc(strlen(value) + 1); + newStr = (char *)ckalloc(strlen(value) + 1); strcpy(newStr, value); } oldStr = *((char **) ptr); @@ -603,7 +603,7 @@ Tk_ConfigureInfo( * be present in config specs for them to be * considered. */ { - register Tk_ConfigSpec *specPtr, *staticSpecs; + Tk_ConfigSpec *specPtr, *staticSpecs; int needFlags, hateFlags; char *list; const char *leader = "{"; @@ -686,7 +686,7 @@ FormatConfigInfo( Tcl_Interp *interp, /* Interpreter to use for things like * floating-point precision. */ Tk_Window tkwin, /* Window corresponding to widget. */ - register const Tk_ConfigSpec *specPtr, + const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ char *widgRec) /* Pointer to record holding current values of @@ -971,7 +971,6 @@ Tk_ConfigureValue( *---------------------------------------------------------------------- */ - /* ARGSUSED */ void Tk_FreeOptions( const Tk_ConfigSpec *specs, /* Describes legal options. */ @@ -983,7 +982,7 @@ Tk_FreeOptions( * be present in config specs for them to be * considered. */ { - register const Tk_ConfigSpec *specPtr; + const Tk_ConfigSpec *specPtr; char *ptr; for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) { @@ -1071,10 +1070,10 @@ GetCachedSpecs( * self-initializing code. */ - specCacheTablePtr = + specCacheTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL); if (specCacheTablePtr == NULL) { - specCacheTablePtr = ckalloc(sizeof(Tcl_HashTable)); + specCacheTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS); Tcl_SetAssocData(interp, "tkConfigSpec.threadTable", DeleteSpecCacheTable, specCacheTablePtr); @@ -1088,7 +1087,7 @@ GetCachedSpecs( entryPtr = Tcl_CreateHashEntry(specCacheTablePtr, (char *) staticSpecs, &isNew); if (isNew) { - unsigned int entrySpace = sizeof(Tk_ConfigSpec); + size_t entrySpace = sizeof(Tk_ConfigSpec); const Tk_ConfigSpec *staticSpecPtr; Tk_ConfigSpec *specPtr; @@ -1107,7 +1106,7 @@ GetCachedSpecs( * from the origin. */ - cachedSpecs = ckalloc(entrySpace); + cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace); memcpy(cachedSpecs, staticSpecs, entrySpace); Tcl_SetHashValue(entryPtr, cachedSpecs); @@ -1131,7 +1130,7 @@ GetCachedSpecs( } } } else { - cachedSpecs = Tcl_GetHashValue(entryPtr); + cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr); } return cachedSpecs; @@ -1157,9 +1156,9 @@ GetCachedSpecs( static void DeleteSpecCacheTable( ClientData clientData, - Tcl_Interp *interp) + TCL_UNUSED(Tcl_Interp *)) { - Tcl_HashTable *tablePtr = clientData; + Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; diff --git a/generic/tkStyle.c b/generic/tkStyle.c index 9cf95d0..1289f14 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -178,9 +178,9 @@ static const Tcl_ObjType styleObjType = { void TkStylePkgInit( - TkMainInfo *mainPtr) /* The application being created. */ + TCL_UNUSED(TkMainInfo *)) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->nbInit != 0) { @@ -233,9 +233,9 @@ TkStylePkgInit( void TkStylePkgFree( - TkMainInfo *mainPtr) /* The application being deleted. */ + TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; @@ -264,7 +264,7 @@ TkStylePkgFree( entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (entryPtr != NULL) { - enginePtr = Tcl_GetHashValue(entryPtr); + enginePtr = (StyleEngine *)Tcl_GetHashValue(entryPtr); FreeStyleEngine(enginePtr); ckfree(enginePtr); entryPtr = Tcl_NextHashEntry(&search); @@ -307,7 +307,7 @@ Tk_RegisterStyleEngine( Tk_StyleEngine parent) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -331,8 +331,8 @@ Tk_RegisterStyleEngine( * Allocate and intitialize a new engine. */ - enginePtr = ckalloc(sizeof(StyleEngine)); - InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr), + enginePtr = (StyleEngine *)ckalloc(sizeof(StyleEngine)); + InitStyleEngine(enginePtr, (const char *)Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr), (StyleEngine *) parent); Tcl_SetHashValue(entryPtr, enginePtr); @@ -364,7 +364,7 @@ InitStyleEngine( StyleEngine *parentPtr) /* The engine's parent. NULL means the default * system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -389,7 +389,7 @@ InitStyleEngine( */ if (tsdPtr->nbElements > 0) { - enginePtr->elements = ckalloc( + enginePtr->elements = (StyledElement *)ckalloc( sizeof(StyledElement) * tsdPtr->nbElements); for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) { InitStyledElement(enginePtr->elements+elementId); @@ -419,7 +419,7 @@ static void FreeStyleEngine( StyleEngine *enginePtr) /* The style engine to free. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int elementId; @@ -454,7 +454,7 @@ Tk_GetStyleEngine( const char *name) /* Name of the engine to retrieve. NULL or * empty means the default system engine. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; @@ -467,7 +467,7 @@ Tk_GetStyleEngine( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Tk_StyleEngine)Tcl_GetHashValue(entryPtr); } /* @@ -521,7 +521,7 @@ InitElement( static void FreeElement( - Element *elementPtr) /* The element to free. */ + TCL_UNUSED(Element *)) /* The element to free. */ { /* Nothing to do. */ } @@ -604,7 +604,7 @@ CreateElement( * created explicitly (being registered) or * implicitly (by a derived element). */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr, *engineEntryPtr; Tcl_HashSearch search; @@ -642,10 +642,10 @@ CreateElement( * Reallocate element table. */ - tsdPtr->elements = ckrealloc(tsdPtr->elements, + tsdPtr->elements = (Element *)ckrealloc(tsdPtr->elements, sizeof(Element) * tsdPtr->nbElements); InitElement(tsdPtr->elements+elementId, - Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId, + (const char *)Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId, genericId, create); /* @@ -654,9 +654,9 @@ CreateElement( engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search); while (engineEntryPtr != NULL) { - enginePtr = Tcl_GetHashValue(engineEntryPtr); + enginePtr = (StyleEngine *)Tcl_GetHashValue(engineEntryPtr); - enginePtr->elements = ckrealloc(enginePtr->elements, + enginePtr->elements = (StyledElement *)ckrealloc(enginePtr->elements, sizeof(StyledElement) * tsdPtr->nbElements); InitStyledElement(enginePtr->elements+elementId); @@ -686,7 +686,7 @@ int Tk_GetElementId( const char *name) /* Name of the element. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int genericId = -1; @@ -759,7 +759,7 @@ Tk_RegisterStyledElement( StyledElement *elementPtr; Tk_ElementSpec *specPtr; int nbOptions; - register Tk_ElementOptionSpec *srcOptions, *dstOptions; + Tk_ElementOptionSpec *srcOptions, *dstOptions; if (templatePtr->version != TK_STYLE_VERSION_1) { /* @@ -786,16 +786,16 @@ Tk_RegisterStyledElement( elementPtr = ((StyleEngine *) engine)->elements+elementId; - specPtr = ckalloc(sizeof(Tk_ElementSpec)); + specPtr = (Tk_ElementSpec *)ckalloc(sizeof(Tk_ElementSpec)); specPtr->version = templatePtr->version; - specPtr->name = ckalloc(strlen(templatePtr->name)+1); + specPtr->name = (char *)ckalloc(strlen(templatePtr->name)+1); strcpy(specPtr->name, templatePtr->name); nbOptions = 0; for (nbOptions = 0, srcOptions = templatePtr->options; srcOptions->name != NULL; nbOptions++, srcOptions++) { /* empty body */ } - specPtr->options = + specPtr->options = (Tk_ElementOptionSpec *) ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1)); for (srcOptions = templatePtr->options, dstOptions = specPtr->options; /* End condition within loop */; srcOptions++, dstOptions++) { @@ -804,7 +804,7 @@ Tk_RegisterStyledElement( break; } - dstOptions->name = ckalloc(strlen(srcOptions->name)+1); + dstOptions->name = (char *)ckalloc(strlen(srcOptions->name)+1); strcpy(dstOptions->name, srcOptions->name); dstOptions->type = srcOptions->type; } @@ -844,7 +844,7 @@ GetStyledElement( int elementId) /* Unique element ID */ { StyledElement *elementPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); StyleEngine *enginePtr2; @@ -924,7 +924,7 @@ InitWidgetSpec( */ widgetSpecPtr->optionsPtr = - ckalloc(sizeof(Tk_OptionSpec *) * nbOptions); + (const Tk_OptionSpec **)ckalloc(sizeof(Tk_OptionSpec *) * nbOptions); for (i = 0, elementOptionPtr = elementPtr->specPtr->options; i < nbOptions; i++, elementOptionPtr++) { widgetOptionPtr = TkGetOptionSpec(elementOptionPtr->name, optionTable); @@ -1008,7 +1008,7 @@ GetWidgetSpec( */ i = elementPtr->nbWidgetSpecs++; - elementPtr->widgetSpecs = ckrealloc(elementPtr->widgetSpecs, + elementPtr->widgetSpecs = (StyledWidgetSpec *)ckrealloc(elementPtr->widgetSpecs, sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs); widgetSpecPtr = elementPtr->widgetSpecs+i; InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable); @@ -1229,7 +1229,7 @@ Tk_CreateStyle( Tk_StyleEngine engine, /* The style engine. */ ClientData clientData) /* Private data passed as is to engine code. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; int newEntry; @@ -1253,8 +1253,8 @@ Tk_CreateStyle( * Allocate and intitialize a new style. */ - stylePtr = ckalloc(sizeof(Style)); - InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), + stylePtr = (Style *)ckalloc(sizeof(Style)); + InitStyle(stylePtr, (const char *)Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr), (engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr), clientData); Tcl_SetHashValue(entryPtr, stylePtr); @@ -1344,10 +1344,9 @@ Tk_GetStyle( const char *name) /* Name of the style to retrieve. NULL or empty * means the default system style. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashEntry *entryPtr; - Style *stylePtr; /* * Search for a corresponding entry in the style table. @@ -1362,9 +1361,7 @@ Tk_GetStyle( } return NULL; } - stylePtr = Tcl_GetHashValue(entryPtr); - - return (Tk_Style) stylePtr; + return (Tk_Style)Tcl_GetHashValue(entryPtr); } /* @@ -1379,7 +1376,7 @@ Tk_GetStyle( void Tk_FreeStyle( - Tk_Style style) + TCL_UNUSED(Tk_Style)) { } @@ -1456,7 +1453,7 @@ Tk_GetStyleFromObj( */ void Tk_FreeStyleFromObj( - Tcl_Obj *objPtr) + TCL_UNUSED(Tcl_Obj *)) { } -- cgit v0.12