diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-10 12:24:16 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-03-10 12:24:16 (GMT) |
commit | 2201d7a19b192714ac6f19507b8a140ecf59bbfe (patch) | |
tree | 197bc511c769212f60eb70b52bbe991b2bba74e3 | |
parent | da8764ce8dc25d831e182604c8f148247406cabd (diff) | |
parent | d6709afd3e1e09c065cf4e39d196eadf839ce4c4 (diff) | |
download | tk-2201d7a19b192714ac6f19507b8a140ecf59bbfe.zip tk-2201d7a19b192714ac6f19507b8a140ecf59bbfe.tar.gz tk-2201d7a19b192714ac6f19507b8a140ecf59bbfe.tar.bz2 |
Merge 8.7.
Also remove all traces of HAVE_XKBKEYCODETOKEYSYM (assumed to be 1) and XKEYCODETOKEYSYM_IS_DEPRECATED (not applicable any more)
219 files changed, 4630 insertions, 2952 deletions
diff --git a/.travis.yml b/.travis.yml index 5f01fb0..acdd25a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,13 @@ matrix: env: - CFGOPT="--disable-shared" - BUILD_DIR=unix + - name: "Linux/G++/Shared" + os: linux + dist: bionic + compiler: g++ + env: + - BUILD_DIR=unix + - CFGOPT="CC=g++ CFLAGS=-Dregister=dont+use+register" - name: "Linux/GCC 7/Shared" os: linux dist: bionic @@ -517,10 +517,11 @@ coordinates of the window relative to its parent window. .IP \fB%A\fR 5 Substitutes the UNICODE character corresponding to the event, or the empty string if the event does not correspond to a UNICODE character -(e.g. the shift key was pressed). \fBXmbLookupString\fR (or +(e.g. the shift key was pressed). On X11, \fBXmbLookupString\fR (or \fBXLookupString\fR when input method support is turned off) does all the work of translating from the event to a UNICODE character. -Valid only for \fBKey\fR and \fBKeyRelease\fR events. +On X11, valid only for \fBKey\fR event. On Windows and macOS/aqua, +valid only for \fBKey\fR and \fBKeyRelease\fR events. .IP \fB%B\fR 5 The \fIborder_width\fR field from the event. Valid only for \fBConfigure\fR, \fBConfigureRequest\fR, and \fBCreate\fR events. diff --git a/generic/nanosvg.h b/generic/nanosvg.h index 5377ae0..7bb13d2 100755 --- a/generic/nanosvg.h +++ b/generic/nanosvg.h @@ -662,7 +662,7 @@ static void nsvg__curveBounds(float* bounds, float* curve) } } -static NSVGparser* nsvg__createParser() +static NSVGparser* nsvg__createParser(void) { NSVGparser* p; p = (NSVGparser*)NANOSVG_malloc(sizeof(NSVGparser)); diff --git a/generic/nanosvgrast.h b/generic/nanosvgrast.h index 37636fe..2720ce5 100644 --- a/generic/nanosvgrast.h +++ b/generic/nanosvgrast.h @@ -60,7 +60,7 @@ typedef struct NSVGrasterizer NSVGrasterizer; */ // Allocated rasterizer context. -NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(); +NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void); // Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) // r - pointer to rasterizer context @@ -160,7 +160,7 @@ struct NSVGrasterizer }; NANOSVG_SCOPE -NSVGrasterizer* nsvgCreateRasterizer() +NSVGrasterizer* nsvgCreateRasterizer(void) { NSVGrasterizer* r = (NSVGrasterizer*)NANOSVG_malloc(sizeof(NSVGrasterizer)); if (r == NULL) goto error; diff --git a/generic/tk.h b/generic/tk.h index 0ab2a96..09fab52 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -86,6 +86,9 @@ extern "C" { #ifndef RC_INVOKED #if !defined(_XLIB_H) && !defined(_X11_XLIB_H_) +#if defined(__GNUC__) && !defined(__cplusplus) +# pragma GCC diagnostic ignored "-Wc++-compat" +#endif # include <X11/Xlib.h> # ifdef MAC_OSX_TK # include <X11/X.h> diff --git a/generic/tk3d.c b/generic/tk3d.c index 9ed419a..155f6ae 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/tkArgv.c b/generic/tkArgv.c index ca5ecc0..81e7a44 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -67,12 +67,12 @@ Tk_ParseArgv( int flags) /* Or'ed combination of various flag bits, * such as TK_ARGV_NO_DEFAULTS. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; /* Pointer to the current entry in the table * of argument descriptions. */ const Tk_ArgvInfo *matchPtr;/* Descriptor that matches current argument. */ const char *curArg; /* Current argument */ - register char c; /* Second character of current arg (used for + char c; /* Second character of current arg (used for * quick check for matching; use 2nd char. * because first char. will almost always be * '-'). */ @@ -228,9 +228,9 @@ Tk_ParseArgv( break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); - ArgvFunc *handlerProc = infoPtr->src; + ArgvFunc *handlerProc = (ArgvFunc *)infoPtr->src; - if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) { + if (handlerProc((char *)infoPtr->dst, infoPtr->key, argv[srcIndex])) { srcIndex++; argc--; } @@ -239,9 +239,9 @@ Tk_ParseArgv( case TK_ARGV_GENFUNC: { typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int, const char **); - ArgvGenFunc *handlerProc = infoPtr->src; + ArgvGenFunc *handlerProc = (ArgvGenFunc *)infoPtr->src; - argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc, + argc = handlerProc((char *)infoPtr->dst, interp, infoPtr->key, argc, argv+srcIndex); if (argc < 0) { return TCL_ERROR; @@ -253,14 +253,14 @@ Tk_ParseArgv( Tcl_SetErrorCode(interp, "TK", "ARG", "HELP", NULL); return TCL_ERROR; case TK_ARGV_CONST_OPTION: - Tk_AddOption(tkwin, infoPtr->dst, infoPtr->src, + Tk_AddOption(tkwin, (char *)infoPtr->dst, (char *)infoPtr->src, TK_INTERACTIVE_PRIO); break; case TK_ARGV_OPTION_VALUE: if (argc < 1) { goto missingArg; } - Tk_AddOption(tkwin, infoPtr->dst, argv[srcIndex], + Tk_AddOption(tkwin, (char *)infoPtr->dst, argv[srcIndex], TK_INTERACTIVE_PRIO); srcIndex++; argc--; @@ -338,7 +338,7 @@ PrintUsage( * this word, then don't generate information * for default options. */ { - register const Tk_ArgvInfo *infoPtr; + const Tk_ArgvInfo *infoPtr; size_t width, i, numSpaces; Tcl_Obj *message; diff --git a/generic/tkArray.h b/generic/tkArray.h index 65693fe..81f3198 100644 --- a/generic/tkArray.h +++ b/generic/tkArray.h @@ -188,7 +188,7 @@ AT##_Init(AT *arr) \ \ __TK_ARRAY_UNUSED \ static size_t \ -AT##_ElemSize() \ +AT##_ElemSize(void) \ { \ return sizeof(ElemType); \ } \ @@ -273,7 +273,7 @@ AT##_Resize(AT **arrp, size_t newSize) \ } else { \ int init = *arrp == NULL; \ size_t memSize = AT##_BufferSize(newSize - 1) + sizeof(AT); \ - *arrp = ckrealloc(*arrp, memSize); \ + *arrp = (AT *)ckrealloc(*arrp, memSize); \ if (init) { \ (*arrp)->size = 0; \ } else if (newSize < (*arrp)->size) { \ @@ -399,7 +399,7 @@ typedef struct AT { \ \ __TK_ARRAY_UNUSED \ static size_t \ -AT##_ElemSize() \ +AT##_ElemSize(void) \ { \ return sizeof(ElemType); \ } \ @@ -484,7 +484,7 @@ AT##_Resize(AT **arrp, size_t newCapacity) \ } else { \ int init = *arrp == NULL; \ size_t memSize = AT##_BufferSize(newCapacity - 1) + sizeof(AT); \ - *arrp = ckrealloc(*arrp, memSize); \ + *arrp = (AT *)ckrealloc(*arrp, memSize); \ if (init) { \ (*arrp)->size = 0; \ } else if (newCapacity < (*arrp)->size) { \ diff --git a/generic/tkAtom.c b/generic/tkAtom.c index ddfa97f..a4e1e11 100644 --- a/generic/tkAtom.c +++ b/generic/tkAtom.c @@ -154,11 +154,11 @@ Tk_GetAtomName( if (mustFree) { XFree(mustFree); } - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } - return Tcl_GetHashValue(hPtr); + return (const char *)Tcl_GetHashValue(hPtr); } /* @@ -200,7 +200,7 @@ AtomInit( name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); - name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); + name = (const char *)Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } diff --git a/generic/tkBind.c b/generic/tkBind.c index 46c1e78..4970dc8 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -792,7 +792,7 @@ GetButtonNumber( } static Time -CurrentTimeInMilliSecs() +CurrentTimeInMilliSecs(void) { Tcl_Time now; Tcl_GetTime(&now); @@ -934,6 +934,8 @@ FreePatSeqEntry( PSEntry *entry) { PSEntry *next = PSList_Next(entry); + (void)pool; + PSModMaskArr_Free(&entry->lastModMaskArr); ckfree(entry); return next; @@ -1035,7 +1037,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 { @@ -1112,7 +1114,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; } /* @@ -1150,13 +1152,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;) @@ -1371,7 +1373,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; @@ -1447,7 +1449,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); @@ -1506,7 +1508,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); @@ -1573,12 +1575,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); @@ -1666,7 +1668,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); } @@ -1676,14 +1678,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); @@ -1738,7 +1740,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 { @@ -1839,7 +1841,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)); } @@ -1878,7 +1880,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) { @@ -1962,7 +1964,7 @@ DeletePatSeq( assert(!psPtr->added); assert(!psPtr->owned); - prevPtr = Tcl_GetHashValue(psPtr->hPtr); + prevPtr = (PatSeq *)Tcl_GetHashValue(psPtr->hPtr); nextPtr = psPtr->ptr.nextObj; /* @@ -2033,7 +2035,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); @@ -2358,7 +2360,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])); @@ -2399,8 +2401,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]); @@ -3442,7 +3444,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;) @@ -3524,7 +3526,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); @@ -3586,7 +3588,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) { @@ -3718,7 +3720,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))); } @@ -3807,7 +3809,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; @@ -3910,7 +3912,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)) { @@ -4350,7 +4352,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); } @@ -4480,7 +4482,7 @@ static void DoWarp( ClientData clientData) { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; assert(clientData); @@ -4610,7 +4612,7 @@ FindSequence( assert(lookupTables); assert(eventString); - psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize)); + psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize)); /* *------------------------------------------------------------------ @@ -4622,7 +4624,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; } @@ -4671,18 +4673,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); @@ -4718,7 +4720,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); @@ -4860,7 +4862,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'; @@ -4892,7 +4894,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; @@ -4907,7 +4909,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]; @@ -5231,7 +5233,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/tkBitmap.c b/generic/tkBitmap.c index f642174..252fd4c 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -167,7 +167,7 @@ Tk_AllocBitmapFromObj( if (objPtr->typePtr != &tkBitmapObjType) { InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkBitmap, see if it's the one we @@ -197,7 +197,7 @@ Tk_AllocBitmapFromObj( */ if (bitmapPtr != NULL) { - TkBitmap *firstBitmapPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + TkBitmap *firstBitmapPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); FreeBitmapObj(objPtr); for (bitmapPtr = firstBitmapPtr; bitmapPtr != NULL; @@ -307,7 +307,7 @@ GetBitmap( Pixmap bitmap; int isNew, width = 0, height = 0, dummy2; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!dispPtr->bitmapInit) { @@ -317,7 +317,7 @@ GetBitmap( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapNameTable, string, &isNew); if (!isNew) { - existingBitmapPtr = Tcl_GetHashValue(nameHashPtr); + existingBitmapPtr = (TkBitmap *)Tcl_GetHashValue(nameHashPtr); for (bitmapPtr = existingBitmapPtr; bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if ((Tk_Display(tkwin) == bitmapPtr->display) && @@ -395,7 +395,7 @@ GetBitmap( goto error; } } else { - predefPtr = Tcl_GetHashValue(predefHashPtr); + predefPtr = (TkPredefBitmap *)Tcl_GetHashValue(predefHashPtr); width = predefPtr->width; height = predefPtr->height; if (predefPtr->native) { @@ -407,7 +407,7 @@ GetBitmap( } else { bitmap = XCreateBitmapFromData(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), - predefPtr->source, (unsigned)width, (unsigned)height); + (const char *)predefPtr->source, (unsigned)width, (unsigned)height); } } } @@ -416,7 +416,7 @@ GetBitmap( * Add information about this bitmap to our database. */ - bitmapPtr = ckalloc(sizeof(TkBitmap)); + bitmapPtr = (TkBitmap *)ckalloc(sizeof(TkBitmap)); bitmapPtr->bitmap = bitmap; bitmapPtr->width = width; bitmapPtr->height = height; @@ -474,7 +474,7 @@ Tk_DefineBitmap( int isNew; Tcl_HashEntry *predefHashPtr; TkPredefBitmap *predefPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -497,7 +497,7 @@ Tk_DefineBitmap( Tcl_SetErrorCode(interp, "TK", "BITMAP", "EXISTS", NULL); return TCL_ERROR; } - predefPtr = ckalloc(sizeof(TkPredefBitmap)); + predefPtr = (TkPredefBitmap *)ckalloc(sizeof(TkPredefBitmap)); predefPtr->source = source; predefPtr->width = width; predefPtr->height = height; @@ -540,7 +540,7 @@ Tk_NameOfBitmap( if (idHashPtr == NULL) { goto unknown; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); return bitmapPtr->nameHashPtr->key.string; } @@ -582,7 +582,7 @@ Tk_SizeOfBitmap( if (idHashPtr == NULL) { goto unknownBitmap; } - bitmapPtr = Tcl_GetHashValue(idHashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(idHashPtr); *widthPtr = bitmapPtr->width; *heightPtr = bitmapPtr->height; } @@ -612,14 +612,13 @@ FreeBitmap( { TkBitmap *prevPtr; - bitmapPtr->resourceRefCount--; - if (bitmapPtr->resourceRefCount > 0) { + if (bitmapPtr->resourceRefCount-- > 1) { return; } Tk_FreePixmap(bitmapPtr->display, bitmapPtr->bitmap); Tcl_DeleteHashEntry(bitmapPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(bitmapPtr->nameHashPtr); + prevPtr = (TkBitmap *)Tcl_GetHashValue(bitmapPtr->nameHashPtr); if (prevPtr == bitmapPtr) { if (bitmapPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(bitmapPtr->nameHashPtr); @@ -671,7 +670,7 @@ Tk_FreeBitmap( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } - FreeBitmap(Tcl_GetHashValue(idHashPtr)); + FreeBitmap((TkBitmap *)Tcl_GetHashValue(idHashPtr)); } /* @@ -735,7 +734,7 @@ static void FreeBitmapObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkBitmap *bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { bitmapPtr->objRefCount--; @@ -770,7 +769,7 @@ DupBitmapObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkBitmap *bitmapPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkBitmap *bitmapPtr = (TkBitmap *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -820,20 +819,20 @@ Tk_GetBitmapFromData( char string[16 + TCL_INTEGER_SPACE]; char *name; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { BitmapInit(dispPtr); } - nameKey.source = source; + nameKey.source = (const char *)source; nameKey.width = width; nameKey.height = height; dataHashPtr = Tcl_CreateHashEntry(&dispPtr->bitmapDataTable, (char *) &nameKey, &isNew); if (!isNew) { - name = Tcl_GetHashValue(dataHashPtr); + name = (char *)Tcl_GetHashValue(dataHashPtr); } else { dispPtr->bitmapAutoNumber++; sprintf(string, "_tk%d", dispPtr->bitmapAutoNumber); @@ -911,7 +910,7 @@ GetBitmapFromObj( InitBitmapObj(objPtr); } - bitmapPtr = objPtr->internalRep.twoPtrValue.ptr1; + bitmapPtr = (TkBitmap *)objPtr->internalRep.twoPtrValue.ptr1; if (bitmapPtr != NULL) { if ((bitmapPtr->resourceRefCount > 0) && (Tk_Display(tkwin) == bitmapPtr->display)) { @@ -932,7 +931,7 @@ GetBitmapFromObj( * more TkBitmap structures. See if any of them will work. */ - for (bitmapPtr = Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; + for (bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); bitmapPtr != NULL; bitmapPtr = bitmapPtr->nextPtr) { if (Tk_Display(tkwin) == bitmapPtr->display) { objPtr->internalRep.twoPtrValue.ptr1 = bitmapPtr; @@ -1012,7 +1011,7 @@ BitmapInit( * or NULL if unavailable. */ { Tcl_Interp *dummy; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1150,7 +1149,7 @@ TkDebugBitmap( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->bitmapNameTable, name); if (hashPtr != NULL) { - bitmapPtr = Tcl_GetHashValue(hashPtr); + bitmapPtr = (TkBitmap *)Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } @@ -1190,7 +1189,7 @@ TkDebugBitmap( Tcl_HashTable * TkGetBitmapPredefTable(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return &tsdPtr->predefBitmapTable; diff --git a/generic/tkBusy.c b/generic/tkBusy.c index fa526a3..d1f2696 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); @@ -128,7 +128,8 @@ BusyCustodyProc( ClientData clientData, /* Information about the busy window. */ Tk_Window tkwin) /* Not used. */ { - Busy *busyPtr = clientData; + Busy *busyPtr = (Busy *)clientData; + (void)tkwin; Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc, busyPtr); @@ -159,11 +160,14 @@ BusyCustodyProc( /* ARGSUSED */ static void BusyGeometryProc( - ClientData clientData, /* Information about window that got new + ClientData dummy, /* Information about window that got new * preferred geometry. */ Tk_Window tkwin) /* Other Tk-related information about the * window. */ { + (void)dummy; + (void)tkwin; + /* Should never get here */ } @@ -249,9 +253,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 +337,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 +381,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 +531,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 +700,7 @@ GetBusy( Tcl_GetString(windowObj), NULL); return NULL; } - return Tcl_GetHashValue(hPtr); + return (Busy *)Tcl_GetHashValue(hPtr); } /* @@ -746,7 +750,7 @@ HoldBusy( Tcl_SetHashValue(hPtr, busyPtr); busyPtr->hashPtr = hPtr; } else { - busyPtr = Tcl_GetHashValue(hPtr); + busyPtr = (Busy *)Tcl_GetHashValue(hPtr); } busyPtr->tablePtr = busyTablePtr; @@ -792,7 +796,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; @@ -894,7 +898,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/tkButton.c b/generic/tkButton.c index c43fe9b..b9049a7 100644 --- a/generic/tkButton.c +++ b/generic/tkButton.c @@ -628,7 +628,7 @@ Tk_RadiobuttonObjCmd( static int ButtonCreate( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument values. */ @@ -639,8 +639,9 @@ ButtonCreate( TkButton *butPtr; Tk_OptionTable optionTable; Tk_Window tkwin; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (!tsdPtr->defaultsInitialized) { TkpButtonSetDefaults(); @@ -788,7 +789,7 @@ ButtonWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; int index; int result; Tcl_Obj *objPtr; @@ -1036,7 +1037,7 @@ DestroyButton( static int ConfigureButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkButton *butPtr, /* Information about widget; may or may + TkButton *butPtr, /* Information about widget; may or may * not already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -1348,7 +1349,7 @@ TkButtonWorldChanged( XGCValues gcValues; GC newGC; unsigned long mask; - TkButton *butPtr = instanceData; + TkButton *butPtr = (TkButton *)instanceData; /* * Recompute GCs. @@ -1459,7 +1460,7 @@ ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; } else if (eventPtr->type == ConfigureNotify) { @@ -1517,7 +1518,7 @@ static void ButtonCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1612,9 +1613,11 @@ ButtonVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; const char *value; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; /* * If the variable is being unset, then just re-establish the trace unless @@ -1722,8 +1725,10 @@ ButtonTextVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; if (butPtr->flags & BUTTON_DELETED) { return NULL; @@ -1817,7 +1822,13 @@ ButtonImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if (butPtr->tkwin != NULL) { TkpComputeButtonGeometry(butPtr); @@ -1855,7 +1866,13 @@ ButtonSelectImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { @@ -1902,7 +1919,13 @@ ButtonTristateImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; #ifdef MAC_OSX_TK if (butPtr->tkwin != NULL) { diff --git a/generic/tkButton.h b/generic/tkButton.h index 7e04fb9..edf7efe 100644 --- a/generic/tkButton.h +++ b/generic/tkButton.h @@ -306,7 +306,7 @@ MODULE_SCOPE char tkDefLabelPady[TCL_INTEGER_SPACE]; */ #ifndef TkpButtonSetDefaults -MODULE_SCOPE void TkpButtonSetDefaults(); +MODULE_SCOPE void TkpButtonSetDefaults(void); #endif MODULE_SCOPE void TkButtonWorldChanged(ClientData instanceData); MODULE_SCOPE void TkpComputeButtonGeometry(TkButton *butPtr); diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index b41dc64..d6ba762 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -712,6 +712,7 @@ DeleteArc( Display *display) /* Display containing window for canvas. */ { ArcItem *arcPtr = (ArcItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &(arcPtr->outline)); if (arcPtr->numOutlinePoints != 0) { @@ -909,6 +910,10 @@ DisplayArc( double lineWidth; Tk_State state = itemPtr->state; Pixmap stipple; + (void)x; + (void)y; + (void)width; + (void)height; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -1632,7 +1637,7 @@ ComputeArcOutline( */ if (arcPtr->numOutlinePoints == 0) { - arcPtr->outlinePtr = ckalloc(26 * sizeof(double)); + arcPtr->outlinePtr = (double *)ckalloc(26 * sizeof(double)); arcPtr->numOutlinePoints = 22; } outlinePtr = arcPtr->outlinePtr; @@ -2012,6 +2017,7 @@ ArcToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]); y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]); @@ -2213,7 +2219,7 @@ ArcToPostscript( static int StyleParseProc( - ClientData clientData, /* some flags.*/ + ClientData dummy, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ @@ -2222,8 +2228,9 @@ StyleParseProc( { int c; size_t length; - - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *stylePtr = PIESLICE_STYLE; @@ -2277,7 +2284,7 @@ StyleParseProc( static const char * StylePrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Ignored. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -2285,7 +2292,10 @@ StylePrintProc( * information about how to reclaim storage * for return string. */ { - register Style *stylePtr = (Style *) (widgRec + offset); + Style *stylePtr = (Style *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; if (*stylePtr == ARC_STYLE) { return "arc"; diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index e7b19ae..b9ef3bd 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -422,6 +422,7 @@ DeleteBitmap( Display *display) /* Display containing window for canvas. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; + (void)canvas; if (bmapPtr->bitmap != None) { Tk_FreeBitmap(display, bmapPtr->bitmap); @@ -680,6 +681,7 @@ BitmapToPoint( { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = bmapPtr->header.x1; y1 = bmapPtr->header.y1; @@ -738,6 +740,7 @@ BitmapToArea( * area. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= bmapPtr->header.x1) || (rectPtr[0] >= bmapPtr->header.x2) @@ -893,6 +896,7 @@ BitmapToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; diff --git a/generic/tkCanvImg.c b/generic/tkCanvImg.c index 19e1c70..13bf618 100644 --- a/generic/tkCanvImg.c +++ b/generic/tkCanvImg.c @@ -385,6 +385,8 @@ DeleteImage( Display *display) /* Display containing window for canvas. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; + (void)canvas; + (void)display; if (imgPtr->imageString != NULL) { ckfree(imgPtr->imageString); @@ -537,6 +539,7 @@ DisplayImage( short drawableX, drawableY; Tk_Image image; Tk_State state = itemPtr->state; + (void)display; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -595,6 +598,7 @@ ImageToPoint( { ImageItem *imgPtr = (ImageItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = imgPtr->header.x1; y1 = imgPtr->header.y1; @@ -652,6 +656,7 @@ ImageToArea( * area. */ { ImageItem *imgPtr = (ImageItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= imgPtr->header.x1) || (rectPtr[0] >= imgPtr->header.x2) @@ -888,7 +893,7 @@ ImageChangedProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - ImageItem *imgPtr = clientData; + ImageItem *imgPtr = (ImageItem *)clientData; /* * If the image's size changed and it's not anchored at its northwest diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index a59f675..022d85e 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -409,7 +409,7 @@ LineCoords( numPoints = objc/2; if (linePtr->numPoints != numPoints) { - coordPtr = ckalloc(sizeof(double) * objc); + coordPtr = (double *)ckalloc(sizeof(double) * objc); if (linePtr->coordPtr != NULL) { ckfree(linePtr->coordPtr); } @@ -610,6 +610,7 @@ DeleteLine( Display *display) /* Display containing window for canvas. */ { LineItem *linePtr = (LineItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &linePtr->outline); if (linePtr->coordPtr != NULL) { @@ -843,6 +844,10 @@ DisplayLine( double linewidth; int numPoints; Tk_State state = itemPtr->state; + (void)x; + (void)y; + (void)width; + (void)height; if (!linePtr->numPoints || (linePtr->outline.gc == NULL)) { return; @@ -878,7 +883,7 @@ DisplayLine( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * 3 * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * 3 * sizeof(XPoint)); } if ((linePtr->smooth) && (linePtr->numPoints > 2)) { @@ -987,7 +992,7 @@ LineInsert( linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0]; linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1]; } - newCoordPtr = ckalloc(sizeof(double) * (length + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + objc)); for (i=0; i<beforeThis; i++) { newCoordPtr[i] = linePtr->coordPtr[i]; } @@ -1368,7 +1373,7 @@ LineToPoint( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1603,7 +1608,7 @@ LineToArea( if (numPoints <= MAX_STATIC_POINTS) { linePoints = staticSpace; } else { - linePoints = ckalloc(2 * numPoints * sizeof(double)); + linePoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, linePoints); @@ -1748,6 +1753,7 @@ GetLineIndex( { LineItem *linePtr = (LineItem *) itemPtr; const char *string = Tcl_GetString(obj); + (void)canvas; if (string[0] == 'e') { if (strncmp(string, "end", obj->length) == 0) { @@ -1928,7 +1934,7 @@ RotateLine( /* ARGSUSED */ static int ParseArrowShape( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tcl_Interp *interp, /* Used for error reporting. */ Tk_Window tkwin, /* Not used. */ const char *value, /* Textual specification of arrow shape. */ @@ -1941,6 +1947,8 @@ ParseArrowShape( double a, b, c; int argc; const char **argv = NULL; + (void)dummy; + (void)tkwin; if ((size_t)offset != offsetof(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); @@ -1997,7 +2005,7 @@ ParseArrowShape( /* ARGSUSED */ static const char * PrintArrowShape( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ Tk_Window tkwin, /* Window associated with linePtr's widget. */ char *recordPtr, /* Pointer to item record containing current * shape information. */ @@ -2006,7 +2014,10 @@ PrintArrowShape( * string here. */ { LineItem *linePtr = (LineItem *) recordPtr; - char *buffer = ckalloc(120); + char *buffer = (char *)ckalloc(120); + (void)dummy; + (void)tkwin; + (void)offset; sprintf(buffer, "%.5g %.5g %.5g", linePtr->arrowShapeA, linePtr->arrowShapeB, linePtr->arrowShapeC); @@ -2034,7 +2045,7 @@ PrintArrowShape( static int ArrowParseProc( - ClientData clientData, /* some flags.*/ + ClientData dummy, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ @@ -2043,8 +2054,9 @@ ArrowParseProc( { int c; size_t length; - - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *arrowPtr = ARROWS_NONE; @@ -2102,7 +2114,7 @@ ArrowParseProc( static const char * ArrowPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -2110,7 +2122,10 @@ ArrowPrintProc( * information about how to reclaim storage * for return string. */ { - register Arrows *arrowPtr = (Arrows *) (widgRec + offset); + Arrows *arrowPtr = (Arrows *) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; switch (*arrowPtr) { case ARROWS_FIRST: @@ -2205,7 +2220,7 @@ ConfigureArrows( if (linePtr->arrow != ARROWS_LAST) { poly = linePtr->firstArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = linePtr->coordPtr[0]; poly[1] = poly[11] = linePtr->coordPtr[1]; linePtr->firstArrowPtr = poly; @@ -2249,7 +2264,7 @@ ConfigureArrows( coordPtr = linePtr->coordPtr + 2*(linePtr->numPoints-2); poly = linePtr->lastArrowPtr; if (poly == NULL) { - poly = ckalloc(2 * PTS_IN_ARROW * sizeof(double)); + poly = (double *)ckalloc(2 * PTS_IN_ARROW * sizeof(double)); poly[0] = poly[10] = coordPtr[2]; poly[1] = poly[11] = coordPtr[3]; linePtr->lastArrowPtr = poly; @@ -2318,6 +2333,7 @@ LineToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -2418,7 +2434,7 @@ LineToPostscript( linePtr->numPoints, linePtr->splineSteps, NULL, NULL); pointPtr = staticPoints; if (numPoints > MAX_STATIC_POINTS) { - pointPtr = ckalloc(numPoints * 2 * sizeof(double)); + pointPtr = (double *)ckalloc(numPoints * 2 * sizeof(double)); } numPoints = linePtr->smooth->coordProc(canvas, linePtr->coordPtr, linePtr->numPoints, linePtr->splineSteps, NULL, pointPtr); diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index eeba814..5b5769a 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -378,7 +378,7 @@ PolygonCoords( * another point to close the polygon. */ - polyPtr->coordPtr = ckalloc(sizeof(double) * (objc+2)); + polyPtr->coordPtr = (double *)ckalloc(sizeof(double) * (objc+2)); polyPtr->pointsAllocated = numPoints+1; } for (i = objc-1; i >= 0; i--) { @@ -571,6 +571,7 @@ DeletePolygon( Display *display) /* Display containing window for canvas. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &polyPtr->outline); if (polyPtr->coordPtr != NULL) { @@ -827,7 +828,7 @@ TkFillPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } for (i=0, pPtr=pointPtr ; i<numPoints; i+=1, coordPtr+=2, pPtr++) { @@ -884,6 +885,10 @@ DisplayPolygon( Tk_State state = itemPtr->state; Pixmap stipple = polyPtr->fillStipple; double linewidth = polyPtr->outline.width; + (void)x; + (void)y; + (void)width; + (void)height; if (((polyPtr->fillGC == NULL) && (polyPtr->outline.gc == NULL)) || (polyPtr->numPoints < 1) || @@ -973,7 +978,7 @@ DisplayPolygon( if (numPoints <= MAX_STATIC_POINTS) { pointPtr = staticPoints; } else { - pointPtr = ckalloc(numPoints * sizeof(XPoint)); + pointPtr = (XPoint *)ckalloc(numPoints * sizeof(XPoint)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, pointPtr, NULL); @@ -1040,7 +1045,7 @@ PolygonInsert( while (beforeThis < 0) { beforeThis += length; } - newCoordPtr = ckalloc(sizeof(double) * (length + 2 + objc)); + newCoordPtr = (double *)ckalloc(sizeof(double) * (length + 2 + objc)); for (i=0; i<beforeThis; i++) { newCoordPtr[i] = polyPtr->coordPtr[i]; } @@ -1290,7 +1295,7 @@ PolygonToPoint( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1499,7 +1504,7 @@ PolygonToArea( if (numPoints <= MAX_STATIC_POINTS) { polyPoints = staticSpace; } else { - polyPoints = ckalloc(2 * numPoints * sizeof(double)); + polyPoints = (double *)ckalloc(2 * numPoints * sizeof(double)); } numPoints = polyPtr->smooth->coordProc(canvas, polyPtr->coordPtr, polyPtr->numPoints, polyPtr->splineSteps, NULL, polyPoints); @@ -1678,6 +1683,7 @@ GetPolygonIndex( { PolygonItem *polyPtr = (PolygonItem *) itemPtr; const char *string = Tcl_GetString(obj); + (void)canvas; if (string[0] == 'e') { if (strncmp(string, "end", obj->length) != 0) { @@ -1851,6 +1857,7 @@ PolygonToPostscript( double width; Tcl_Obj *psObj; Tcl_InterpState interpState; + (void)prepass; if (polyPtr->numPoints < 2 || polyPtr->coordPtr == NULL) { return TCL_OK; diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index 2598d4e..386ada9 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -1194,6 +1194,8 @@ TkImageGetColor( double *red, double *green, double *blue) /* Color data to return */ { + (void)cdata; + *red = (double) GetRValue(pixel) / 255.0; *green = (double) GetGValue(pixel) / 255.0; *blue = (double) GetBValue(pixel) / 255.0; @@ -1262,6 +1264,7 @@ TkPostscriptImage( Visual *visual; TkColormapData cdata; Tcl_Obj *psObj; + (void)y; if (psInfoPtr->prepass) { return TCL_OK; @@ -1276,7 +1279,7 @@ TkPostscriptImage( */ ncolors = visual->map_entries; - cdata.colors = ckalloc(sizeof(XColor) * ncolors); + cdata.colors = (XColor *)ckalloc(sizeof(XColor) * ncolors); cdata.ncolors = ncolors; if (visual->c_class == DirectColor || visual->c_class == TrueColor) { diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index 3ca09a0..f260f8a 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -570,6 +570,7 @@ DeleteText( Display *display) /* Display containing window for canvas. */ { TextItem *textPtr = (TextItem *) itemPtr; + (void)canvas; if (textPtr->color != NULL) { Tk_FreeColor(textPtr->color); @@ -1031,7 +1032,7 @@ TextInsert( return; } - newStr = ckalloc(textPtr->numBytes + byteCount + 1); + newStr = (char *)ckalloc(textPtr->numBytes + byteCount + 1); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); @@ -1112,7 +1113,7 @@ TextDeleteChars( byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); - newStr = ckalloc(textPtr->numBytes + 1 - byteCount); + newStr = (char *)ckalloc(textPtr->numBytes + 1 - byteCount); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); @@ -1384,6 +1385,7 @@ GetTextIndex( int c; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; const char *string = TkGetStringFromObj(obj, &length); + (void)canvas; c = string[0]; @@ -1478,6 +1480,7 @@ SetTextCursor( * which cursor is to be positioned. */ { TextItem *textPtr = (TextItem *) itemPtr; + (void)canvas; if (index < 0) { textPtr->insertPos = 0; @@ -1524,6 +1527,7 @@ GetSelText( char *text; const char *selStart, *selEnd; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; + (void)canvas; if ((textInfoPtr->selectFirst < 0) || (textInfoPtr->selectFirst > textInfoPtr->selectLast)) { diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index 2c6d480..e42d9da 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -28,15 +28,16 @@ const Tk_SmoothMethod tkBezierSmoothMethod = { "true", TkMakeBezierCurve, (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, - int numPoints, int numSteps)) TkMakeBezierPostscript, + int numPoints, int numSteps))(void *)TkMakeBezierPostscript, }; static const Tk_SmoothMethod tkRawSmoothMethod = { "raw", TkMakeRawCurve, (void (*) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, - int numPoints, int numSteps)) TkMakeRawCurvePostscript, + int numPoints, int numSteps))(void *)TkMakeRawCurvePostscript, }; + /* * Function forward-declarations. */ @@ -230,12 +231,14 @@ Tk_CanvasWindowCoords( int Tk_CanvasGetCoord( - Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tcl_Interp *dummy, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ const char *string, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { + (void)dummy; + if (Tk_GetScreenMM(Canvas(canvas)->interp, Canvas(canvas)->tkwin, string, doublePtr) != TCL_OK) { return TCL_ERROR; @@ -266,12 +269,14 @@ Tk_CanvasGetCoord( int Tk_CanvasGetCoordFromObj( - Tcl_Interp *interp, /* Interpreter for error reporting. */ + Tcl_Interp *dummy, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Canvas to which coordinate applies. */ Tcl_Obj *obj, /* Describes coordinate (any screen coordinate * form may be used here). */ double *doublePtr) /* Place to store converted coordinate. */ { + (void)dummy; + return Tk_GetDoublePixelsFromObj(Canvas(canvas)->interp, Canvas(canvas)->tkwin, obj, doublePtr); } @@ -331,7 +336,7 @@ Tk_CanvasSetOffset( * redisplaying the canvas. */ Tk_TSOffset *offset) /* Offset (may be NULL pointer)*/ { - register TkCanvas *canvasPtr = Canvas(canvas); + TkCanvas *canvasPtr = Canvas(canvas); int flags = 0; int x = - canvasPtr->drawableXOrigin; int y = - canvasPtr->drawableYOrigin; @@ -398,17 +403,20 @@ Tk_CanvasGetTextInfo( int Tk_CanvasTagsParseProc( - ClientData clientData, /* Not used.*/ + ClientData dummy, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option (list of tag names). */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item (ignored). */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; int argc, i; const char **argv; Tk_Uid *newPtr; + (void)dummy; + (void)tkwin; + (void)offset; /* * Break the value up into the individual tag names. @@ -423,7 +431,7 @@ Tk_CanvasTagsParseProc( */ if (itemPtr->tagSpace < argc) { - newPtr = ckalloc(argc * sizeof(Tk_Uid)); + newPtr = (Tk_Uid *)ckalloc(argc * sizeof(Tk_Uid)); for (i = itemPtr->numTags-1; i >= 0; i--) { newPtr[i] = itemPtr->tagPtr[i]; } @@ -465,7 +473,7 @@ Tk_CanvasTagsParseProc( const char * Tk_CanvasTagsPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Ignored. */ @@ -473,7 +481,10 @@ Tk_CanvasTagsPrintProc( * information about how to reclaim storage * for return string. */ { - register Tk_Item *itemPtr = (Tk_Item *) widgRec; + Tk_Item *itemPtr = (Tk_Item *) widgRec; + (void)dummy; + (void)tkwin; + (void)offset; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; @@ -507,13 +518,16 @@ Tk_CanvasTagsPrintProc( int TkCanvasDashParseProc( - ClientData clientData, /* Not used.*/ + ClientData dummy, /* Not used.*/ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { + (void)dummy; + (void)tkwin; + return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } @@ -541,7 +555,7 @@ TkCanvasDashParseProc( const char * TkCanvasDashPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset in record for item. */ @@ -552,11 +566,13 @@ TkCanvasDashPrintProc( Tk_Dash *dash = (Tk_Dash *) (widgRec+offset); char *buffer, *p; int i = dash->number; + (void)dummy; + (void)tkwin; if (i < 0) { i = -i; *freeProcPtr = TCL_DYNAMIC; - buffer = ckalloc(i + 1); + buffer = (char *)ckalloc(i + 1); p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; memcpy(buffer, p, (unsigned int) i); buffer[i] = 0; @@ -565,7 +581,7 @@ TkCanvasDashPrintProc( *freeProcPtr = NULL; return ""; } - buffer = ckalloc(4 * i); + buffer = (char *)ckalloc(4 * i); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; @@ -601,12 +617,12 @@ InitSmoothMethods( { SmoothAssocData *methods, *ptr; - methods = ckalloc(sizeof(SmoothAssocData)); + methods = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); methods->smooth.name = tkRawSmoothMethod.name; methods->smooth.coordProc = tkRawSmoothMethod.coordProc; methods->smooth.postscriptProc = tkRawSmoothMethod.postscriptProc; - ptr = methods->nextPtr = ckalloc(sizeof(SmoothAssocData)); + ptr = methods->nextPtr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); ptr->smooth.name = tkBezierSmoothMethod.name; ptr->smooth.coordProc = tkBezierSmoothMethod.coordProc; ptr->smooth.postscriptProc = tkBezierSmoothMethod.postscriptProc; @@ -640,7 +656,7 @@ Tk_CreateSmoothMethod( const Tk_SmoothMethod *smooth) { SmoothAssocData *methods, *typePtr2, *prevPtr, *ptr; - methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); + methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Initialize if we were not previously initialized. @@ -666,7 +682,7 @@ Tk_CreateSmoothMethod( break; } } - ptr = ckalloc(sizeof(SmoothAssocData)); + ptr = (SmoothAssocData *)ckalloc(sizeof(SmoothAssocData)); ptr->smooth.name = smooth->name; ptr->smooth.coordProc = smooth->coordProc; ptr->smooth.postscriptProc = smooth->postscriptProc; @@ -695,9 +711,10 @@ static void SmoothMethodCleanupProc( ClientData clientData, /* Points to "smoothMethod" AssocData for the * interpreter. */ - Tcl_Interp *interp) /* Interpreter that is being deleted. */ + Tcl_Interp *dummy) /* Interpreter that is being deleted. */ { - SmoothAssocData *ptr, *methods = clientData; + SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData; + (void)dummy; while (methods != NULL) { ptr = methods; @@ -725,26 +742,28 @@ SmoothMethodCleanupProc( int TkSmoothParseProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tcl_Interp *interp, /* Used for reporting errors. */ Tk_Window tkwin, /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { - register const Tk_SmoothMethod **smoothPtr = + const Tk_SmoothMethod **smoothPtr = (const Tk_SmoothMethod **) (widgRec + offset); const Tk_SmoothMethod *smooth = NULL; int b; size_t length; SmoothAssocData *methods; + (void)dummy; + (void)tkwin; if (value == NULL || *value == 0) { *smoothPtr = NULL; return TCL_OK; } length = strlen(value); - methods = Tcl_GetAssocData(interp, "smoothMethod", NULL); + methods = (SmoothAssocData *)Tcl_GetAssocData(interp, "smoothMethod", NULL); /* * Not initialized yet; fix that now. @@ -817,7 +836,7 @@ TkSmoothParseProc( const char * TkSmoothPrintProc( - ClientData clientData, /* Ignored. */ + ClientData dummy, /* Ignored. */ Tk_Window tkwin, /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ @@ -825,8 +844,11 @@ TkSmoothPrintProc( * information about how to reclaim storage * for return string. */ { - register const Tk_SmoothMethod *smoothPtr = + const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); + (void)dummy; + (void)tkwin; + (void)freeProcPtr; return smoothPtr ? smoothPtr->name : "0"; } @@ -876,7 +898,7 @@ Tk_GetDash( } i = strlen(value); if (i > (int) sizeof(char *)) { - dash->pattern.pt = pt = ckalloc(strlen(value)); + dash->pattern.pt = pt = (char *)ckalloc(strlen(value)); } else { pt = dash->pattern.array; } @@ -894,7 +916,7 @@ Tk_GetDash( ckfree(dash->pattern.pt); } if (argc > (int) sizeof(char *)) { - dash->pattern.pt = pt = ckalloc(argc); + dash->pattern.pt = pt = (char *)ckalloc(argc); } else { pt = dash->pattern.array; } @@ -1225,7 +1247,7 @@ Tk_ChangeOutlineGC( int i = -dash->number; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - q = ckalloc(2 * i); + q = (char *)ckalloc(2 * i); i = DashConvert(q, p, i, width); XSetDashes(Canvas(canvas)->display, outline->gc, outline->offset, q,i); ckfree(q); @@ -1446,7 +1468,7 @@ Tk_CanvasPsOutline( Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else if (dash->number < 0) { if (dash->number < -5) { - lptr = ckalloc(1 - 2*dash->number); + lptr = (char *)ckalloc(1 - 2*dash->number); } i = DashConvert(lptr, ptr, -dash->number, width); if (i > 0) { @@ -1659,6 +1681,7 @@ TkCanvTranslatePath( int i, j; /* Loop counters */ double limit[4]; /* Boundries at which clipping occurs */ double staticSpace[480]; /* Temp space from the stack */ + (void)closedPath; /* * Constrain all vertices of the path to be within a box that is no larger @@ -1718,7 +1741,7 @@ TkCanvTranslatePath( if (numVertex*12 <= (int) (sizeof(staticSpace) / sizeof(double))) { tempArr = staticSpace; } else { - tempArr = ckalloc(numVertex * 12 * sizeof(double)); + tempArr = (double *)ckalloc(numVertex * 12 * sizeof(double)); } for (i=0; i<numVertex*2; i++){ tempArr[i] = coordArr[i]; diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 59e81af..cdce65d 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -408,6 +408,7 @@ DeleteWinItem( { WindowItem *winItemPtr = (WindowItem *) itemPtr; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); + (void)display; if (winItemPtr->tkwin != NULL) { Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, @@ -570,6 +571,11 @@ DisplayWinItem( short x, y; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); Tk_State state = itemPtr->state; + (void)display; + (void)regionX; + (void)regionY; + (void)regionWidth; + (void)regionHeight; if (winItemPtr->tkwin == NULL) { return; @@ -658,6 +664,7 @@ WinItemToPoint( { WindowItem *winItemPtr = (WindowItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; + (void)canvas; x1 = winItemPtr->header.x1; y1 = winItemPtr->header.y1; @@ -715,6 +722,7 @@ WinItemToArea( * area. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; + (void)canvas; if ((rectPtr[2] <= winItemPtr->header.x1) || (rectPtr[0] >= winItemPtr->header.x2) @@ -751,9 +759,12 @@ WinItemToArea( #ifdef X_GetImage static int xerrorhandler( - ClientData clientData, + ClientData dummy, XErrorEvent *e) { + (void)dummy; + (void)e; + return 0; } #endif /* X_GetImage */ @@ -1044,7 +1055,7 @@ WinItemStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; if (eventPtr->type == DestroyNotify) { winItemPtr->tkwin = NULL; @@ -1074,7 +1085,8 @@ WinItemRequestProc( ClientData clientData, /* Pointer to record for window item. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; + (void)tkwin; ComputeWindowBbox(winItemPtr->canvas, winItemPtr); @@ -1111,8 +1123,9 @@ WinItemLostSlaveProc( * was stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - WindowItem *winItemPtr = clientData; + WindowItem *winItemPtr = (WindowItem *)clientData; Tk_Window canvasTkwin = Tk_CanvasTkwin(winItemPtr->canvas); + (void)tkwin; Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, WinItemStructureProc, winItemPtr); diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 424dcf1..53ea6d5 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -684,7 +684,7 @@ Tk_CanvasObjCmd( int argc, /* Number of arguments. */ Tcl_Obj *const argv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkCanvas *canvasPtr; Tk_Window newWin; @@ -708,7 +708,7 @@ Tk_CanvasObjCmd( * pointers). */ - canvasPtr = ckalloc(sizeof(TkCanvas)); + canvasPtr = (TkCanvas *)ckalloc(sizeof(TkCanvas)); canvasPtr->tkwin = newWin; canvasPtr->display = Tk_Display(newWin); canvasPtr->interp = interp; @@ -832,7 +832,7 @@ CanvasWidgetCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ @@ -962,7 +962,7 @@ CanvasWidgetCmd( entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); object = itemPtr; } @@ -1305,7 +1305,7 @@ CanvasWidgetCmd( } typePtr = matchPtr; - itemPtr = ckalloc(typePtr->itemSize); + itemPtr = (Tk_Item *)ckalloc(typePtr->itemSize); itemPtr->id = canvasPtr->nextId; canvasPtr->nextId++; itemPtr->tagPtr = itemPtr->staticTagSpace; @@ -2236,7 +2236,7 @@ static void DestroyCanvas( void *memPtr) /* Info about canvas widget. */ { - TkCanvas *canvasPtr = memPtr; + TkCanvas *canvasPtr = (TkCanvas *)memPtr; Tk_Item *itemPtr; TagSearchExpr *expr, *next; @@ -2469,7 +2469,7 @@ static void CanvasWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkCanvas *canvasPtr = instanceData; + TkCanvas *canvasPtr = (TkCanvas *)instanceData; Tk_Item *itemPtr; itemPtr = canvasPtr->firstItemPtr; @@ -2582,12 +2582,12 @@ DrawCanvas( int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */ int zoom) { - TkCanvas * canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin; Display *displayPtr; - Tk_PhotoImageBlock blockPtr = {0}; + Tk_PhotoImageBlock blockPtr = {0,0,0,0,0,{0,0,0,0}}; Window wid; - Tk_Item * itemPtr; + Tk_Item *itemPtr; Pixmap pixmap = 0; XImage *ximagePtr = NULL; Visual *visualPtr; @@ -2814,7 +2814,7 @@ DrawCanvas( blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; - blockPtr.pixelPtr = ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); + blockPtr.pixelPtr = (unsigned char *)ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA @@ -3001,7 +3001,7 @@ static void DisplayCanvas( ClientData clientData) /* Information about widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; Tk_Item *itemPtr; Pixmap pixmap; @@ -3255,7 +3255,7 @@ CanvasEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (eventPtr->type == Expose) { int x, y; @@ -3345,7 +3345,7 @@ static void CanvasCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; Tk_Window tkwin = canvasPtr->tkwin; /* @@ -3635,7 +3635,7 @@ InitCanvas(void) static SearchUids * GetStaticUids(void) { - SearchUids *searchUids = + SearchUids *searchUids = (SearchUids *) Tcl_GetThreadData(&dataKey, sizeof(SearchUids)); if (searchUids->allUid == NULL) { @@ -3674,7 +3674,7 @@ TagSearchExprInit( TagSearchExpr *expr = *exprPtrPtr; if (expr == NULL) { - expr = ckalloc(sizeof(TagSearchExpr)); + expr = (TagSearchExpr *)ckalloc(sizeof(TagSearchExpr)); expr->allocated = 0; expr->uids = NULL; expr->next = NULL; @@ -3755,7 +3755,7 @@ TagSearchScan( * Allocate primary search struct on first call. */ - *searchPtrPtr = searchPtr = ckalloc(sizeof(TagSearch)); + *searchPtrPtr = searchPtr = (TagSearch *)ckalloc(sizeof(TagSearch)); searchPtr->expr = NULL; /* @@ -3763,7 +3763,7 @@ TagSearchScan( */ searchPtr->rewritebufferAllocated = 100; - searchPtr->rewritebuffer = ckalloc(searchPtr->rewritebufferAllocated); + searchPtr->rewritebuffer =(char *) ckalloc(searchPtr->rewritebufferAllocated); } TagSearchExprInit(&searchPtr->expr); @@ -3780,7 +3780,7 @@ TagSearchScan( if ((unsigned) searchPtr->stringLength >= searchPtr->rewritebufferAllocated) { searchPtr->rewritebufferAllocated = searchPtr->stringLength + 100; - searchPtr->rewritebuffer = + searchPtr->rewritebuffer = (char *) ckrealloc(searchPtr->rewritebuffer, searchPtr->rewritebufferAllocated); } @@ -3963,10 +3963,10 @@ TagSearchScanExpr( if (expr->index >= expr->allocated-1) { expr->allocated += 15; if (expr->uids) { - expr->uids = ckrealloc(expr->uids, + expr->uids = (Tk_Uid *)ckrealloc(expr->uids, expr->allocated * sizeof(Tk_Uid)); } else { - expr->uids = ckalloc(expr->allocated * sizeof(Tk_Uid)); + expr->uids = (Tk_Uid *)ckalloc(expr->allocated * sizeof(Tk_Uid)); } } @@ -4378,7 +4378,7 @@ TagSearchFirst( entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { - itemPtr = Tcl_GetHashValue(entryPtr); + itemPtr = (Tk_Item *)Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; } else { lastPtr = itemPtr = NULL; @@ -4596,7 +4596,7 @@ DoItem( Tk_Uid *newTagPtr; itemPtr->tagSpace += 5; - newTagPtr = ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); + newTagPtr = (Tk_Uid*)ckalloc(itemPtr->tagSpace * sizeof(Tk_Uid)); memcpy((void *) newTagPtr, itemPtr->tagPtr, itemPtr->numTags * sizeof(Tk_Uid)); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { @@ -5081,7 +5081,7 @@ CanvasBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; unsigned long mask; Tcl_Preserve(canvasPtr); @@ -5486,7 +5486,7 @@ CanvasDoEvent( if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { - objectPtr = ckalloc(numObjects * sizeof(void *)); + objectPtr = (void **)ckalloc(numObjects * sizeof(void *)); } objectPtr[0] = (char *)searchUids->allUid; for (i = itemPtr->numTags-1; i >= 0; i--) { @@ -5543,7 +5543,7 @@ static void CanvasBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; if (!canvasPtr->textInfo.gotFocus || (canvasPtr->insertOffTime == 0)) { return; @@ -5699,7 +5699,7 @@ CanvasFetchSelection( * not including terminating NULL * character. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; return ItemSelection(canvasPtr, canvasPtr->textInfo.selItemPtr, offset, buffer, maxBytes); @@ -5727,7 +5727,7 @@ static void CanvasLostSelection( ClientData clientData) /* Information about entry widget. */ { - TkCanvas *canvasPtr = clientData; + TkCanvas *canvasPtr = (TkCanvas *)clientData; EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.selItemPtr); canvasPtr->textInfo.selItemPtr = NULL; @@ -6062,13 +6062,13 @@ TkGetStringsFromObjs( int objc, Tcl_Obj *const objv[]) { - register int i; + int i; const char **argv; if (objc <= 0) { return NULL; } - argv = ckalloc((objc+1) * sizeof(char *)); + argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (i = 0; i < objc; i++) { argv[i] = Tcl_GetString(objv[i]); } diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 39bebd0..782fd4e 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; @@ -134,7 +134,7 @@ ClipboardAppHandler( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; size_t length; const char *p; @@ -173,12 +173,16 @@ ClipboardAppHandler( static int ClipboardWindowHandler( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { + (void)dummy; + (void)offset; + (void)maxBytes; + buffer[0] = '.'; buffer[1] = 0; return 1; @@ -206,7 +210,7 @@ static void ClipboardLostSel( ClientData clientData) /* Pointer to TkDisplay structure. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; dispPtr->clipboardActive = 0; } @@ -359,7 +363,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 +385,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 +395,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 +427,7 @@ Tk_ClipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; static const char *const optionStrings[] = { "append", "clear", "get", NULL }; @@ -637,10 +641,11 @@ Tk_ClipboardObjCmd( int TkClipInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkDisplay *dispPtr)/* Display to initialize. */ + Tcl_Interp *dummy, /* Interpreter to use for error reporting. */ + TkDisplay *dispPtr)/* Display to initialize. */ { XSetWindowAttributes atts; + (void)dummy; dispPtr->clipTargetPtr = NULL; dispPtr->clipboardActive = 0; @@ -706,11 +711,13 @@ static int ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + Tcl_Interp *dummy, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend(clientData, portion, -1); + (void)dummy; + + Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } diff --git a/generic/tkCmds.c b/generic/tkCmds.c index d7f742a..2c0eadb 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++) { @@ -535,7 +535,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)) { @@ -595,7 +595,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 +683,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 +715,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 +807,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 +858,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; @@ -899,12 +899,13 @@ UseinputmethodsCmd( int WindowingsystemCmd( - ClientData clientData, /* Main window associated with interpreter. */ + ClientData dummy, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { const char *windowingsystem; + (void)dummy; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -928,7 +929,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) { @@ -992,7 +993,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[] = { @@ -1117,12 +1118,16 @@ Tk_TkwaitObjCmd( static char * WaitVariableProc( ClientData clientData, /* Pointer to integer to set to 1. */ - Tcl_Interp *interp, /* Interpreter containing variable. */ + Tcl_Interp *dummy, /* Interpreter containing variable. */ const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - int *donePtr = clientData; + int *donePtr = (int *)clientData; + (void)dummy; + (void)name1; + (void)name2; + (void)flags; *donePtr = 1; return NULL; @@ -1134,7 +1139,7 @@ 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; @@ -1148,7 +1153,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; @@ -1175,7 +1180,7 @@ WaitWindowProc( /* ARGSUSED */ int Tk_UpdateObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + ClientData dummy, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1184,6 +1189,7 @@ Tk_UpdateObjCmd( int flags, index; TkDisplay *dispPtr; int code = TCL_OK; + (void)dummy; if (objc == 1) { flags = TCL_DONT_WAIT; @@ -1281,7 +1287,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"}, @@ -1751,7 +1757,7 @@ Tk_WinfoObjCmd( break; } case WIN_VISUALSAVAILABLE: { - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; int count, i; int includeVisualId; Tcl_Obj *strPtr, *resultPtr; @@ -1772,9 +1778,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)); @@ -1891,11 +1897,14 @@ TkGetDisplayOf( /* ARGSUSED */ int TkDeadAppObjCmd( - ClientData clientData, /* Dummy. */ + ClientData dummy, /* Dummy. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { + (void)dummy; + (void)objc; + Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't invoke \"%s\" command: application has been destroyed", Tcl_GetString(objv[0]))); diff --git a/generic/tkColor.c b/generic/tkColor.c index 2f51b27..cf5c5f6 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -128,7 +128,7 @@ Tk_AllocColorFromObj( */ if (tkColPtr != NULL) { - TkColor *firstColorPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + TkColor *firstColorPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); FreeColorObj(objPtr); for (tkColPtr = firstColorPtr; tkColPtr != NULL; @@ -203,7 +203,7 @@ Tk_GetColor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->colorNameTable, name, &isNew); if (!isNew) { - existingColPtr = Tcl_GetHashValue(nameHashPtr); + existingColPtr = (TkColor *)Tcl_GetHashValue(nameHashPtr); for (tkColPtr = existingColPtr; tkColPtr != NULL; tkColPtr = tkColPtr->nextPtr) { if ((tkColPtr->screen == Tk_Screen(tkwin)) @@ -314,7 +314,7 @@ Tk_GetColorByValue( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->colorValueTable, (char *) &valueKey, &isNew); if (!isNew) { - tkColPtr = Tcl_GetHashValue(valueHashPtr); + tkColPtr = (TkColor *)Tcl_GetHashValue(valueHashPtr); tkColPtr->resourceRefCount++; return &tkColPtr->color; } @@ -363,12 +363,12 @@ const char * Tk_NameOfColor( XColor *colorPtr) /* Color whose name is desired. */ { - register TkColor *tkColPtr = (TkColor *) colorPtr; + TkColor *tkColPtr = (TkColor *) colorPtr; if (tkColPtr->magic==COLOR_MAGIC && tkColPtr->type==TK_COLOR_BY_NAME) { return tkColPtr->hashPtr->key.string; } else { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); sprintf(tsdPtr->rgbString, "#%04x%04x%04x", colorPtr->red, @@ -496,7 +496,7 @@ Tk_FreeColor( } TkpFreeColor(tkColPtr); - prevPtr = Tcl_GetHashValue(tkColPtr->hashPtr); + prevPtr = (TkColor *)Tcl_GetHashValue(tkColPtr->hashPtr); if (prevPtr == tkColPtr) { if (tkColPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(tkColPtr->hashPtr); @@ -583,7 +583,7 @@ static void FreeColorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { if ((tkColPtr->objRefCount-- <= 1) @@ -617,7 +617,7 @@ DupColorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkColor *tkColPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkColor *tkColPtr = (TkColor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = tkColPtr; @@ -667,7 +667,7 @@ Tk_GetColorFromObj( * map. If it is, we are done. */ - tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; + tkColPtr = (TkColor *)objPtr->internalRep.twoPtrValue.ptr1; if ((tkColPtr != NULL) && (tkColPtr->resourceRefCount > 0) && (Tk_Screen(tkwin) == tkColPtr->screen) @@ -693,7 +693,7 @@ Tk_GetColorFromObj( if (hashPtr == NULL) { goto error; } - for (tkColPtr = Tcl_GetHashValue(hashPtr); + for (tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { if ((Tk_Screen(tkwin) == tkColPtr->screen) && (Tk_Colormap(tkwin) == tkColPtr->colormap)) { @@ -809,7 +809,7 @@ TkDebugColor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->colorNameTable, name); if (hashPtr != NULL) { - TkColor *tkColPtr = Tcl_GetHashValue(hashPtr); + TkColor *tkColPtr = (TkColor *)Tcl_GetHashValue(hashPtr); if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); diff --git a/generic/tkConfig.c b/generic/tkConfig.c index 8c52170..457f388 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -178,7 +178,7 @@ Tk_CreateOptionTable( const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; size_t 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; @@ -664,7 +664,7 @@ DoObjConfig( if (internalPtr != NULL) { if (valuePtr != NULL) { value = TkGetStringFromObj(valuePtr, &length); - newStr = ckalloc(length + 1); + newStr = (char *)ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; @@ -883,7 +883,7 @@ DoObjConfig( const Tk_ObjCustomOption *custom = optionPtr->extra.custom; if (custom->setProc(custom->clientData, interp, tkwin, - &valuePtr, recordPtr, optionPtr->specPtr->internalOffset, + &valuePtr, (char *)recordPtr, optionPtr->specPtr->internalOffset, (char *)oldInternalPtr, optionPtr->specPtr->flags) != TCL_OK) { return TCL_ERROR; } @@ -1165,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; @@ -1191,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; @@ -1288,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; @@ -1400,7 +1400,7 @@ Tk_RestoreSavedOptions( = savePtr->items[i].valuePtr; } if (specPtr->internalOffset != TCL_AUTO_LENGTH) { - register char *ptr = (char *) &savePtr->items[i].internalForm; + char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { @@ -1458,7 +1458,7 @@ Tk_RestoreSavedOptions( if (custom->restoreProc != NULL) { custom->restoreProc(custom->clientData, savePtr->tkwin, - internalPtr, ptr); + (char *)internalPtr, ptr); } break; } @@ -1679,7 +1679,7 @@ FreeResources( case TK_OPTION_CUSTOM: { const Tk_ObjCustomOption *custom = optionPtr->extra.custom; if (internalFormExists && custom->freeProc != NULL) { - custom->freeProc(custom->clientData, tkwin, internalPtr); + custom->freeProc(custom->clientData, tkwin, (char *)internalPtr); } break; } @@ -1969,7 +1969,7 @@ GetObjectForOption( case TK_OPTION_CUSTOM: { const Tk_ObjCustomOption *custom = optionPtr->extra.custom; - objPtr = custom->getProc(custom->clientData, tkwin, recordPtr, + objPtr = custom->getProc(custom->clientData, tkwin, (char *)recordPtr, optionPtr->specPtr->internalOffset); break; } @@ -2066,7 +2066,7 @@ Tk_GetOptionValue( Tcl_Obj * TkDebugConfig( - Tcl_Interp *interp, /* Interpreter in which the table is + Tcl_Interp *dummy, /* Interpreter in which the table is * defined. */ Tk_OptionTable table) /* Table about which information is to be * returned. May not necessarily exist in the @@ -2076,8 +2076,9 @@ TkDebugConfig( Tcl_HashEntry *hashEntryPtr; Tcl_HashSearch search; Tcl_Obj *objPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; objPtr = Tcl_NewObj(); if (!tablePtr || !tsdPtr->initialized) { diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 7a74344..aa9b85b 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -44,6 +44,7 @@ typedef struct ChannelData { */ static int ConsoleClose(ClientData instanceData, Tcl_Interp *interp); +static int Console2Close(ClientData instanceData, Tcl_Interp *interp, int flags); static void ConsoleDeleteProc(ClientData clientData); static void ConsoleEventProc(ClientData clientData, XEvent *eventPtr); static int ConsoleHandle(ClientData instanceData, int direction, @@ -66,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, static const Tcl_ChannelType consoleChannelType = { "console", /* Type name. */ - TCL_CHANNEL_VERSION_4, /* v4 channel */ + TCL_CHANNEL_VERSION_5, /* v4 channel */ ConsoleClose, /* Close proc. */ ConsoleInput, /* Input proc. */ ConsoleOutput, /* Output proc. */ @@ -75,7 +76,7 @@ static const Tcl_ChannelType consoleChannelType = { NULL, /* Get option proc. */ ConsoleWatch, /* Watch for events on console. */ ConsoleHandle, /* Get a handle from the device. */ - NULL, /* close2proc. */ + Console2Close, /* close2proc. */ NULL, /* Always non-blocking.*/ NULL, /* flush proc. */ NULL, /* handler proc. */ @@ -227,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. @@ -255,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++; @@ -278,7 +279,7 @@ Tk_InitConsoleChannels( } if (doOut) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -295,7 +296,7 @@ Tk_InitConsoleChannels( } if (doErr) { - ChannelData *data = ckalloc(sizeof(ChannelData)); + ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData)); data->info = info; data->info->refCount++; @@ -377,7 +378,7 @@ Tk_CreateConsoleWindow( * New ConsoleInfo for a new console window. */ - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; /* @@ -407,7 +408,7 @@ Tk_CreateConsoleWindow( } } } else { - info = ckalloc(sizeof(ConsoleInfo)); + info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo)); info->refCount = 0; } @@ -497,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; @@ -561,19 +562,24 @@ ConsoleOutput( /* ARGSUSED */ static int ConsoleInput( - ClientData instanceData, /* Unused. */ + void *dummy, /* Unused. */ char *buf, /* Where to store data read. */ int bufSize, /* How much space is available in the * buffer? */ int *errorCode) /* Where to store error code. */ { + (void)dummy; + (void)buf; + (void)bufSize; + (void)errorCode; + return 0; /* Always return EOF. */ } /* *---------------------------------------------------------------------- * - * ConsoleClose -- + * ConsoleClose/Console2Close -- * * Closes the IO channel. * @@ -589,11 +595,12 @@ ConsoleInput( /* ARGSUSED */ static int ConsoleClose( - ClientData instanceData, /* Unused. */ - Tcl_Interp *interp) /* Unused. */ + ClientData instanceData, + Tcl_Interp *dummy) /* Unused. */ { - ChannelData *data = instanceData; + ChannelData *data = (ChannelData *)instanceData; ConsoleInfo *info = data->info; + (void)dummy; if (info) { if (info->refCount-- <= 1) { @@ -607,6 +614,18 @@ ConsoleClose( ckfree(data); return 0; } + +static int +Console2Close( + ClientData instanceData, /* Unused. */ + Tcl_Interp *interp, /* Unused. */ + int flags) +{ + if ((flags&(TCL_CLOSE_READ|TCL_CLOSE_WRITE))==0) { + return ConsoleClose(instanceData, interp); + } + return EINVAL; +} /* *---------------------------------------------------------------------- @@ -629,11 +648,13 @@ ConsoleClose( /* ARGSUSED */ static void ConsoleWatch( - ClientData instanceData, /* Device ID for the channel. */ + ClientData dummy, /* Device ID for the channel. */ int mask) /* OR-ed combination of TCL_READABLE, * TCL_WRITABLE and TCL_EXCEPTION, for the * events we are interested in. */ { + (void)dummy; + (void)mask; } /* @@ -656,12 +677,16 @@ ConsoleWatch( /* ARGSUSED */ static int ConsoleHandle( - ClientData instanceData, /* Device ID for the channel. */ + ClientData dummy, /* Device ID for the channel. */ int direction, /* TCL_READABLE or TCL_WRITABLE to indicate * which direction of the channel is being * requested. */ ClientData *handlePtr) /* Where to store handle */ { + (void)dummy; + (void)direction; + (void)handlePtr; + return TCL_ERROR; } @@ -694,7 +719,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) { @@ -784,7 +809,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) { @@ -852,7 +877,7 @@ static void DeleteConsoleInterp( ClientData clientData) { - Tcl_Interp *interp = clientData; + Tcl_Interp *interp = (Tcl_Interp *)clientData; Tcl_DeleteInterp(interp); } @@ -879,7 +904,7 @@ InterpDeleteProc( ClientData clientData, Tcl_Interp *interp) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); @@ -911,7 +936,7 @@ static void ConsoleDeleteProc( ClientData clientData) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); @@ -946,7 +971,7 @@ ConsoleEventProc( XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { - ConsoleInfo *info = clientData; + ConsoleInfo *info = (ConsoleInfo *)clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 6bdfa9d..98f018a 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -100,7 +100,7 @@ Tk_AllocCursorFromObj( if (objPtr->typePtr != &tkCursorObjType) { InitCursorObj(objPtr); } - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; /* * If the object currently points to a TkCursor, see if it's the one we @@ -129,7 +129,7 @@ Tk_AllocCursorFromObj( */ if (cursorPtr != NULL) { - TkCursor *firstCursorPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + TkCursor *firstCursorPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); FreeCursorObj(objPtr); for (cursorPtr = firstCursorPtr; cursorPtr != NULL; @@ -229,7 +229,7 @@ TkcGetCursor( * details on legal syntax. */ { Tcl_HashEntry *nameHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; TkCursor *existingCursorPtr = NULL; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -241,7 +241,7 @@ TkcGetCursor( nameHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorNameTable, string, &isNew); if (!isNew) { - existingCursorPtr = Tcl_GetHashValue(nameHashPtr); + existingCursorPtr = (TkCursor *)Tcl_GetHashValue(nameHashPtr); for (cursorPtr = existingCursorPtr; cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { @@ -320,7 +320,7 @@ Tk_GetCursorFromData( { DataKey dataKey; Tcl_HashEntry *dataHashPtr; - register TkCursor *cursorPtr; + TkCursor *cursorPtr; int isNew; XColor fgColor, bgColor; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -341,7 +341,7 @@ Tk_GetCursorFromData( dataHashPtr = Tcl_CreateHashEntry(&dispPtr->cursorDataTable, (char *) &dataKey, &isNew); if (!isNew) { - cursorPtr = Tcl_GetHashValue(dataHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(dataHashPtr); cursorPtr->resourceRefCount++; return cursorPtr->cursor; } @@ -432,7 +432,7 @@ Tk_NameOfCursor( if (idHashPtr == NULL) { goto printid; } - cursorPtr = Tcl_GetHashValue(idHashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } @@ -468,7 +468,7 @@ FreeCursor( } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); - prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); + prevPtr = (TkCursor *)Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(cursorPtr->hashPtr); @@ -521,7 +521,7 @@ Tk_FreeCursor( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } - FreeCursor(Tcl_GetHashValue(idHashPtr)); + FreeCursor((TkCursor *)Tcl_GetHashValue(idHashPtr)); } /* @@ -586,7 +586,7 @@ static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { if ((cursorPtr->objRefCount-- <= 1) @@ -620,7 +620,7 @@ DupCursorObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkCursor *cursorPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkCursor *cursorPtr = (TkCursor *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = cursorPtr; @@ -705,7 +705,7 @@ GetCursorFromObj( * cached is the one that is needed. */ - cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; + cursorPtr = (TkCursor *)objPtr->internalRep.twoPtrValue.ptr1; if ((cursorPtr != NULL) && (Tk_Display(tkwin) == cursorPtr->display)) { return cursorPtr; } @@ -720,7 +720,7 @@ GetCursorFromObj( if (hashPtr == NULL) { goto error; } - for (cursorPtr = Tcl_GetHashValue(hashPtr); + for (cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); cursorPtr != NULL; cursorPtr = cursorPtr->nextPtr) { if (Tk_Display(tkwin) == cursorPtr->display) { FreeCursorObj(objPtr); @@ -855,7 +855,7 @@ TkDebugCursor( resultPtr = Tcl_NewObj(); hashPtr = Tcl_FindHashEntry(&dispPtr->cursorNameTable, name); if (hashPtr != NULL) { - cursorPtr = Tcl_GetHashValue(hashPtr); + cursorPtr = (TkCursor *)Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } diff --git a/generic/tkDList.h b/generic/tkDList.h index 2448439..1654497 100644 --- a/generic/tkDList.h +++ b/generic/tkDList.h @@ -361,9 +361,9 @@ LT##_Prepend(LT *head, struct ElemType *elem) \ { \ assert(head); \ assert(elem); \ - elem->_dl_.prev = (void *) head; \ + elem->_dl_.prev = (PSEntry *) head; \ if (!head->first) { \ - elem->_dl_.next = (void *) head; \ + elem->_dl_.next = (PSEntry *) head; \ head->last = elem; \ } else { \ elem->_dl_.next = head->first; \ @@ -378,9 +378,9 @@ LT##_Append(LT *head, struct ElemType *elem) \ { \ assert(head); \ assert(elem); \ - elem->_dl_.next = (void *) head; \ + elem->_dl_.next = (PSEntry *) head; \ if (!head->first) { \ - elem->_dl_.prev = (void *) head; \ + elem->_dl_.prev = (PSEntry *) head; \ head->first = elem; \ } else { \ elem->_dl_.prev = head->last; \ @@ -402,9 +402,9 @@ LT##_Move(LT *dst, LT *src) \ dst->last = src->last; \ } else { \ *dst = *src; \ - dst->first->_dl_.prev = (void *) dst; \ + dst->first->_dl_.prev = (PSEntry *) dst; \ } \ - dst->last->_dl_.next = (void *) dst; \ + dst->last->_dl_.next = (PSEntry *) dst; \ LT##_Init(src); \ } \ } \ @@ -528,11 +528,11 @@ LT##_Traverse(LT *head, LT##_Func func) \ #define TK_DLIST_FOREACH(var, head) \ assert(head); \ - for (var = head->first ? head->first : (void *) head; var != (void *) head; var = var->_dl_.next) + for (var = head->first ? head->first : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.next) #define TK_DLIST_FOREACH_REVERSE(var, head) \ assert(head); \ - for (var = head->last ? head->last : (void *) head; var != (void *) head; var = var->_dl_.prev) + for (var = head->last ? head->last : (PSEntry *) head; var != (PSEntry *) head; var = var->_dl_.prev) #endif /* TK_DLIST_DEFINED */ diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 93fb713..86799d9 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -484,15 +484,16 @@ static const Tk_ClassProcs entryClass = { int Tk_EntryObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; + Entry *entryPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -519,7 +520,7 @@ Tk_EntryObjCmd( * initialized as memset covers the rest. */ - entryPtr = ckalloc(sizeof(Entry)); + entryPtr = (Entry *)ckalloc(sizeof(Entry)); memset(entryPtr, 0, sizeof(Entry)); entryPtr->tkwin = tkwin; @@ -530,7 +531,7 @@ Tk_EntryObjCmd( EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_ENTRY; - tmp = ckalloc(1); + tmp = (char *)ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -602,7 +603,7 @@ EntryWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -1033,7 +1034,7 @@ static void DestroyEntry( void *memPtr) /* Info about entry widget. */ { - Entry *entryPtr = memPtr; + Entry *entryPtr = (Entry *)memPtr; /* * Free up all the stuff that requires special handling, then let @@ -1236,7 +1237,7 @@ ConfigureEntry( if (formatSpace < TCL_DOUBLE_SPACE) { formatSpace = TCL_DOUBLE_SPACE; } - sbPtr->formatBuf = ckrealloc(sbPtr->formatBuf, formatSpace); + sbPtr->formatBuf = (char *)ckrealloc(sbPtr->formatBuf, formatSpace); /* * We perturb the value of oldFrom to allow us to go into the @@ -1450,7 +1451,7 @@ EntryWorldChanged( unsigned long mask; Tk_3DBorder border; XColor *colorPtr; - Entry *entryPtr = instanceData; + Entry *entryPtr = (Entry *)instanceData; entryPtr->avgWidth = Tk_TextWidth(entryPtr->tkfont, "0", 1); if (entryPtr->avgWidth == 0) { @@ -1560,6 +1561,10 @@ TkpDrawEntryBorderAndFocus( Drawable pixmap, int isSpinbox) { + (void)entryPtr; + (void)pixmap; + (void)isSpinbox; + return 0; } @@ -1586,6 +1591,9 @@ TkpDrawSpinboxButtons( Spinbox *sbPtr, Pixmap pixmap) { + (void)sbPtr; + (void)pixmap; + return 0; } #endif /* Not MAC_OSX_TK */ @@ -1610,7 +1618,7 @@ static void DisplayEntry( ClientData clientData) /* Information about window. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->tkwin; int baseY, selStartX, selEndX, cursorX; int showSelection, xBound; @@ -1971,7 +1979,7 @@ EntryComputeGeometry( size = TkUniCharToUtf(ch, buf); entryPtr->numDisplayBytes = entryPtr->numChars * size; - p = ckalloc(entryPtr->numDisplayBytes + 1); + p = (char *)ckalloc(entryPtr->numDisplayBytes + 1); entryPtr->displayString = p; for (i = entryPtr->numChars; --i >= 0; ) { @@ -2140,7 +2148,7 @@ InsertChars( } newByteCount = entryPtr->numBytes + byteCount + 1; - newStr = ckalloc(newByteCount); + newStr = (char *)ckalloc(newByteCount); memcpy(newStr, string, byteIndex); strcpy(newStr + byteIndex, value); strcpy(newStr + byteIndex + byteCount, string + byteIndex); @@ -2241,11 +2249,11 @@ DeleteChars( byteCount = Tcl_UtfAtIndex(string + byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->numBytes + 1 - byteCount; - newStr = ckalloc(newByteCount); + newStr = (char *)ckalloc(newByteCount); memcpy(newStr, string, (size_t) byteIndex); strcpy(newStr + byteIndex, string + byteIndex + byteCount); - toDelete = ckalloc(byteCount + 1); + toDelete = (char *)ckalloc(byteCount + 1); memcpy(toDelete, string + byteIndex, (size_t) byteCount); toDelete[byteCount] = '\0'; @@ -2431,7 +2439,7 @@ EntrySetValue( * during validation */ - char *tmp = ckalloc(valueLen + 1); + char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); value = tmp; @@ -2460,7 +2468,7 @@ EntrySetValue( if (malloced) { entryPtr->string = value; } else { - char *tmp = ckalloc(valueLen + 1); + char *tmp = (char *)ckalloc(valueLen + 1); strcpy(tmp, value); entryPtr->string = tmp; @@ -2520,10 +2528,10 @@ EntryEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; if ((entryPtr->type == TK_SPINBOX) && (eventPtr->type == MotionNotify)) { - Spinbox *sbPtr = clientData; + Spinbox *sbPtr = (Spinbox *)clientData; int elem; elem = GetSpinboxElement(sbPtr, eventPtr->xmotion.x, @@ -2601,7 +2609,7 @@ static void EntryCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; /* * This function could be invoked either because the window was destroyed @@ -2889,7 +2897,7 @@ EntryFetchSelection( int maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NUL character. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int byteCount; const char *string; const char *selStart, *selEnd; @@ -2936,7 +2944,7 @@ static void EntryLostSelection( ClientData clientData) /* Information about entry widget. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; entryPtr->flags &= ~GOT_SELECTION; @@ -3123,7 +3131,7 @@ static void EntryBlinkProc( ClientData clientData) /* Pointer to record describing entry. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; if ((entryPtr->state == STATE_DISABLED) || (entryPtr->state == STATE_READONLY) || @@ -3218,8 +3226,10 @@ EntryTextVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; const char *value; + (void)name1; + (void)name2; if (entryPtr->flags & ENTRY_DELETED) { /* @@ -3301,11 +3311,11 @@ EntryTextVarProc( static int EntryValidate( - register Entry *entryPtr, /* Entry that needs validation. */ - register char *cmd) /* Validation command (NULL-terminated + Entry *entryPtr, /* Entry that needs validation. */ + char *cmd) /* Validation command (NULL-terminated * string). */ { - register Tcl_Interp *interp = entryPtr->interp; + Tcl_Interp *interp = entryPtr->interp; int code, isOK; code = Tcl_EvalEx(interp, cmd, -1, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); @@ -3361,7 +3371,7 @@ EntryValidate( static int EntryValidateChange( - register Entry *entryPtr, /* Entry that needs validation. */ + Entry *entryPtr, /* Entry that needs validation. */ const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ @@ -3500,8 +3510,8 @@ EntryValidateChange( static void ExpandPercents( - register Entry *entryPtr, /* Entry that needs validation. */ - register const char *before, + Entry *entryPtr, /* Entry that needs validation. */ + const char *before, /* Command containing percent expressions to * be replaced. */ const char *change, /* Characters to added/deleted (NUL-terminated @@ -3515,7 +3525,7 @@ ExpandPercents( int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, length; - register const char *string; + const char *string; int ch; char numStorage[2*TCL_INTEGER_SPACE]; @@ -3665,16 +3675,17 @@ ExpandPercents( int Tk_SpinboxObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Entry *entryPtr; - register Spinbox *sbPtr; + Entry *entryPtr; + Spinbox *sbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -3701,7 +3712,7 @@ Tk_SpinboxObjCmd( * initialized as memset covers the rest. */ - sbPtr = ckalloc(sizeof(Spinbox)); + sbPtr = (Spinbox *)ckalloc(sizeof(Spinbox)); entryPtr = (Entry *) sbPtr; memset(sbPtr, 0, sizeof(Spinbox)); @@ -3713,7 +3724,7 @@ Tk_SpinboxObjCmd( EntryCmdDeletedProc); entryPtr->optionTable = optionTable; entryPtr->type = TK_SPINBOX; - tmp = ckalloc(1); + tmp = (char *)ckalloc(1); tmp[0] = '\0'; entryPtr->string = tmp; entryPtr->selectFirst = -1; @@ -3740,7 +3751,7 @@ Tk_SpinboxObjCmd( sbPtr->fromValue = 0.0; sbPtr->toValue = 100.0; sbPtr->increment = 1.0; - sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE); + sbPtr->formatBuf = (char *)ckalloc(TCL_DOUBLE_SPACE); sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; @@ -3803,8 +3814,8 @@ SpinboxWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Entry *entryPtr = clientData; - Spinbox *sbPtr = clientData; + Entry *entryPtr = (Entry *)clientData; + Spinbox *sbPtr = (Spinbox *)clientData; int cmdIndex, selIndex, result; Tcl_Obj *objPtr; @@ -4350,8 +4361,8 @@ GetSpinboxElement( static int SpinboxInvoke( - register Tcl_Interp *interp,/* Current interpreter. */ - register Spinbox *sbPtr, /* Spinbox to invoke. */ + Tcl_Interp *interp,/* Current interpreter. */ + Spinbox *sbPtr, /* Spinbox to invoke. */ int element) /* Element to invoke, either the "up" or * "down" button. */ { diff --git a/generic/tkError.c b/generic/tkError.c index 5aa6d88..938afc3 100644 --- a/generic/tkError.c +++ b/generic/tkError.c @@ -107,7 +107,7 @@ Tk_CreateErrorHandler( * Create the handler record. */ - errorPtr = ckalloc(sizeof(TkErrorHandler)); + errorPtr = (TkErrorHandler *)ckalloc(sizeof(TkErrorHandler)); errorPtr->dispPtr = dispPtr; errorPtr->firstRequest = NextRequest(display); errorPtr->lastRequest = (unsigned) -1; diff --git a/generic/tkEvent.c b/generic/tkEvent.c index 0782d7a..b897bdc 100644 --- a/generic/tkEvent.c +++ b/generic/tkEvent.c @@ -682,8 +682,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 @@ -698,7 +698,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; @@ -729,7 +729,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; } @@ -772,11 +772,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)); /* @@ -848,10 +848,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; @@ -889,7 +889,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) { @@ -922,7 +922,7 @@ Tk_CreateClientMessageHandler( Tk_ClientMessageProc *proc) /* Function to call on event. */ { GenericHandler *handlerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -930,7 +930,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 */ @@ -968,7 +968,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) { @@ -999,7 +999,7 @@ Tk_DeleteClientMessageHandler( void TkEventInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->handlersActive = 0; @@ -1034,7 +1034,8 @@ TkXErrorHandler( ClientData clientData, /* Pointer to flag we set. */ XErrorEvent *errEventPtr) /* X error info. */ { - int *error = clientData; + int *error = (int *)clientData; + (void)errEventPtr; *error = 1; return 0; @@ -1121,12 +1122,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)); /* @@ -1324,9 +1325,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)); /* @@ -1374,8 +1375,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) { @@ -1429,7 +1430,7 @@ Tk_RestrictEvents( * argument. */ { Tk_RestrictProc *prev; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); prev = tsdPtr->restrictProc; @@ -1522,7 +1523,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); @@ -1554,7 +1555,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)) { @@ -1644,7 +1645,7 @@ WindowEventProc( { TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr; Tk_RestrictAction result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(flags & TCL_WINDOW_EVENTS)) { @@ -1743,7 +1744,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"); @@ -1775,7 +1776,7 @@ TkCreateExitHandler( { ExitHandler *exitPtr; - exitPtr = ckalloc(sizeof(ExitHandler)); + exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler)); exitPtr->proc = proc; exitPtr->clientData = clientData; Tcl_MutexLock(&exitMutex); @@ -1871,10 +1872,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; @@ -1912,7 +1913,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; @@ -1951,9 +1952,10 @@ TkDeleteThreadExitHandler( void TkFinalize( - ClientData clientData) /* Arbitrary value to pass to proc. */ + ClientData dummy) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; + (void)dummy; #if defined(_WIN32) && !defined(STATIC_BUILD) if (!tclStubsPtr) { @@ -2003,11 +2005,12 @@ TkFinalize( void TkFinalizeThread( - ClientData clientData) /* Arbitrary value to pass to proc. */ + ClientData dummy) /* Arbitrary value to pass to proc. */ { ExitHandler *exitPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL); diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 561676b..038129f 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -164,7 +164,7 @@ TkFreeFileFilters( FileFilterClause *clausePtr; GlobPattern *globPtr; MacFileType *mfPtr; - register void *toFree; /* A pointer that we are about to free. */ + void *toFree; /* A pointer that we are about to free. */ for (filterPtr = flistPtr->filters; filterPtr != NULL; ) { for (clausePtr = filterPtr->clauses; clausePtr != NULL; ) { @@ -305,7 +305,7 @@ AddClause( * Add the clause into the list of clauses */ - clausePtr = ckalloc(sizeof(FileFilterClause)); + clausePtr = (FileFilterClause *)ckalloc(sizeof(FileFilterClause)); clausePtr->patterns = NULL; clausePtr->patternsTail = NULL; clausePtr->macTypes = NULL; @@ -321,7 +321,7 @@ AddClause( if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { - GlobPattern *globPtr = ckalloc(sizeof(GlobPattern)); + GlobPattern *globPtr = (GlobPattern *)ckalloc(sizeof(GlobPattern)); TkSizeT len; const char *str = TkGetStringFromObj(globList[i], &len); @@ -331,12 +331,12 @@ AddClause( * Prepend a "*" to patterns that do not have a leading "*" */ - globPtr->pattern = ckalloc(len + 1); + globPtr->pattern = (char *)ckalloc(len + 1); globPtr->pattern[0] = '*'; strcpy(globPtr->pattern+1, str); } else if (isWindows) { if (strcmp(str, "*") == 0) { - globPtr->pattern = ckalloc(4); + globPtr->pattern = (char *)ckalloc(4); strcpy(globPtr->pattern, "*.*"); } else if (strcmp(str, "") == 0) { /* @@ -345,14 +345,14 @@ AddClause( * TODO: "*." actually matches with all files on Win95 */ - globPtr->pattern = ckalloc(3); + globPtr->pattern = (char *)ckalloc(3); strcpy(globPtr->pattern, "*."); } else { - globPtr->pattern = ckalloc(len); + globPtr->pattern = (char *)ckalloc(len); strcpy(globPtr->pattern, str); } } else { - globPtr->pattern = ckalloc(len); + globPtr->pattern = (char *)ckalloc(len); strcpy(globPtr->pattern, str); } @@ -376,7 +376,7 @@ AddClause( for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; TkSizeT len; - MacFileType *mfPtr = ckalloc(sizeof(MacFileType)); + MacFileType *mfPtr = (MacFileType *)ckalloc(sizeof(MacFileType)); const char *strType = TkGetStringFromObj(ostypeList[i], &len); char *string; @@ -445,11 +445,11 @@ GetFilter( } } - filterPtr = ckalloc(sizeof(FileFilter)); + filterPtr = (FileFilter *)ckalloc(sizeof(FileFilter)); filterPtr->clauses = NULL; filterPtr->clausesTail = NULL; len = strlen(name) + 1; - filterPtr->name = ckalloc(len); + filterPtr->name = (char *)ckalloc(len); memcpy(filterPtr->name, name, len); if (flistPtr->filters == NULL) { diff --git a/generic/tkFocus.c b/generic/tkFocus.c index 7b5acfb..40ef139 100644 --- a/generic/tkFocus.c +++ b/generic/tkFocus.c @@ -113,8 +113,8 @@ Tk_FocusObjCmd( static const char *const focusOptions[] = { "-displayof", "-force", "-lastfor", NULL }; - Tk_Window tkwin = clientData; - TkWindow *winPtr = clientData; + Tk_Window tkwin = (Tk_Window)clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *newPtr, *topLevelPtr; ToplevelFocusInfo *tlFocusPtr; const char *windowName; @@ -415,7 +415,7 @@ TkFocusFilterEvent( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = tlFocusPtr->focusWinPtr = winPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -622,7 +622,7 @@ TkSetFocusWin( } } if (tlFocusPtr == NULL) { - tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + tlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; @@ -807,7 +807,7 @@ TkFocusKeyEvent( void TkFocusDeadWindow( - register TkWindow *winPtr) /* Information about the window that is being + TkWindow *winPtr) /* Information about the window that is being * deleted. */ { ToplevelFocusInfo *tlFocusPtr, *prevPtr; @@ -961,7 +961,7 @@ FocusMapProc( ClientData clientData, /* Toplevel window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; DisplayFocusInfo *displayFocusPtr; if (eventPtr->type == VisibilityNotify) { @@ -1015,7 +1015,7 @@ FindDisplayFocusInfo( * The record doesn't exist yet. Make a new one. */ - displayFocusPtr = ckalloc(sizeof(DisplayFocusInfo)); + displayFocusPtr = (DisplayFocusInfo *)ckalloc(sizeof(DisplayFocusInfo)); displayFocusPtr->dispPtr = dispPtr; displayFocusPtr->focusWinPtr = NULL; displayFocusPtr->focusOnMapPtr = NULL; @@ -1143,7 +1143,7 @@ TkFocusSplit( * Move focus to new toplevel. */ - ToplevelFocusInfo *newTlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); + ToplevelFocusInfo *newTlFocusPtr = (ToplevelFocusInfo *)ckalloc(sizeof(ToplevelFocusInfo)); newTlFocusPtr->topLevelPtr = winPtr; newTlFocusPtr->focusWinPtr = tlFocusPtr->focusWinPtr; diff --git a/generic/tkFont.c b/generic/tkFont.c index b984e53..1604eca 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -379,7 +379,7 @@ void TkFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - TkFontInfo *fiPtr = ckalloc(sizeof(TkFontInfo)); + TkFontInfo *fiPtr = (TkFontInfo *)ckalloc(sizeof(TkFontInfo)); Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS); Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS); @@ -472,7 +472,7 @@ Tk_FontObjCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int index; - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr; static const char *const optionStrings[] = { "actual", "configure", "create", "delete", @@ -618,7 +618,7 @@ Tk_FontObjCmd( namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string); nfPtr = NULL; /* lint. */ if (namedHashPtr != NULL) { - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); } if ((namedHashPtr == NULL) || nfPtr->deletePending) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -797,10 +797,10 @@ Tk_FontObjCmd( resultPtr = Tcl_NewObj(); namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search); while (namedHashPtr != NULL) { - NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr); + NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { - char *string = Tcl_GetHashKey(&fiPtr->namedTable, + char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable, namedHashPtr); Tcl_ListObjAppendElement(NULL, resultPtr, @@ -843,7 +843,7 @@ UpdateDependentFonts( Tcl_HashEntry *cacheHashPtr; Tcl_HashSearch search; TkFont *fontPtr; - NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr); + NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount == 0) { /* @@ -856,7 +856,7 @@ UpdateDependentFonts( cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search); while (cacheHashPtr != NULL) { - for (fontPtr = Tcl_GetHashValue(cacheHashPtr); + for (fontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (fontPtr->namedHashPtr == namedHashPtr) { TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa); @@ -874,7 +874,7 @@ static void TheWorldHasChanged( ClientData clientData) /* Info about application's fonts. */ { - TkFontInfo *fiPtr = clientData; + TkFontInfo *fiPtr = (TkFontInfo *)clientData; #if defined(MAC_OSX_TK) /* @@ -964,7 +964,7 @@ TkCreateNamedFont( namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew); if (!isNew) { - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (!nfPtr->deletePending) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -986,7 +986,7 @@ TkCreateNamedFont( return TCL_OK; } - nfPtr = ckalloc(sizeof(NamedFont)); + nfPtr = (NamedFont *)ckalloc(sizeof(NamedFont)); nfPtr->deletePending = 0; Tcl_SetHashValue(namedHashPtr, nfPtr); nfPtr->fa = *faPtr; @@ -1025,7 +1025,7 @@ TkDeleteNamedFont( } return TCL_ERROR; } - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); if (nfPtr->refCount != 0) { nfPtr->deletePending = 1; } else { @@ -1114,7 +1114,7 @@ Tk_AllocFontFromObj( SetFontFromAny(interp, objPtr); } - oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1; + oldFontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (oldFontPtr != NULL) { if (oldFontPtr->resourceRefCount == 0) { /* @@ -1143,7 +1143,7 @@ Tk_AllocFontFromObj( cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr), &isNew); } - firstFontPtr = Tcl_GetHashValue(cacheHashPtr); + firstFontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr); for (fontPtr = firstFontPtr; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { @@ -1166,7 +1166,7 @@ Tk_AllocFontFromObj( * Construct a font based on a named font. */ - nfPtr = Tcl_GetHashValue(namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr); nfPtr->refCount++; fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa); @@ -1299,7 +1299,7 @@ Tk_GetFontFromObj( SetFontFromAny(NULL, objPtr); } - fontPtr = objPtr->internalRep.twoPtrValue.ptr1; + fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if (fontPtr->resourceRefCount == 0) { /* @@ -1326,7 +1326,7 @@ Tk_GetFontFromObj( hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr)); } if (hashPtr != NULL) { - for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL; + for (fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); fontPtr != NULL; fontPtr = fontPtr->nextPtr) { if (Tk_Screen(tkwin) == fontPtr->screen) { fontPtr->objRefCount++; @@ -1361,10 +1361,11 @@ Tk_GetFontFromObj( static int SetFontFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; + (void)dummy; /* * Free the old internalRep before setting the new one. @@ -1446,14 +1447,14 @@ Tk_FreeFont( * the named font and free it if no-one else is using it. */ - nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr); + nfPtr = (NamedFont *)Tcl_GetHashValue(fontPtr->namedHashPtr); if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); ckfree(nfPtr); } } - prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr); + prevPtr = (TkFont *)Tcl_GetHashValue(fontPtr->cacheHashPtr); if (prevPtr == fontPtr) { if (fontPtr->nextPtr == NULL) { Tcl_DeleteHashEntry(fontPtr->cacheHashPtr); @@ -1531,7 +1532,7 @@ static void FreeFontObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { - TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if ((fontPtr->objRefCount-- <= 1) && (fontPtr->resourceRefCount == 0)) { @@ -1565,7 +1566,7 @@ DupFontObjProc( Tcl_Obj *srcObjPtr, /* The object we are copying from. */ Tcl_Obj *dupObjPtr) /* The object we are copying to. */ { - TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1; + TkFont *fontPtr = (TkFont *)srcObjPtr->internalRep.twoPtrValue.ptr1; dupObjPtr->typePtr = srcObjPtr->typePtr; dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr; @@ -2000,7 +2001,7 @@ Tk_ComputeTextLayout( maxChunks = 1; - layoutPtr = ckalloc(sizeof(TextLayout) + layoutPtr = (TextLayout *)ckalloc(sizeof(TextLayout) + (maxChunks-1) * sizeof(LayoutChunk)); layoutPtr->tkfont = tkfont; layoutPtr->string = string; @@ -3381,6 +3382,7 @@ ConfigAttributesObj( int i, n, index; Tcl_Obj *optionPtr, *valuePtr; const char *value; + (void)tkwin; for (i = 0; i < objc; i += 2) { optionPtr = objv[i]; @@ -3747,7 +3749,7 @@ NewChunk( if (layoutPtr->numChunks == maxChunks) { maxChunks *= 2; s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk)); - layoutPtr = ckrealloc(layoutPtr, s); + layoutPtr = (TextLayout *)ckrealloc(layoutPtr, s); *layoutPtrPtr = layoutPtr; *maxPtr = maxChunks; @@ -4210,7 +4212,7 @@ TkDebugFont( hashPtr = Tcl_FindHashEntry( &((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name); if (hashPtr != NULL) { - fontPtr = Tcl_GetHashValue(hashPtr); + fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); if (fontPtr == NULL) { Tcl_Panic("TkDebugFont found empty hash table entry"); } diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 746f3eb..8c5ab4c 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -461,7 +461,7 @@ TkCreateFrame( * application. */ { int result, i; - Tcl_Obj **objv = ckalloc((argc+1) * sizeof(Tcl_Obj **)); + Tcl_Obj **objv = (Tcl_Obj **)ckalloc((argc+1) * sizeof(Tcl_Obj **)); for (i=0; i<argc; i++) { objv[i] = Tcl_NewStringObj(argv[i], -1); @@ -502,7 +502,7 @@ TkListCreateFrame( static int CreateFrame( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[], /* Argument objects. */ @@ -523,6 +523,7 @@ CreateFrame( unsigned int mask; Colormap colormap; Visual *visual; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -678,10 +679,10 @@ CreateFrame( */ if (type == TYPE_LABELFRAME) { - framePtr = ckalloc(sizeof(Labelframe)); + framePtr = (Frame *)ckalloc(sizeof(Labelframe)); memset(framePtr, 0, sizeof(Labelframe)); } else { - framePtr = ckalloc(sizeof(Frame)); + framePtr = (Frame *)ckalloc(sizeof(Frame)); memset(framePtr, 0, sizeof(Frame)); } framePtr->tkwin = newWin; @@ -772,7 +773,7 @@ FrameWidgetObjCmd( enum options { FRAME_CGET, FRAME_CONFIGURE }; - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; int result = TCL_OK, index; int c, i; TkSizeT length; @@ -891,8 +892,8 @@ static void DestroyFrame( void *memPtr) /* Info about frame widget. */ { - register Frame *framePtr = memPtr; - register Labelframe *labelframePtr = memPtr; + Frame *framePtr = (Frame *)memPtr; + Labelframe *labelframePtr = (Labelframe *)memPtr; if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); @@ -936,7 +937,7 @@ static void DestroyFramePartly( Frame *framePtr) /* Info about frame widget. */ { - register Labelframe *labelframePtr = (Labelframe *) framePtr; + Labelframe *labelframePtr = (Labelframe *) framePtr; if (framePtr->type == TYPE_LABELFRAME && labelframePtr->labelWin != NULL) { Tk_DeleteEventHandler(labelframePtr->labelWin, StructureNotifyMask, @@ -976,7 +977,7 @@ DestroyFramePartly( static int ConfigureFrame( Tcl_Interp *interp, /* Used for error reporting. */ - register Frame *framePtr, /* Information about widget; may or may not + Frame *framePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -994,7 +995,7 @@ ConfigureFrame( if (framePtr->menuName == NULL) { oldMenuName = NULL; } else { - oldMenuName = ckalloc(strlen(framePtr->menuName) + 1); + oldMenuName = (char *)ckalloc(strlen(framePtr->menuName) + 1); strcpy(oldMenuName, framePtr->menuName); } @@ -1149,8 +1150,8 @@ static void FrameWorldChanged( ClientData instanceData) /* Information about widget. */ { - Frame *framePtr = instanceData; - Labelframe *labelframePtr = instanceData; + Frame *framePtr = (Frame *)instanceData; + Labelframe *labelframePtr = (Labelframe *)instanceData; Tk_Window tkwin = framePtr->tkwin; XGCValues gcValues; GC gc; @@ -1327,7 +1328,7 @@ FrameWorldChanged( static void ComputeFrameGeometry( - register Frame *framePtr) /* Information about widget. */ + Frame *framePtr) /* Information about widget. */ { int otherWidth, otherHeight, otherWidthT, otherHeightT, padding; int maxWidth, maxHeight; @@ -1476,8 +1477,8 @@ static void DisplayFrame( ClientData clientData) /* Information about widget. */ { - register Frame *framePtr = clientData; - register Tk_Window tkwin = framePtr->tkwin; + Frame *framePtr = (Frame *)clientData; + Tk_Window tkwin = framePtr->tkwin; int bdX1, bdY1, bdX2, bdY2, hlWidth; Pixmap pixmap; TkRegion clipRegion = NULL; @@ -1735,9 +1736,9 @@ TkpDrawFrame( static void FrameEventProc( ClientData clientData, /* Information about window. */ - register XEvent *eventPtr) /* Information about event. */ + XEvent *eventPtr) /* Information about event. */ { - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; @@ -1829,7 +1830,7 @@ static void FrameCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; if (framePtr->menuName != NULL) { @@ -1880,7 +1881,7 @@ static void MapFrame( ClientData clientData) /* Pointer to frame structure. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; /* * Wait for all other background events to be processed before mapping @@ -1935,7 +1936,7 @@ TkInstallFrameMenu( TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->mainPtr != NULL) { - Frame *framePtr = winPtr->instanceData; + Frame *framePtr = (Frame *)winPtr->instanceData; if (framePtr == NULL) { Tcl_Panic("TkInstallFrameMenu couldn't get frame pointer"); @@ -1968,7 +1969,7 @@ FrameStructureProc( ClientData clientData, /* Pointer to record describing frame. */ XEvent *eventPtr) /* Describes what just happened. */ { - Labelframe *labelframePtr = clientData; + Labelframe *labelframePtr = (Labelframe *)clientData; if (eventPtr->type == DestroyNotify) { /* @@ -2006,7 +2007,8 @@ FrameRequestProc( ClientData clientData, /* Pointer to record for frame. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; + (void)tkwin; FrameWorldChanged(framePtr); } @@ -2034,8 +2036,9 @@ FrameLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - Frame *framePtr = clientData; - Labelframe *labelframePtr = clientData; + Frame *framePtr = (Frame *)clientData; + Labelframe *labelframePtr = (Labelframe *)clientData; + (void)tkwin; /* * This should only happen in a labelframe but it doesn't hurt to be @@ -2058,7 +2061,7 @@ void TkMapTopFrame( Tk_Window tkwin) { - Frame *framePtr = ((TkWindow *) tkwin)->instanceData; + Frame *framePtr = (Frame *)((TkWindow *) tkwin)->instanceData; Tk_OptionTable optionTable; if (Tk_IsTopLevel(tkwin) && framePtr->type == TYPE_FRAME) { @@ -2122,7 +2125,7 @@ TkToplevelWindowForCommand( if (cmdInfo.objProc != FrameWidgetObjCmd) { return NULL; } - framePtr = cmdInfo.objClientData; + framePtr = (Frame *)cmdInfo.objClientData; if (framePtr->type != TYPE_TOPLEVEL) { return NULL; } @@ -2156,7 +2159,14 @@ FrameBgImageProc( * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register Frame *framePtr = clientData; + Frame *framePtr = (Frame *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; + /* * Changing the background image never alters the dimensions of the frame. diff --git a/generic/tkGC.c b/generic/tkGC.c index 4caa046..47931a6 100644 --- a/generic/tkGC.c +++ b/generic/tkGC.c @@ -66,17 +66,17 @@ static void GCInit(TkDisplay *dispPtr); GC Tk_GetGC( Tk_Window tkwin, /* Window in which GC will be used. */ - register unsigned long valueMask, + unsigned long valueMask, /* 1 bits correspond to values specified in * *valuesPtr; other values are set from * defaults. */ - register XGCValues *valuePtr) + XGCValues *valuePtr) /* Values are specified here for bits set in * valueMask. */ { ValueKey valueKey; Tcl_HashEntry *valueHashPtr, *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; int isNew; Drawable d, freeDrawable; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -218,7 +218,7 @@ Tk_GetGC( valueHashPtr = Tcl_CreateHashEntry(&dispPtr->gcValueTable, (char *) &valueKey, &isNew); if (!isNew) { - gcPtr = Tcl_GetHashValue(valueHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(valueHashPtr); gcPtr->refCount++; return gcPtr->gc; } @@ -228,7 +228,7 @@ Tk_GetGC( * and add a new structure to the database. */ - gcPtr = ckalloc(sizeof(TkGC)); + gcPtr = (TkGC *)ckalloc(sizeof(TkGC)); /* * Find or make a drawable to use to specify the screen and depth of the @@ -291,7 +291,7 @@ Tk_FreeGC( GC gc) /* Graphics context to be released. */ { Tcl_HashEntry *idHashPtr; - register TkGC *gcPtr; + TkGC *gcPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->gcInit) { @@ -311,7 +311,7 @@ Tk_FreeGC( if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } - gcPtr = Tcl_GetHashValue(idHashPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(idHashPtr); if (gcPtr->refCount-- <= 1) { XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); @@ -347,7 +347,7 @@ TkGCCleanup( for (entryPtr = Tcl_FirstHashEntry(&dispPtr->gcIdTable, &search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { - gcPtr = Tcl_GetHashValue(entryPtr); + gcPtr = (TkGC *)Tcl_GetHashValue(entryPtr); XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); diff --git a/generic/tkGeometry.c b/generic/tkGeometry.c index 76752a3..30a57a9 100644 --- a/generic/tkGeometry.c +++ b/generic/tkGeometry.c @@ -90,7 +90,7 @@ Tk_ManageGeometry( ClientData clientData) /* Arbitrary one-word argument to pass to * geometry manager procedures. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->geomMgrPtr != NULL) && (mgrPtr != NULL) && ((winPtr->geomMgrPtr != mgrPtr) @@ -132,7 +132,7 @@ Tk_GeometryRequest( int reqWidth, int reqHeight)/* Minimum desired dimensions for window, in * pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; /* * X gets very upset if a window requests a width or height of zero, so @@ -182,8 +182,8 @@ Tk_SetInternalBorderEx( int left, int right, /* Width of internal border, in pixels. */ int top, int bottom) { - register TkWindow *winPtr = (TkWindow *) tkwin; - register int changed = 0; + TkWindow *winPtr = (TkWindow *) tkwin; + int changed = 0; if (left < 0) { left = 0; @@ -279,7 +279,7 @@ Tk_SetMinimumRequestSize( Tk_Window tkwin, /* Window that will have internal border. */ int minWidth, int minHeight)/* Minimum requested size, in pixels. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if ((winPtr->minReqWidth == minWidth) && (winPtr->minReqHeight == minHeight)) { @@ -324,7 +324,7 @@ TkSetGeometryMaster( * set. */ const char *master) /* The master identity. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) == 0) { @@ -341,7 +341,7 @@ TkSetGeometryMaster( return TCL_ERROR; } - winPtr->geomMgrName = ckalloc(strlen(master) + 1); + winPtr->geomMgrName = (char *)ckalloc(strlen(master) + 1); strcpy(winPtr->geomMgrName, master); return TCL_OK; } @@ -369,7 +369,7 @@ TkFreeGeometryMaster( * cleared. */ const char *master) /* The master identity. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) != 0) { @@ -419,7 +419,7 @@ Tk_MaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr; + MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; @@ -463,9 +463,9 @@ Tk_MaintainGeometry( hPtr = Tcl_CreateHashEntry(&dispPtr->maintainHashTable, (char *) master, &isNew); if (!isNew) { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); } else { - masterPtr = ckalloc(sizeof(MaintainMaster)); + masterPtr = (MaintainMaster *)ckalloc(sizeof(MaintainMaster)); masterPtr->ancestor = master; masterPtr->checkScheduled = 0; masterPtr->slavePtr = NULL; @@ -483,7 +483,7 @@ Tk_MaintainGeometry( goto gotSlave; } } - slavePtr = ckalloc(sizeof(MaintainSlave)); + slavePtr = (MaintainSlave *)ckalloc(sizeof(MaintainSlave)); slavePtr->slave = slave; slavePtr->master = master; slavePtr->nextPtr = masterPtr->slavePtr; @@ -568,7 +568,7 @@ Tk_UnmaintainGeometry( { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; - register MaintainSlave *slavePtr, *prevPtr; + MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; @@ -596,7 +596,7 @@ Tk_UnmaintainGeometry( if (hPtr == NULL) { return; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (MaintainMaster *)Tcl_GetHashValue(hPtr); slavePtr = masterPtr->slavePtr; if (slavePtr->slave == slave) { masterPtr->slavePtr = slavePtr->nextPtr; @@ -660,7 +660,7 @@ MaintainMasterProc( * master window. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainMaster *masterPtr = clientData; + MaintainMaster *masterPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; int done; @@ -714,7 +714,7 @@ MaintainSlaveProc( * master-slave pair. */ XEvent *eventPtr) /* Describes what just happened. */ { - MaintainSlave *slavePtr = clientData; + MaintainSlave *slavePtr = (MaintainSlave *)clientData; if (eventPtr->type == DestroyNotify) { Tk_UnmaintainGeometry(slavePtr->slave, slavePtr->master); @@ -746,7 +746,7 @@ MaintainCheckProc( ClientData clientData) /* Pointer to MaintainMaster structure for the * master window. */ { - MaintainMaster *masterPtr = clientData; + MaintainMaster *masterPtr = (MaintainMaster *)clientData; MaintainSlave *slavePtr; Tk_Window ancestor, parent; int x, y, map; diff --git a/generic/tkGet.c b/generic/tkGet.c index 6eff3a3..7ca4d17 100644 --- a/generic/tkGet.c +++ b/generic/tkGet.c @@ -493,10 +493,11 @@ Tk_NameOfJustify( static void FreeUidThreadExitProc( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { - ThreadSpecificData *tsdPtr = - Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteHashTable(&tsdPtr->uidTable); tsdPtr->initialized = 0; @@ -529,7 +530,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 6cab469..6de6865 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -223,7 +223,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 +239,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 +265,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 +294,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 +311,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 +327,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 +344,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 +638,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 +684,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; @@ -907,14 +907,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 +995,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 +1188,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 +1278,7 @@ GrabRestrictProc( ClientData arg, XEvent *eventPtr) { - GrabInfo *info = arg; + GrabInfo *info = (GrabInfo *)arg; int mode, diff; /* @@ -1336,7 +1336,7 @@ QueueGrabWindowChange( { NewGrabWinEvent *grabEvPtr; - grabEvPtr = ckalloc(sizeof(NewGrabWinEvent)); + grabEvPtr = (NewGrabWinEvent *)ckalloc(sizeof(NewGrabWinEvent)); grabEvPtr->header.proc = GrabWinEventProc; grabEvPtr->dispPtr = dispPtr; if (grabWinPtr == NULL) { @@ -1376,6 +1376,7 @@ GrabWinEventProc( * right now. */ { NewGrabWinEvent *grabEvPtr = (NewGrabWinEvent *) evPtr; + (void)flags; grabEvPtr->dispPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow( grabEvPtr->dispPtr->display, grabEvPtr->grabWindow); @@ -1416,7 +1417,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/tkGrid.c b/generic/tkGrid.c index 62a0447..b60ed69 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -335,7 +335,7 @@ Tk_GridObjCmd( 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[] = { "anchor", "bbox", "columnconfigure", "configure", "forget", "info", "location", "propagate", "remove", @@ -720,7 +720,7 @@ GridInfoCommand( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Gridder *slavePtr; + Gridder *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -785,7 +785,7 @@ GridLocationCommand( Tk_Window master; Gridder *masterPtr; /* Master grid record. */ GridMaster *gridPtr; /* Pointer to grid data. */ - register SlotInfo *slotPtr; + SlotInfo *slotPtr; int x, y; /* Offset in pixels, from edge of master. */ int i, j; /* Corresponding column and row indeces. */ int endX, endY; /* End of grid. */ @@ -1431,7 +1431,8 @@ GridReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; + (void)tkwin; gridPtr = gridPtr->masterPtr; if (gridPtr && !(gridPtr->flags & REQUESTED_RELAYOUT)) { @@ -1463,7 +1464,8 @@ GridLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Gridder *slavePtr = clientData; + Gridder *slavePtr = (Gridder *)clientData; + (void)tkwin; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -1496,9 +1498,9 @@ static int AdjustOffsets( int size, /* The total layout size (in pixels). */ int slots, /* Number of slots. */ - register SlotInfo *slotPtr) /* Pointer to slot array. */ + SlotInfo *slotPtr) /* Pointer to slot array. */ { - register int slot; /* Current slot. */ + int slot; /* Current slot. */ int diff; /* Extra pixels needed to add to the layout. */ int totalWeight; /* Sum of the weights for all the slots. */ int weight; /* Sum of the weights so far. */ @@ -1721,8 +1723,8 @@ ArrangeGrid( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Gridder *masterPtr = clientData; - register Gridder *slavePtr; + Gridder *masterPtr = (Gridder *)clientData; + Gridder *slavePtr; GridMaster *slotPtr = masterPtr->masterDataPtr; int abort; int width, height; /* Requested size of layout, in pixels. */ @@ -1902,8 +1904,8 @@ ResolveConstraints( int maxOffset) /* The actual maximum size of this layout in * pixels, or 0 (not currently used). */ { - register SlotInfo *slotPtr; /* Pointer to row/col constraints. */ - register Gridder *slavePtr; /* List of slave windows in this grid. */ + SlotInfo *slotPtr; /* Pointer to row/col constraints. */ + Gridder *slavePtr; /* List of slave windows in this grid. */ int constraintCount; /* Count of rows or columns that have * constraints. */ int slotCount; /* Last occupied row or column. */ @@ -1955,7 +1957,7 @@ ResolveConstraints( gridCount = MAX(constraintCount, slotCount); if (gridCount >= TYPICAL_SIZE) { - layoutPtr = ckalloc(sizeof(GridLayout) * (1+gridCount)); + layoutPtr = (GridLayout *)ckalloc(sizeof(GridLayout) * (1+gridCount)); } else { layoutPtr = layoutData; } @@ -2077,7 +2079,7 @@ ResolveConstraints( * sizeof(UniformGroup); size_t newSize = (uniformGroupsAlloced + UNIFORM_PREALLOC) * sizeof(UniformGroup); - UniformGroup *newUG = ckalloc(newSize); + UniformGroup *newUG = (UniformGroup *)ckalloc(newSize); UniformGroup *oldUG = uniformGroupPtr; memcpy(newUG, oldUG, oldSize); @@ -2421,7 +2423,7 @@ GetGrid( Tk_Window tkwin) /* Token for window for which grid structure * is desired. */ { - register Gridder *gridPtr; + Gridder *gridPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -2438,9 +2440,9 @@ GetGrid( hPtr = Tcl_CreateHashEntry(&dispPtr->gridHashTable, (char*) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Gridder *)Tcl_GetHashValue(hPtr); } - gridPtr = ckalloc(sizeof(Gridder)); + gridPtr = (Gridder *)ckalloc(sizeof(Gridder)); gridPtr->tkwin = tkwin; gridPtr->masterPtr = NULL; gridPtr->masterDataPtr = NULL; @@ -2494,7 +2496,7 @@ static void SetGridSize( Gridder *masterPtr) /* The geometry master for this grid. */ { - register Gridder *slavePtr; /* Current slave window. */ + Gridder *slavePtr; /* Current slave window. */ int maxX = 0, maxY = 0; for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; @@ -2650,7 +2652,7 @@ CheckSlotData( int newNumSlot = slot + PREALLOC; size_t oldSize = numSlot * sizeof(SlotInfo); size_t newSize = newNumSlot * sizeof(SlotInfo); - SlotInfo *newSI = ckalloc(newSize); + SlotInfo *newSI = (SlotInfo *)ckalloc(newSize); SlotInfo *oldSI = (slotType == ROW) ? masterPtr->masterDataPtr->rowPtr : masterPtr->masterDataPtr->columnPtr; @@ -2700,17 +2702,17 @@ InitMasterData( Gridder *masterPtr) { if (masterPtr->masterDataPtr == NULL) { - GridMaster *gridPtr = masterPtr->masterDataPtr = + GridMaster *gridPtr = masterPtr->masterDataPtr = (GridMaster *) ckalloc(sizeof(GridMaster)); size_t size = sizeof(SlotInfo) * TYPICAL_SIZE; gridPtr->columnEnd = 0; gridPtr->columnMax = 0; - gridPtr->columnPtr = ckalloc(size); + gridPtr->columnPtr = (SlotInfo *)ckalloc(size); gridPtr->columnSpace = TYPICAL_SIZE; gridPtr->rowEnd = 0; gridPtr->rowMax = 0; - gridPtr->rowPtr = ckalloc(size); + gridPtr->rowPtr = (SlotInfo *)ckalloc(size); gridPtr->rowSpace = TYPICAL_SIZE; gridPtr->startX = 0; gridPtr->startY = 0; @@ -2740,9 +2742,9 @@ InitMasterData( static void Unlink( - register Gridder *slavePtr) /* Window to unlink. */ + Gridder *slavePtr) /* Window to unlink. */ { - register Gridder *masterPtr, *slavePtr2; + Gridder *masterPtr, *slavePtr2; masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { @@ -2812,7 +2814,7 @@ static void DestroyGrid( void *memPtr) /* Info about window that is now dead. */ { - register Gridder *gridPtr = memPtr; + Gridder *gridPtr = (Gridder *)memPtr; if (gridPtr->masterDataPtr != NULL) { if (gridPtr->masterDataPtr->rowPtr != NULL) { @@ -2853,7 +2855,7 @@ GridStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Gridder *gridPtr = clientData; + Gridder *gridPtr = (Gridder *)clientData; TkDisplay *dispPtr = ((TkWindow *) gridPtr->tkwin)->dispPtr; if (eventPtr->type == ConfigureNotify) { @@ -2871,7 +2873,7 @@ GridStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Gridder *slavePtr, *nextPtr; + Gridder *slavePtr, *nextPtr; if (gridPtr->masterPtr != NULL) { Unlink(gridPtr); @@ -2898,7 +2900,7 @@ GridStructureProc( Tcl_DoWhenIdle(ArrangeGrid, gridPtr); } } else if (eventPtr->type == UnmapNotify) { - register Gridder *slavePtr; + Gridder *slavePtr; for (slavePtr = gridPtr->slavePtr; slavePtr != NULL; slavePtr = slavePtr->nextPtr) { diff --git a/generic/tkImage.c b/generic/tkImage.c index ca00d44..afb6f43 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -104,11 +104,12 @@ static void EventuallyDeleteImage(ImageMaster *masterPtr, static void ImageTypeThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { Tk_ImageType *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; while (tsdPtr->oldImageTypeList != NULL) { freePtr = tsdPtr->oldImageTypeList; @@ -149,14 +150,14 @@ Tk_CreateOldImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->oldImageTypeList; tsdPtr->oldImageTypeList = copyPtr; @@ -170,14 +171,14 @@ Tk_CreateImageType( * by caller. */ { Tk_ImageType *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(ImageTypeThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_ImageType)); + copyPtr = (Tk_ImageType *)ckalloc(sizeof(Tk_ImageType)); *copyPtr = *typePtr; copyPtr->nextPtr = tsdPtr->imageTypeList; tsdPtr->imageTypeList = copyPtr; @@ -215,7 +216,7 @@ Tk_ImageObjCmd( IMAGE_CREATE, IMAGE_DELETE, IMAGE_HEIGHT, IMAGE_INUSE, IMAGE_NAMES, IMAGE_TYPE, IMAGE_TYPES, IMAGE_WIDTH }; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; int i, isNew, firstOption, index; Tk_ImageType *typePtr; ImageMaster *masterPtr; @@ -226,7 +227,7 @@ Tk_ImageObjCmd( TkDisplay *dispPtr = winPtr->dispPtr; const char *arg, *name; Tcl_Obj *resultObj; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -318,7 +319,7 @@ Tk_ImageObjCmd( hPtr = Tcl_CreateHashEntry(&winPtr->mainPtr->imageTable, name, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(ImageMaster)); + masterPtr = (ImageMaster *)ckalloc(sizeof(ImageMaster)); masterPtr->typePtr = NULL; masterPtr->masterData = NULL; masterPtr->width = masterPtr->height = 1; @@ -335,7 +336,7 @@ Tk_ImageObjCmd( * from the master. */ - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->typePtr != NULL) { for (imagePtr = masterPtr->instancePtr; imagePtr != NULL; imagePtr = imagePtr->nextPtr) { @@ -363,7 +364,7 @@ Tk_ImageObjCmd( if (oldimage) { int i; - args = ckalloc((objc+1) * sizeof(char *)); + args = (Tcl_Obj **)ckalloc((objc+1) * sizeof(Tcl_Obj *)); for (i = 0; i < objc; i++) { args[i] = (Tcl_Obj *) Tcl_GetString(objv[i]); } @@ -390,7 +391,7 @@ Tk_ImageObjCmd( masterPtr->masterData); } Tcl_SetObjResult(interp, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); break; } case IMAGE_DELETE: @@ -400,7 +401,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -415,12 +416,12 @@ Tk_ImageObjCmd( hPtr = Tcl_FirstHashEntry(&winPtr->mainPtr->imageTable, &search); resultObj = Tcl_NewObj(); for ( ; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { continue; } Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); break; @@ -463,7 +464,7 @@ Tk_ImageObjCmd( if (hPtr == NULL) { goto alreadyDeleted; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { goto alreadyDeleted; } @@ -572,7 +573,7 @@ Tk_NameOfImage( if (masterPtr->hPtr == NULL) { return NULL; } - return Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr); + return (const char *)Tcl_GetHashKey(masterPtr->tablePtr, masterPtr->hPtr); } /* @@ -617,14 +618,14 @@ Tk_GetImage( if (hPtr == NULL) { goto noSuchImage; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->typePtr == NULL) { goto noSuchImage; } if (masterPtr->deleted) { goto noSuchImage; } - imagePtr = ckalloc(sizeof(Image)); + imagePtr = (Image *)ckalloc(sizeof(Image)); imagePtr->tkwin = tkwin; imagePtr->display = Tk_Display(tkwin); imagePtr->masterPtr = masterPtr; @@ -933,7 +934,7 @@ Tk_DeleteImage( if (hPtr == NULL) { return; } - DeleteImage(Tcl_GetHashValue(hPtr)); + DeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr)); } /* @@ -1045,7 +1046,7 @@ TkDeleteAllImages( for (hPtr = Tcl_FirstHashEntry(&mainPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - EventuallyDeleteImage(Tcl_GetHashValue(hPtr), 1); + EventuallyDeleteImage((ImageMaster *)Tcl_GetHashValue(hPtr), 1); } Tcl_DeleteHashTable(&mainPtr->imageTable); } @@ -1088,7 +1089,7 @@ Tk_GetImageMasterData( *typePtrPtr = NULL; return NULL; } - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (ImageMaster *)Tcl_GetHashValue(hPtr); if (masterPtr->deleted) { *typePtrPtr = NULL; return NULL; diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index f83f4cc..a47cfab 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -184,7 +184,8 @@ ImgBmapCreate( ClientData *clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { - BitmapMaster *masterPtr = ckalloc(sizeof(BitmapMaster)); + BitmapMaster *masterPtr = (BitmapMaster *)ckalloc(sizeof(BitmapMaster)); + (void)typePtr; masterPtr->tkMaster = master; masterPtr->interp = interp; @@ -239,7 +240,7 @@ ImgBmapConfigureMaster( { BitmapInstance *instancePtr; int maskWidth, maskHeight, dummy1, dummy2; - const char **argv = ckalloc((objc+1) * sizeof(char *)); + const char **argv = (const char **)ckalloc((objc+1) * sizeof(char *)); for (dummy1 = 0; dummy1 < objc; dummy1++) { argv[dummy1] = Tcl_GetString(objv[dummy1]); @@ -620,7 +621,7 @@ TkGetBitmapData( goto error; } numBytes = ((width+7)/8) * height; - data = ckalloc(numBytes); + data = (char *)ckalloc(numBytes); for (p = data; numBytes > 0; p++, numBytes--) { if (NextBitmapWord(&pi) != TCL_OK) { goto error; @@ -757,7 +758,7 @@ ImgBmapCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const bmapOptions[] = {"cget", "configure", NULL}; - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; int index; if (objc < 2) { @@ -819,7 +820,7 @@ ImgBmapGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - BitmapMaster *masterPtr = masterData; + BitmapMaster *masterPtr = (BitmapMaster *)masterData; BitmapInstance *instancePtr; /* @@ -840,7 +841,7 @@ ImgBmapGet( * the image. */ - instancePtr = ckalloc(sizeof(BitmapInstance)); + instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance)); instancePtr->refCount = 1; instancePtr->masterPtr = masterPtr; instancePtr->tkwin = tkwin; @@ -894,7 +895,7 @@ ImgBmapDisplay( /* Coordinates within drawable that correspond * to imageX and imageY. */ { - BitmapInstance *instancePtr = clientData; + BitmapInstance *instancePtr = (BitmapInstance *)clientData; int masking; /* @@ -948,7 +949,7 @@ ImgBmapFree( * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { - BitmapInstance *instancePtr = clientData; + BitmapInstance *instancePtr = (BitmapInstance *)clientData; BitmapInstance *prevPtr; if (instancePtr->refCount-- > 1) { @@ -1009,7 +1010,7 @@ ImgBmapDelete( ClientData masterData) /* Pointer to BitmapMaster structure for * image. Must not have any more instances. */ { - BitmapMaster *masterPtr = masterData; + BitmapMaster *masterPtr = (BitmapMaster *)masterData; if (masterPtr->instancePtr != NULL) { Tcl_Panic("tried to delete bitmap image when instances still exist"); @@ -1050,7 +1051,7 @@ ImgBmapCmdDeletedProc( ClientData clientData) /* Pointer to BitmapMaster structure for * image. */ { - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -1197,7 +1198,7 @@ ImgBmapPostscript( int x, int y, int width, int height, int prepass) { - BitmapMaster *masterPtr = clientData; + BitmapMaster *masterPtr = (BitmapMaster *)clientData; Tcl_InterpState interpState; Tcl_Obj *psObj; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index c16ca11..cece744 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -351,9 +351,12 @@ FileMatchGIF( int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here if the file is a valid raw GIF file. */ - Tcl_Interp *interp) /* not used */ + Tcl_Interp *dummy) /* not used */ { GIFImageConfig gifConf; + (void)fileName; + (void)format; + (void)dummy; memset(&gifConf, 0, sizeof(GIFImageConfig)); return ReadGIFHeader(&gifConf, chan, widthPtr, heightPtr); @@ -597,7 +600,7 @@ FileReadGIF( goto error; } nBytes = fileWidth * fileHeight * 3; - trashBuffer = ckalloc(nBytes); + trashBuffer = (unsigned char *)ckalloc(nBytes); if (trashBuffer) { memset(trashBuffer, 0, nBytes); } @@ -692,7 +695,7 @@ FileReadGIF( goto error; } nBytes = block.pitch * imageHeight; - block.pixelPtr = ckalloc(nBytes); + block.pixelPtr = (unsigned char *)ckalloc(nBytes); if (block.pixelPtr) { memset(block.pixelPtr, 0, nBytes); } @@ -754,11 +757,13 @@ StringMatchGIF( Tcl_Obj *format, /* the image format object, or NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ - Tcl_Interp *interp) /* not used */ + Tcl_Interp *dummy) /* not used */ { unsigned char *data, header[10]; TkSizeT got, length; MFile handle; + (void)format; + (void)dummy; data = TkGetByteArrayFromObj(dataObj, &length); @@ -1035,15 +1040,17 @@ ReadImage( { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i, count; - register unsigned char *pixelPtr; + unsigned char *pixelPtr; static const int interlaceStep[] = { 8, 8, 4, 2 }; static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; - register unsigned char *top; + unsigned char *top; int codeSize, clearCode, inCode, endCode, oldCode, maxCode; int code, firstCode, v; + (void)srcX; + (void)srcY; /* * Initialize the decoder @@ -1679,7 +1686,7 @@ WriteToChannel( const char *bytes, size_t byteCount) { - Tcl_Channel handle = clientData; + Tcl_Channel handle = (Tcl_Channel)clientData; return Tcl_Write(handle, bytes, byteCount); } @@ -1690,7 +1697,7 @@ WriteToByteArray( const char *bytes, size_t byteCount) { - Tcl_Obj *objPtr = clientData; + Tcl_Obj *objPtr = (Tcl_Obj *)clientData; Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount); Tcl_IncrRefCount(tmpObj); @@ -1712,6 +1719,7 @@ CommonWriteGIF( long width, height, x; unsigned char c; unsigned int top, left; + (void)format; top = 0; left = 0; @@ -2157,9 +2165,9 @@ ClearHashTable( /* Reset code table. */ GIFState_t *statePtr, int hSize) { - register int *hashTablePtr = statePtr->hashTable + hSize; - register long i; - register long m1 = -1; + int *hashTablePtr = statePtr->hashTable + hSize; + long i; + long m1 = -1; i = hSize - 16; do { /* might use Sys V memset(3) here */ diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index 2b23699..70efc96 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -196,7 +196,8 @@ ParseFormatOptions( * this struct */ { - int index, optIndex, typeIndex, first; + int index, optIndex, first; + enum ColorFormatType typeIndex; const char *option; first = 1; @@ -257,7 +258,7 @@ ParseFormatOptions( return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", - TCL_EXACT, &typeIndex) != TCL_OK + TCL_EXACT, (int *)&typeIndex) != TCL_OK || (typeIndex != COLORFORMAT_LIST && typeIndex != COLORFORMAT_RGB2 && typeIndex != COLORFORMAT_RGBA2) ) { @@ -366,6 +367,7 @@ StringMatchDef( int y, rowCount, colCount, curColCount; unsigned char dummy; Tcl_Obj **rowListPtr, *pixelData; + (void)formatString; /* * See if data can be parsed as a list, if every element is itself a valid @@ -550,7 +552,7 @@ StringReadDef( srcBlock.offset[1] = 1; srcBlock.offset[2] = 2; srcBlock.offset[3] = 3; - srcBlock.pixelPtr = attemptckalloc(srcBlock.pitch * srcBlock.height); + srcBlock.pixelPtr = (unsigned char *)attemptckalloc(srcBlock.pitch * srcBlock.height); if (srcBlock.pixelPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); @@ -837,7 +839,7 @@ ParseColor( */ static int ParseColorAsList( - Tcl_Interp *interp, /* not used */ + Tcl_Interp *dummy, /* not used */ const char *colorString, /* the color data to parse */ int colorStrLen, /* length of the color string */ unsigned char *redPtr, /* the result is written to these pointers */ @@ -845,7 +847,6 @@ ParseColorAsList( unsigned char *bluePtr, unsigned char *alphaPtr) { - /* * This is kinda ugly. The code would be certainly nicer if it * used Tcl_ListObjGetElements() and Tcl_GetIntFromObj(). But with @@ -855,6 +856,8 @@ ParseColorAsList( const char *curPos; int values[4]; int i; + (void)dummy; + (void)colorStrLen; curPos = colorString; i = 0; @@ -864,7 +867,7 @@ ParseColorAsList( * To avoid that, avance the pointer to the next non-blank char. */ - while(isspace(*curPos)) { + while(isspace(UCHAR(*curPos))) { ++curPos; } while (i < 4 && *curPos != '\0') { @@ -872,7 +875,7 @@ ParseColorAsList( if (values[i] < 0 || values[i] > 255) { return TCL_ERROR; } - while(isspace(*curPos)) { + while(isspace(UCHAR(*curPos))) { ++curPos; } ++i; diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 3331d3d..0c62b58 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -2237,14 +2237,14 @@ ApplyAlpha( PNGImage *pngPtr) { if (pngPtr->alpha != 1.0) { - register unsigned char *p = pngPtr->block.pixelPtr; + unsigned char *p = pngPtr->block.pixelPtr; unsigned char *endPtr = p + pngPtr->blockLen; int offset = pngPtr->block.offset[3]; p += offset; if (16 == pngPtr->bitDepth) { - register unsigned int channel; + unsigned int channel; while (p < endPtr) { channel = (unsigned int) @@ -2520,7 +2520,7 @@ DecodePNG( pngPtr->thisLineObj = Tcl_NewObj(); Tcl_IncrRefCount(pngPtr->thisLineObj); - pngPtr->block.pixelPtr = attemptckalloc(pngPtr->blockLen); + pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", -1)); @@ -2676,6 +2676,8 @@ FileMatchPNG( { PNGImage png; int match = 0; + (void)fileName; + (void)fmtObj; InitPNGImage(NULL, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); @@ -2725,6 +2727,11 @@ FileReadPNG( { PNGImage png; int result = TCL_ERROR; + (void)fileName; + (void)width; + (void)height; + (void)srcX; + (void)srcY; result = InitPNGImage(interp, &png, chan, NULL, TCL_ZLIB_STREAM_INFLATE); @@ -2764,6 +2771,7 @@ StringMatchPNG( { PNGImage png; int match = 0; + (void)fmtObj; InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); @@ -2812,6 +2820,10 @@ StringReadPNG( { PNGImage png; int result = TCL_ERROR; + (void)width; + (void)height; + (void)srcX; + (void)srcY; result = InitPNGImage(interp, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); @@ -3459,6 +3471,7 @@ FileWritePNG( Tcl_Channel chan; PNGImage png; int result = TCL_ERROR; + (void)fmtObj; /* * Open a Tcl file channel where the image data will be stored. Tk ought @@ -3529,6 +3542,7 @@ StringWritePNG( Tcl_Obj *resultObj = Tcl_NewObj(); PNGImage png; int result = TCL_ERROR; + (void)fmtObj; /* * Initalize PNGImage instance for encoding. diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index ea49fc2..91d809b 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -103,6 +103,9 @@ FileMatchPPM( Tcl_Interp *interp) /* unused */ { int dummy; + (void)fileName; + (void)format; + (void)interp; return ReadPPMFileHeader(chan, widthPtr, heightPtr, &dummy); } @@ -145,6 +148,7 @@ FileReadPPM( size_t nBytes, count; unsigned char *pixelPtr; Tk_PhotoImageBlock block; + (void)format; type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity); if (type == 0) { @@ -212,7 +216,7 @@ FileReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { @@ -290,6 +294,7 @@ FileWritePPM( size_t nBytes; unsigned char *pixelPtr, *pixLinePtr; char header[16 + TCL_INTEGER_SPACE * 2]; + (void)format; chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666); if (chan == NULL) { @@ -377,6 +382,7 @@ StringWritePPM( unsigned char *pixLinePtr, *byteArray; char header[16 + TCL_INTEGER_SPACE * 2]; Tcl_Obj *byteArrayObj; + (void)format; sprintf(header, "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); @@ -454,6 +460,8 @@ StringMatchPPM( Tcl_Interp *interp) /* unused */ { int dummy; + (void)format; + (void)interp; return ReadPPMStringHeader(dataObj, widthPtr, heightPtr, &dummy, NULL, NULL); @@ -494,6 +502,7 @@ StringReadPPM( int nLines, nBytes, h, type, count, dataSize, bytesPerChannel = 1; unsigned char *pixelPtr, *dataBuffer; Tk_PhotoImageBlock block; + (void)format; type = ReadPPMStringHeader(dataObj, &fileWidth, &fileHeight, &maxIntensity, &dataBuffer, &dataSize); @@ -580,7 +589,7 @@ StringReadPPM( nLines = 1; } nBytes = nLines * block.pitch; - pixelPtr = ckalloc(nBytes); + pixelPtr = (unsigned char *)ckalloc(nBytes); block.pixelPtr = pixelPtr + srcX * block.pixelSize; for (h = height; h > 0; h -= nLines) { diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index fde868b..81b196c 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -26,8 +26,15 @@ /* * Declaration for internal Xlib function used here: */ - +#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MAC_OSX_TK) +#ifdef __cplusplus +extern "C" { +#endif extern int _XInitImageFuncPtrs(XImage *image); +#ifdef __cplusplus +} +#endif +#endif /* * Forward declarations @@ -212,7 +219,7 @@ TkImgPhotoGet( ClientData masterData) /* Pointer to our master structure for the * image. */ { - PhotoMaster *masterPtr = masterData; + PhotoMaster *masterPtr = (PhotoMaster *)masterData; PhotoInstance *instancePtr; Colormap colormap; int mono, nRed, nGreen, nBlue, numVisuals; @@ -278,7 +285,7 @@ TkImgPhotoGet( * a new instance of the image. */ - instancePtr = ckalloc(sizeof(PhotoInstance)); + instancePtr = (PhotoInstance *)ckalloc(sizeof(PhotoInstance)); instancePtr->masterPtr = masterPtr; instancePtr->display = Tk_Display(tkwin); instancePtr->colormap = Tk_Colormap(tkwin); @@ -611,7 +618,7 @@ TkImgPhotoDisplay( int drawableX,int drawableY)/* Coordinates within drawable that correspond * to imageX and imageY. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; #ifndef TKPUTIMAGE_CAN_BLEND XVisualInfo visInfo = instancePtr->visualInfo; #endif @@ -729,8 +736,9 @@ TkImgPhotoFree( Display *display) /* Display containing window that used * image. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; ColorTable *colorPtr; + (void)display; if (instancePtr->refCount-- > 1) { return; @@ -829,7 +837,7 @@ TkImgPhotoInstanceSetSize( * such possibility. */ - newError = ckalloc(masterPtr->height * masterPtr->width + newError = (schar *)ckalloc(masterPtr->height * masterPtr->width * 3 * sizeof(schar)); /* @@ -1058,13 +1066,13 @@ GetColorTable( * Re-use the existing entry. */ - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); } else { /* * No color table currently available; need to make one. */ - colorPtr = ckalloc(sizeof(ColorTable)); + colorPtr = (ColorTable *)ckalloc(sizeof(ColorTable)); /* * The following line of code should not normally be needed due to the @@ -1225,7 +1233,7 @@ AllocateColors( } else { numColors = MAX(MAX(nRed, nGreen), nBlue); } - colors = ckalloc(numColors * sizeof(XColor)); + colors = (XColor *)ckalloc(numColors * sizeof(XColor)); for (i = 0; i < numColors; ++i) { if (igam == 1.0) { @@ -1245,7 +1253,7 @@ AllocateColors( */ numColors = (mono) ? nRed: (nRed * nGreen * nBlue); - colors = ckalloc(numColors * sizeof(XColor)); + colors = (XColor *)ckalloc(numColors * sizeof(XColor)); if (!mono) { /* @@ -1289,7 +1297,7 @@ AllocateColors( * Now try to allocate the colors we've calculated. */ - pixels = ckalloc(numColors * sizeof(unsigned long)); + pixels = (unsigned long *)ckalloc(numColors * sizeof(unsigned long)); for (i = 0; i < numColors; ++i) { if (!XAllocColor(colorPtr->id.display, colorPtr->id.colormap, &colors[i])) { @@ -1449,7 +1457,7 @@ DisposeColorTable( ClientData clientData) /* Pointer to the ColorTable whose * colors are to be released. */ { - ColorTable *colorPtr = clientData; + ColorTable *colorPtr = (ColorTable *)clientData; Tcl_HashEntry *entry; if (colorPtr->pixelMap != NULL) { @@ -1509,7 +1517,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while (entry != NULL) { - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0 )&& (colorPtr->numColors != 0) @@ -1538,7 +1546,7 @@ ReclaimColors( entry = Tcl_FirstHashEntry(&imgPhotoColorHash, &srch); while ((entry != NULL) && (numColors > 0)) { - colorPtr = Tcl_GetHashValue(entry); + colorPtr = (ColorTable *)Tcl_GetHashValue(entry); if ((colorPtr->id.display == id->display) && (colorPtr->id.colormap == id->colormap) && (colorPtr->liveRefCount == 0) && (colorPtr->numColors != 0) @@ -1583,7 +1591,7 @@ TkImgDisposeInstance( ClientData clientData) /* Pointer to the instance whose resources are * to be released. */ { - PhotoInstance *instancePtr = clientData; + PhotoInstance *instancePtr = (PhotoInstance *)clientData; PhotoInstance *prevPtr; if (instancePtr->pixels != None) { @@ -1693,7 +1701,7 @@ TkImgDitherInstance( * recovering from the failure. */ - imagePtr->data = ckalloc(imagePtr->bytes_per_line * nLines); + imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * nLines); bigEndian = imagePtr->bitmap_bit_order == MSBFirst; firstBit = bigEndian? (1 << (imagePtr->bitmap_unit - 1)): 1; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 23ee142..c821b81 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -219,11 +219,12 @@ static const char * GetExtension(const char *path); static void PhotoFormatThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { Tk_PhotoImageFormat *freePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; while (tsdPtr->oldFormatList != NULL) { freePtr = tsdPtr->oldFormatList; @@ -265,14 +266,14 @@ Tk_CreateOldPhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; @@ -286,21 +287,21 @@ Tk_CreatePhotoImageFormat( * by caller. */ { Tk_PhotoImageFormat *copyPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { tsdPtr->initialized = 1; Tcl_CreateThreadExitHandler(PhotoFormatThreadExitProc, NULL); } - copyPtr = ckalloc(sizeof(Tk_PhotoImageFormat)); + copyPtr = (Tk_PhotoImageFormat *)ckalloc(sizeof(Tk_PhotoImageFormat)); *copyPtr = *formatPtr; if (isupper((unsigned char) *formatPtr->name)) { copyPtr->nextPtr = tsdPtr->oldFormatList; tsdPtr->oldFormatList = copyPtr; } else { /* for compatibility with aMSN: make a copy of formatPtr->name */ - char *name = ckalloc(strlen(formatPtr->name) + 1); + char *name = (char *)ckalloc(strlen(formatPtr->name) + 1); strcpy(name, formatPtr->name); copyPtr->name = name; copyPtr->nextPtr = tsdPtr->formatList; @@ -340,12 +341,13 @@ ImgPhotoCreate( * will be returned in later callbacks. */ { PhotoMaster *masterPtr; + (void)typePtr; /* * Allocate and initialize the photo image master record. */ - masterPtr = ckalloc(sizeof(PhotoMaster)); + masterPtr = (PhotoMaster *)ckalloc(sizeof(PhotoMaster)); memset(masterPtr, 0, sizeof(PhotoMaster)); masterPtr->tkMaster = master; masterPtr->interp = interp; @@ -404,7 +406,7 @@ ImgPhotoCmd( PHOTO_WRITE }; - PhotoMaster *masterPtr = clientData; + PhotoMaster *masterPtr = (PhotoMaster *)clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; @@ -414,7 +416,7 @@ ImgPhotoCmd( int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -768,7 +770,7 @@ ImgPhotoCmd( Tk_PhotoImageBlock *blockPtr); Tcl_DStringInit(&buffer); - result = ((OldStringWriteProc) stringWriteProc)(interp, &buffer, + result = ((OldStringWriteProc)(void *)stringWriteProc)(interp, &buffer, Tcl_GetString(options.format), &block); if (result == TCL_OK) { Tcl_DStringResult(interp, &buffer); @@ -780,7 +782,7 @@ ImgPhotoCmd( Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr, void *dummy); - result = ((NewStringWriteProc) stringWriteProc)(interp, + result = ((NewStringWriteProc)(void *)stringWriteProc)(interp, options.format, &block, NULL); } if (options.background) { @@ -1765,7 +1767,7 @@ ImgPhotoConfigureMaster( Tk_PhotoImageFormat *imageFormat; const char **args; - args = ckalloc((objc + 1) * sizeof(char *)); + args = (const char **)ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = TkGetStringFromObj(objv[i], &length); if ((length > 1) && (args[j][0] == '-')) { @@ -2105,7 +2107,7 @@ ImgPhotoDelete( ClientData masterData) /* Pointer to PhotoMaster structure for image. * Must not have any more instances. */ { - PhotoMaster *masterPtr = masterData; + PhotoMaster *masterPtr = (PhotoMaster *)masterData; PhotoInstance *instancePtr; while ((instancePtr = masterPtr->instancePtr) != NULL) { @@ -2157,7 +2159,7 @@ ImgPhotoCmdDeletedProc( ClientData clientData) /* Pointer to PhotoMaster structure for * image. */ { - PhotoMaster *masterPtr = clientData; + PhotoMaster *masterPtr = (PhotoMaster *)clientData; masterPtr->imageCmd = NULL; if (masterPtr->tkMaster != NULL) { @@ -2230,7 +2232,7 @@ ImgPhotoSetSize( if (newPixSize == 0) { newPix32 = NULL; } else { - newPix32 = attemptckalloc(newPixSize); + newPix32 = (unsigned char *)attemptckalloc(newPixSize); if (newPix32 == NULL) { return TCL_ERROR; } @@ -2393,7 +2395,7 @@ MatchFileFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2533,7 +2535,7 @@ MatchStringFormat( { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr, *defaultFormatPtr = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; @@ -2743,7 +2745,7 @@ Tk_PhotoPutBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; + PhotoMaster *masterPtr = (PhotoMaster *) handle; Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; @@ -2791,7 +2793,7 @@ Tk_PhotoPutBlock( if (sourceBlock.pixelPtr >= masterPtr->pix32 && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width * masterPtr->height * 4) { - sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height * sourceBlock.pitch); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { @@ -3084,10 +3086,10 @@ Tk_PhotoPutBlock( */ if (!(masterPtr->flags & COMPLEX_ALPHA)) { - register int x1; + int x1; for (x1=x ; x1<x+width ; x1++) { - register unsigned char newAlpha; + unsigned char newAlpha; destLinePtr = masterPtr->pix32 + (y*masterPtr->width + x1)*4; newAlpha = destLinePtr[3]; @@ -3169,8 +3171,8 @@ Tk_PhotoPutZoomedBlock( int compRule) /* Compositing rule to use when processing * transparent pixels. */ { - register PhotoMaster *masterPtr = (PhotoMaster *) handle; - register Tk_PhotoImageBlock sourceBlock; + PhotoMaster *masterPtr = (PhotoMaster *) handle; + Tk_PhotoImageBlock sourceBlock; unsigned char *memToFree; int xEnd, yEnd, greenOffset, blueOffset, alphaOffset; int wLeft, hLeft, wCopy, hCopy, blockWid, blockHt; @@ -3225,7 +3227,7 @@ Tk_PhotoPutZoomedBlock( if (sourceBlock.pixelPtr >= masterPtr->pix32 && sourceBlock.pixelPtr <= masterPtr->pix32 + masterPtr->width * masterPtr->height * 4) { - sourceBlock.pixelPtr = attemptckalloc(sourceBlock.height + sourceBlock.pixelPtr = (unsigned char *)attemptckalloc(sourceBlock.height * sourceBlock.pitch); if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { @@ -3845,7 +3847,7 @@ ImgGetPhoto( if (blockPtr->height > (int)((UINT_MAX/newPixelSize)/blockPtr->width)) { return NULL; } - data = attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); + data = (char *)attemptckalloc(newPixelSize*blockPtr->width*blockPtr->height); if (data == NULL) { return NULL; } @@ -4027,6 +4029,8 @@ ImgPhotoPostscript( int prepass) /* (unused) */ { Tk_PhotoImageBlock block; + (void)tkwin; + (void)prepass; Tk_PhotoGetImage(clientData, &block); block.pixelPtr += y * block.pitch + x * block.pixelSize; diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index d51c211..7575f86 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -129,6 +129,7 @@ FileMatchSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage; + (void)fileName; CleanCache(interp); if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { @@ -187,6 +188,7 @@ FileReadSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); + (void)fileName; if (nsvgImage == NULL) { Tcl_Obj *dataObj = Tcl_NewObj(); @@ -343,7 +345,7 @@ ParseSVGWithOptions( * therefore first duplicate. */ - inputCopy = attemptckalloc(length+1); + inputCopy = (char *)attemptckalloc(length+1); if (inputCopy == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); @@ -517,6 +519,8 @@ RasterizeSVG( unsigned char *imgData; Tk_PhotoImageBlock svgblock; double scale; + (void)srcX; + (void)srcY; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); @@ -527,7 +531,7 @@ RasterizeSVG( NULL); goto cleanAST; } - imgData = attemptckalloc(w * h *4); + imgData = (unsigned char *)attemptckalloc(w * h *4); if (imgData == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); @@ -649,9 +653,9 @@ static NSVGcache * GetCachePtr( Tcl_Interp *interp ) { - NSVGcache *cachePtr = Tcl_GetAssocData(interp, "tksvgnano", NULL); + NSVGcache *cachePtr = (NSVGcache *)Tcl_GetAssocData(interp, "tksvgnano", NULL); if (cachePtr == NULL) { - cachePtr = ckalloc(sizeof(NSVGcache)); + cachePtr = (NSVGcache *)ckalloc(sizeof(NSVGcache)); cachePtr->dataOrChan = NULL; Tcl_DStringInit(&cachePtr->formatString); cachePtr->nsvgImage = NULL; @@ -794,7 +798,8 @@ CleanCache(Tcl_Interp *interp) static void FreeCache(ClientData clientData, Tcl_Interp *interp) { - NSVGcache *cachePtr = clientData; + NSVGcache *cachePtr = (NSVGcache *)clientData; + (void)interp; Tcl_DStringFree(&cachePtr->formatString); if (cachePtr->nsvgImage != NULL) { diff --git a/generic/tkImgUtil.c b/generic/tkImgUtil.c index 5487165..6a43fbe 100644 --- a/generic/tkImgUtil.c +++ b/generic/tkImgUtil.c @@ -55,7 +55,7 @@ TkAlignImageData( dataWidth += (alignment - (dataWidth % alignment)); } - data = ckalloc(dataWidth * image->height); + data = (char *)ckalloc(dataWidth * image->height); destPtr = data; for (i = 0; i < image->height; i++) { diff --git a/generic/tkInt.decls b/generic/tkInt.decls index 13928ca..afa8388 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -1556,8 +1556,13 @@ declare 155 win { declare 156 win { void XFreeStringList(char **list) } - - +declare 157 win { + KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i) +} +declare 158 win { + Display *XkbOpenDisplay(char *name, int *ev_rtrn, int *err_rtrn, + int *major_rtrn, int *minor_rtrn, int *reason) +} ################################ # X functions for MacOSX @@ -2048,6 +2053,13 @@ declare 155 macosx { declare 156 macosx { void XFreeStringList(char **list) } +declare 157 macosx { + KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, int i) +} +declare 158 macosx { + Display *XkbOpenDisplay(char *name, int *ev_rtrn, int *err_rtrn, + int *major_rtrn, int *minor_rtrn, int *reason) +} # Local Variables: # mode: tcl diff --git a/generic/tkInt.h b/generic/tkInt.h index be88296..5950757 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -58,6 +58,21 @@ # endif #endif +#ifndef JOIN +# define JOIN(a,b) JOIN1(a,b) +# define JOIN1(a,b) a##b +#endif + +#ifndef TCL_UNUSED +# if defined(__cplusplus) +# define TCL_UNUSED(T) T +# elif defined(__GNUC__) && (__GNUC__ > 2) +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) +# else +# define TCL_UNUSED(T) T JOIN(dummy, __LINE__) +# endif +#endif + #ifndef TkSizeT # if TCL_MAJOR_VERSION > 8 # define TkSizeT size_t @@ -67,8 +82,8 @@ #endif #if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 7) -# define Tcl_WCharToUtfDString Tcl_UniCharToUtfDString -# define Tcl_UtfToWCharDString Tcl_UtfToUniCharDString +# define Tcl_WCharToUtfDString ((char * (*)(const WCHAR *, int len, Tcl_DString *))Tcl_UniCharToUtfDString) +# define Tcl_UtfToWCharDString ((WCHAR * (*)(const char *, int len, Tcl_DString *))Tcl_UtfToUniCharDString) # define Tcl_Char16ToUtfDString Tcl_UniCharToUtfDString # define Tcl_UtfToChar16DString Tcl_UtfToUniCharDString #endif @@ -179,6 +194,8 @@ typedef struct TkCaret { * specific data, since each thread will have its own TkDisplay structure. */ +typedef enum TkLockUsage {LU_IGNORE, LU_CAPS, LU_SHIFT} TkLockUsage; + typedef struct TkDisplay { Display *display; /* Xlib's info about display. */ struct TkDisplay *nextPtr; /* Next in list of all displays. */ @@ -220,7 +237,7 @@ typedef struct TkDisplay { unsigned int altModMask; /* Has one bit set to indicate the modifier * corresponding to the "Meta" key. If no such * modifier, then this is zero. */ - enum {LU_IGNORE, LU_CAPS, LU_SHIFT} lockUsage; + TkLockUsage lockUsage; /* Indicates how to interpret lock * modifier. */ int numModKeyCodes; /* Number of entries in modKeyCodes array @@ -1330,6 +1347,8 @@ MODULE_SCOPE int TkListCreateFrame(ClientData clientData, MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); +MODULE_SCOPE int TkGetIntForIndex(Tcl_Obj *, TkSizeT, TkSizeT*); + #ifdef _WIN32 #define TkParseColor XParseColor diff --git a/generic/tkIntXlibDecls.h b/generic/tkIntXlibDecls.h index 83d3c0b..7f1560a 100644 --- a/generic/tkIntXlibDecls.h +++ b/generic/tkIntXlibDecls.h @@ -461,6 +461,13 @@ EXTERN XFontSet XCreateFontSet(Display *display, char **def_string); /* 156 */ EXTERN void XFreeStringList(char **list); +/* 157 */ +EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, + int i); +/* 158 */ +EXTERN Display * XkbOpenDisplay(char *name, int *ev_rtrn, + int *err_rtrn, int *major_rtrn, + int *minor_rtrn, int *reason); #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ /* 0 */ @@ -874,6 +881,13 @@ EXTERN XFontSet XCreateFontSet(Display *display, char **def_string); /* 156 */ EXTERN void XFreeStringList(char **list); +/* 157 */ +EXTERN KeySym XkbKeycodeToKeysym(Display *d, unsigned int k, int g, + int i); +/* 158 */ +EXTERN Display * XkbOpenDisplay(char *name, int *ev_rtrn, + int *err_rtrn, int *major_rtrn, + int *minor_rtrn, int *reason); #endif /* MACOSX */ typedef struct TkIntXlibStubs { @@ -1038,6 +1052,8 @@ typedef struct TkIntXlibStubs { char * (*xSetIMValues) (XIM im, ...); /* 154 */ XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */ void (*xFreeStringList) (char **list); /* 156 */ + KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */ + Display * (*xkbOpenDisplay) (char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ @@ -1197,6 +1213,8 @@ typedef struct TkIntXlibStubs { char * (*xSetIMValues) (XIM im, ...); /* 154 */ XFontSet (*xCreateFontSet) (Display *display, _Xconst char *base_font_name_list, char ***missing_charset_list, int *missing_charset_count, char **def_string); /* 155 */ void (*xFreeStringList) (char **list); /* 156 */ + KeySym (*xkbKeycodeToKeysym) (Display *d, unsigned int k, int g, int i); /* 157 */ + Display * (*xkbOpenDisplay) (char *name, int *ev_rtrn, int *err_rtrn, int *major_rtrn, int *minor_rtrn, int *reason); /* 158 */ #endif /* MACOSX */ } TkIntXlibStubs; @@ -1512,6 +1530,10 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xCreateFontSet) /* 155 */ #define XFreeStringList \ (tkIntXlibStubsPtr->xFreeStringList) /* 156 */ +#define XkbKeycodeToKeysym \ + (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */ +#define XkbOpenDisplay \ + (tkIntXlibStubsPtr->xkbOpenDisplay) /* 158 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ #define XSetDashes \ @@ -1813,6 +1835,10 @@ extern const TkIntXlibStubs *tkIntXlibStubsPtr; (tkIntXlibStubsPtr->xCreateFontSet) /* 155 */ #define XFreeStringList \ (tkIntXlibStubsPtr->xFreeStringList) /* 156 */ +#define XkbKeycodeToKeysym \ + (tkIntXlibStubsPtr->xkbKeycodeToKeysym) /* 157 */ +#define XkbOpenDisplay \ + (tkIntXlibStubsPtr->xkbOpenDisplay) /* 158 */ #endif /* MACOSX */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 546ae98..22e49bf 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -473,14 +473,15 @@ static const Tk_ClassProcs listboxClass = { int Tk_ListboxObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register Listbox *listPtr; + Listbox *listPtr; Tk_Window tkwin; ListboxOptionTables *optionTables; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -493,7 +494,7 @@ Tk_ListboxObjCmd( return TCL_ERROR; } - optionTables = Tcl_GetAssocData(interp, "ListboxOptionTables", NULL); + optionTables = (ListboxOptionTables *)Tcl_GetAssocData(interp, "ListboxOptionTables", NULL); if (optionTables == NULL) { /* * We haven't created the option tables for this widget class yet. Do @@ -501,7 +502,7 @@ Tk_ListboxObjCmd( * command, so future invocations will have access to it. */ - optionTables = ckalloc(sizeof(ListboxOptionTables)); + optionTables = (ListboxOptionTables *)ckalloc(sizeof(ListboxOptionTables)); /* * Set up an exit handler to free the optionTables struct. @@ -526,7 +527,7 @@ Tk_ListboxObjCmd( * already (e.g. resource pointers). */ - listPtr = ckalloc(sizeof(Listbox)); + listPtr = (Listbox *)ckalloc(sizeof(Listbox)); memset(listPtr, 0, sizeof(Listbox)); listPtr->tkwin = tkwin; @@ -537,9 +538,9 @@ Tk_ListboxObjCmd( ListboxCmdDeletedProc); listPtr->optionTable = optionTables->listboxOptionTable; listPtr->itemAttrOptionTable = optionTables->itemAttrOptionTable; - listPtr->selection = ckalloc(sizeof(Tcl_HashTable)); + listPtr->selection = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->selection, TCL_ONE_WORD_KEYS); - listPtr->itemAttrTable = ckalloc(sizeof(Tcl_HashTable)); + listPtr->itemAttrTable = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(listPtr->itemAttrTable, TCL_ONE_WORD_KEYS); listPtr->relief = TK_RELIEF_RAISED; listPtr->textGC = NULL; @@ -607,7 +608,7 @@ ListboxWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; int cmdIndex, index; int result = TCL_OK; Tcl_Obj *objPtr; @@ -1082,7 +1083,7 @@ ListboxBboxSubCmd( Listbox *listPtr, /* Information about the listbox */ int index) /* Index of the element to get bbox info on */ { - register Tk_Window tkwin = listPtr->tkwin; + Tk_Window tkwin = listPtr->tkwin; int lastVisibleIndex; /* @@ -1411,7 +1412,7 @@ ListboxGetItemAttributes( entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, KEY(index), &isNew); if (isNew) { - attrs = ckalloc(sizeof(ItemAttr)); + attrs = (ItemAttr *)ckalloc(sizeof(ItemAttr)); attrs->border = NULL; attrs->selBorder = NULL; attrs->fgColor = NULL; @@ -1420,7 +1421,7 @@ ListboxGetItemAttributes( listPtr->tkwin); Tcl_SetHashValue(entry, attrs); } else { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); } return attrs; } @@ -1447,7 +1448,7 @@ static void DestroyListbox( void *memPtr) /* Info about listbox widget. */ { - register Listbox *listPtr = memPtr; + Listbox *listPtr = (Listbox *)memPtr; Tcl_HashEntry *entry; Tcl_HashSearch search; @@ -1527,8 +1528,10 @@ DestroyListbox( static void DestroyListboxOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + Tcl_Interp *dummy) /* Pointer to the calling interp */ { + (void)dummy; + ckfree(clientData); return; } @@ -1556,7 +1559,7 @@ DestroyListboxOptionTables( static int ConfigureListbox( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[]) /* Arguments. */ @@ -1716,7 +1719,7 @@ ConfigureListbox( static int ConfigureListboxItem( Tcl_Interp *interp, /* Used for error reporting. */ - register Listbox *listPtr, /* Information about widget; may or may not + Listbox *listPtr, /* Information about widget; may or may not * already have values for some fields. */ ItemAttr *attrs, /* Information about the item to configure */ int objc, /* Number of valid entries in argv. */ @@ -1767,7 +1770,7 @@ ListboxWorldChanged( XGCValues gcValues; GC gc; unsigned long mask; - Listbox *listPtr = instanceData; + Listbox *listPtr = (Listbox *)instanceData; if (listPtr->state & STATE_NORMAL) { gcValues.foreground = listPtr->fgColorPtr->pixel; @@ -1838,8 +1841,8 @@ static void DisplayListbox( ClientData clientData) /* Information about window. */ { - register Listbox *listPtr = clientData; - register Tk_Window tkwin = listPtr->tkwin; + Listbox *listPtr = (Listbox *)clientData; + Tk_Window tkwin = listPtr->tkwin; GC gc; int i, limit, x, y, prevSelected, freeGC; TkSizeT stringLen; @@ -1958,7 +1961,7 @@ DisplayListbox( */ if (entry != NULL) { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); /* * Default GC has the values from the widget at large. @@ -2039,7 +2042,7 @@ DisplayListbox( */ if (entry != NULL) { - attrs = Tcl_GetHashValue(entry); + attrs = (ItemAttr *)Tcl_GetHashValue(entry); gcValues.foreground = listPtr->fgColorPtr->pixel; gcValues.font = Tk_FontId(listPtr->tkfont); gcValues.graphics_exposures = False; @@ -2320,7 +2323,7 @@ ListboxComputeGeometry( static int ListboxInsertSubCmd( - register Listbox *listPtr, /* Listbox that is to get the new elements. */ + Listbox *listPtr, /* Listbox that is to get the new elements. */ int index, /* Add the new elements before this * element. */ int objc, /* Number of new elements to add. */ @@ -2437,7 +2440,7 @@ ListboxInsertSubCmd( static int ListboxDeleteSubCmd( - register Listbox *listPtr, /* Listbox widget to modify. */ + Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { @@ -2615,7 +2618,7 @@ ListboxEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; if (eventPtr->type == Expose) { EventuallyRedrawRange(listPtr, @@ -2690,7 +2693,7 @@ static void ListboxCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; /* * This procedure could be invoked either because the window was destroyed @@ -2834,7 +2837,7 @@ GetListboxIndex( static void ChangeListboxView( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { @@ -2869,7 +2872,7 @@ ChangeListboxView( static void ChangeListboxOffset( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int offset) /* Desired new "xOffset" for listbox. */ { int maxOffset; @@ -2917,7 +2920,7 @@ ChangeListboxOffset( static void ListboxScanTo( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int x, /* X-coordinate to use for scan operation. */ int y) /* Y-coordinate to use for scan operation. */ { @@ -2984,7 +2987,7 @@ ListboxScanTo( static int NearestListboxElement( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int y) /* Y-coordinate in listPtr's window. */ { int index; @@ -3025,7 +3028,7 @@ NearestListboxElement( static int ListboxSelect( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element to select or * deselect. */ int last, /* Index of last element to select or @@ -3126,7 +3129,7 @@ ListboxFetchSelection( * not including terminating NULL * character. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; Tcl_DString selection; int count, needNewline, i; TkSizeT length, stringLen; @@ -3203,7 +3206,7 @@ static void ListboxLostSelection( ClientData clientData) /* Information about listbox widget. */ { - register Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; if ((listPtr->exportSelection) && (!Tcl_IsSafe(listPtr->interp)) && (listPtr->nElements > 0)) { @@ -3255,13 +3258,16 @@ GenerateListboxSelectEvent( static void EventuallyRedrawRange( - register Listbox *listPtr, /* Information about widget. */ + Listbox *listPtr, /* Information about widget. */ int first, /* Index of first element in list that needs * to be redrawn. */ int last) /* Index of last element in list that needs to * be redrawn. May be less than first; these * just bracket a range. */ { + (void)first; + (void)last; + /* * We don't have to register a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped. @@ -3298,7 +3304,7 @@ EventuallyRedrawRange( static void ListboxUpdateVScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; double first, last; @@ -3368,7 +3374,7 @@ ListboxUpdateVScrollbar( static void ListboxUpdateHScrollbar( - register Listbox *listPtr) /* Information about widget. */ + Listbox *listPtr) /* Information about widget. */ { char firstStr[TCL_DOUBLE_SPACE], lastStr[TCL_DOUBLE_SPACE]; int result, windowWidth; @@ -3442,10 +3448,12 @@ ListboxListVarProc( const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { - Listbox *listPtr = clientData; + Listbox *listPtr = (Listbox *)clientData; Tcl_Obj *oldListObj, *varListObj; int oldLength, i; Tcl_HashEntry *entry; + (void)name1; + (void)name2; /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! @@ -3649,7 +3657,7 @@ MigrateHashEntries( *---------------------------------------------------------------------- */ static int GetMaxOffset( - register Listbox *listPtr) + Listbox *listPtr) { int maxOffset; diff --git a/generic/tkMacWinMenu.c b/generic/tkMacWinMenu.c index 0417185..40a5ea8 100644 --- a/generic/tkMacWinMenu.c +++ b/generic/tkMacWinMenu.c @@ -43,7 +43,7 @@ PreprocessMenu( TkMenu *menuPtr) { int index, result, finished; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_Preserve(menuPtr); @@ -67,7 +67,7 @@ PreprocessMenu( do { finished = 1; for (index = 0; index < (int)menuPtr->numEntries; index++) { - register TkMenuEntry *entryPtr = menuPtr->entries[index]; + TkMenuEntry *entryPtr = menuPtr->entries[index]; if ((entryPtr->type == CASCADE_ENTRY) && (entryPtr->namePtr != NULL) @@ -129,7 +129,7 @@ int TkPreprocessMenu( TkMenu *menuPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->postCommandGeneration++; diff --git a/generic/tkMain.c b/generic/tkMain.c index 64eedb2..948f811 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -35,13 +35,13 @@ static const char DEFAULT_PRIMARY_PROMPT[] = "% "; /* Little hack to eliminate the need for "tclInt.h" here: Just copy a small portion of TclIntPlatStubs, just enough to make it work. See [600b72bfbc] */ -typedef struct { +typedef struct TclIntPlatStubs { int magic; void *hooks; void (*dummy[16]) (void); /* dummy entries 0-15, not used */ int (*tclpIsAtty) (int fd); /* 16 */ } TclIntPlatStubs; -extern const TclIntPlatStubs *tclIntPlatStubsPtr; +const TclIntPlatStubs *tclIntPlatStubsPtr; # include "tkWinInt.h" #else # define TCHAR char @@ -403,9 +403,10 @@ StdinProc( char *cmd; int code; size_t count; - InteractiveState *isPtr = clientData; + InteractiveState *isPtr = (InteractiveState *)clientData; Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; + (void)mask; count = (size_t)Tcl_Gets(chan, &isPtr->line); diff --git a/generic/tkMenu.c b/generic/tkMenu.c index faadc81..25c4632 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -409,14 +409,14 @@ Tk_MenuObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; Tk_Window newWin; TkMenu *menuPtr; TkMenuReferences *menuRefPtr; int i, index, toplevel; const char *windowName; static const char *const typeStringList[] = {"-type", NULL}; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -451,7 +451,7 @@ Tk_MenuObjCmd( * Tcl_EventuallyFree is called. */ - menuPtr = ckalloc(sizeof(TkMenu)); + menuPtr = (TkMenu *)ckalloc(sizeof(TkMenu)); memset(menuPtr, 0, sizeof(TkMenu)); menuPtr->tkwin = newWin; menuPtr->display = Tk_Display(newWin); @@ -622,11 +622,11 @@ MenuWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; int result = TCL_OK; int option; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { @@ -1110,7 +1110,7 @@ DestroyMenuInstance( Tcl_Obj *newObjv[2]; TkMenu *parentMasterMenuPtr; TkMenuEntry *parentMasterEntryPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1393,7 +1393,7 @@ static void DestroyMenuEntry( void *memPtr) /* Pointer to entry to be freed. */ { - TkMenuEntry *mePtr = memPtr; + TkMenuEntry *mePtr = (TkMenuEntry *)memPtr; TkMenu *menuPtr = mePtr->menuPtr; if (menuPtr->postedCascade == mePtr) { @@ -1493,7 +1493,7 @@ static void MenuWorldChanged( ClientData instanceData) /* Information about widget. */ { - TkMenu *menuPtr = instanceData; + TkMenu *menuPtr = (TkMenu *)instanceData; TkSizeT i; TkMenuConfigureDrawOptions(menuPtr); @@ -1535,12 +1535,12 @@ ConfigureMenu( int i; TkMenu *menuListPtr, *cleanupPtr; int result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { - menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions)); + menuListPtr->errorStructPtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions)); result = Tk_SetOptions(interp, menuListPtr, tsdPtr->menuOptionTable, objc, objv, menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL); @@ -1744,7 +1744,7 @@ PostProcessEntry( name = Tcl_GetString(mePtr->namePtr); if (mePtr->childMenuRefPtr != NULL) { - oldHashKey = Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp), + oldHashKey = (char *)Tcl_GetHashKey(TkGetMenuHashTable(menuPtr->interp), mePtr->childMenuRefPtr->hashEntryPtr); if (strcmp(oldHashKey, name) != 0) { UnhookCascadeEntry(mePtr); @@ -2126,15 +2126,25 @@ GetMenuIndex( TkSizeT *indexPtr) /* Where to store converted index. */ { int i; - const char *string = Tcl_GetString(objPtr); + const char *string; + + if (TkGetIntForIndex(objPtr, menuPtr->numEntries - ((lastOK) ? 0 : 1), indexPtr) == TCL_OK) { + if (*indexPtr != TCL_INDEX_NONE) { + if (*indexPtr >= menuPtr->numEntries) { + *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); + } + return TCL_OK; + } + } + + string = Tcl_GetString(objPtr); if ((string[0] == 'a') && (strcmp(string, "active") == 0)) { *indexPtr = menuPtr->active; goto success; } - if (((string[0] == 'l') && (strcmp(string, "last") == 0)) - || ((string[0] == 'e') && (strcmp(string, "end") == 0))) { + if ((string[0] == 'l') && (strcmp(string, "last") == 0)) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); goto success; } @@ -2151,22 +2161,6 @@ GetMenuIndex( } } - if (isdigit(UCHAR(string[0]))) { - if (Tcl_GetIntFromObj(NULL, objPtr, &i) == TCL_OK) { - if (i >= (int)menuPtr->numEntries) { - if (lastOK) { - i = menuPtr->numEntries; - } else { - i = menuPtr->numEntries-1; - } - } else if (i < 0) { - i = -1; - } - *indexPtr = i; - goto success; - } - } - for (i = 0; i < (int)menuPtr->numEntries; i++) { Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr; const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr); @@ -2208,7 +2202,7 @@ static void MenuCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; Tk_Window tkwin = menuPtr->tkwin; /* @@ -2257,14 +2251,14 @@ MenuNewEntry( TkMenuEntry *mePtr; TkMenuEntry **newEntries; TkSizeT i; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Create a new array of entries with an empty slot for the new entry. */ - newEntries = ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *)); + newEntries = (TkMenuEntry **)ckalloc((menuPtr->numEntries+1) * sizeof(TkMenuEntry *)); for (i = 0; i < index; i++) { newEntries[i] = menuPtr->entries[i]; } @@ -2277,7 +2271,7 @@ MenuNewEntry( } menuPtr->entries = newEntries; menuPtr->numEntries++; - mePtr = ckalloc(sizeof(TkMenuEntry)); + mePtr = (TkMenuEntry *)ckalloc(sizeof(TkMenuEntry)); menuPtr->entries[index] = mePtr; mePtr->type = type; mePtr->optionTable = tsdPtr->entryOptionTables[type]; @@ -2493,7 +2487,7 @@ MenuVarProc( const char *name2, /* Second part of variable's name. */ int flags) /* Describes what just happened. */ { - TkMenuEntry *mePtr = clientData; + TkMenuEntry *mePtr = (TkMenuEntry *)clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; @@ -3290,7 +3284,7 @@ TkSetWindowMenuBar( * menu. */ - topLevelListPtr = ckalloc(sizeof(TkMenuTopLevelList)); + topLevelListPtr = (TkMenuTopLevelList *)ckalloc(sizeof(TkMenuTopLevelList)); topLevelListPtr->tkwin = tkwin; topLevelListPtr->nextPtr = menuRefPtr->topLevelListPtr; menuRefPtr->topLevelListPtr = topLevelListPtr; @@ -3324,7 +3318,7 @@ DestroyMenuHashTable( { (void)dummy; - Tcl_DeleteHashTable(clientData); + Tcl_DeleteHashTable((Tcl_HashTable *)clientData); ckfree(clientData); } @@ -3350,11 +3344,11 @@ Tcl_HashTable * TkGetMenuHashTable( Tcl_Interp *interp) /* The interp we need the hash table in.*/ { - Tcl_HashTable *menuTablePtr = + Tcl_HashTable *menuTablePtr = (Tcl_HashTable *) Tcl_GetAssocData(interp, MENU_HASH_KEY, NULL); if (menuTablePtr == NULL) { - menuTablePtr = ckalloc(sizeof(Tcl_HashTable)); + menuTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable)); Tcl_InitHashTable(menuTablePtr, TCL_STRING_KEYS); Tcl_SetAssocData(interp, MENU_HASH_KEY, DestroyMenuHashTable, menuTablePtr); @@ -3395,14 +3389,14 @@ TkCreateMenuReferences( hashEntryPtr = Tcl_CreateHashEntry(menuTablePtr, pathName, &newEntry); if (newEntry) { - menuRefPtr = ckalloc(sizeof(TkMenuReferences)); + menuRefPtr = (TkMenuReferences *)ckalloc(sizeof(TkMenuReferences)); menuRefPtr->menuPtr = NULL; menuRefPtr->topLevelListPtr = NULL; menuRefPtr->parentEntryPtr = NULL; menuRefPtr->hashEntryPtr = hashEntryPtr; Tcl_SetHashValue(hashEntryPtr, menuRefPtr); } else { - menuRefPtr = Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3439,7 +3433,7 @@ TkFindMenuReferences( menuTablePtr = TkGetMenuHashTable(interp); hashEntryPtr = Tcl_FindHashEntry(menuTablePtr, pathName); if (hashEntryPtr != NULL) { - menuRefPtr = Tcl_GetHashValue(hashEntryPtr); + menuRefPtr = (TkMenuReferences *)Tcl_GetHashValue(hashEntryPtr); } return menuRefPtr; } @@ -3606,7 +3600,7 @@ MenuCleanup( void TkMenuInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!menusInitialized) { diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index 02f5a5b..74ba9ef 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -483,8 +483,8 @@ TkRecomputeMenu( void TkEventuallyRedrawMenu( - register TkMenu *menuPtr, /* Information about menu to redraw. */ - register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the + TkMenu *menuPtr, /* Information about menu to redraw. */ + TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { TkSizeT i; @@ -530,7 +530,7 @@ static void ComputeMenuGeometry( ClientData clientData) /* Structure describing menu. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; if (menuPtr->tkwin == NULL) { return; @@ -586,7 +586,13 @@ TkMenuSelectImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuEntry *mePtr = clientData; + TkMenuEntry *mePtr = (TkMenuEntry *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if ((mePtr->entryFlags & ENTRY_SELECTED) && !(mePtr->menuPtr->menuFlags & REDRAW_PENDING)) { @@ -615,9 +621,9 @@ static void DisplayMenu( ClientData clientData) /* Information about widget. */ { - register TkMenu *menuPtr = clientData; - register TkMenuEntry *mePtr; - register Tk_Window tkwin = menuPtr->tkwin; + TkMenu *menuPtr = (TkMenu *)clientData; + TkMenuEntry *mePtr; + Tk_Window tkwin = menuPtr->tkwin; TkSizeT index; int strictMotif; Tk_Font tkfont; @@ -730,7 +736,7 @@ TkMenuEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawMenu(menuPtr, NULL); @@ -795,7 +801,13 @@ TkMenuImageProc( * <=0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenu *menuPtr = ((TkMenuEntry *) clientData)->menuPtr; + TkMenu *menuPtr = (TkMenu *)((TkMenuEntry *) clientData)->menuPtr; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if ((menuPtr->tkwin != NULL) && !(menuPtr->menuFlags & RESIZE_PENDING)) { menuPtr->menuFlags |= RESIZE_PENDING; @@ -853,8 +865,8 @@ int TkPostSubmenu( Tcl_Interp *interp, /* Used for invoking sub-commands and * reporting errors. */ - register TkMenu *menuPtr, /* Information about menu as a whole. */ - register TkMenuEntry *mePtr)/* Info about submenu that is to be posted. + TkMenu *menuPtr, /* Information about menu as a whole. */ + TkMenuEntry *mePtr)/* Info about submenu that is to be posted. * NULL means make sure that no submenu is * posted. */ { diff --git a/generic/tkMenubutton.c b/generic/tkMenubutton.c index 4cf102f..ff1ce6d 100644 --- a/generic/tkMenubutton.c +++ b/generic/tkMenubutton.c @@ -212,14 +212,15 @@ static void DestroyMenuButton(char *memPtr); int Tk_MenubuttonObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr; + TkMenuButton *mbPtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -347,7 +348,7 @@ MenuButtonWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; int result, index; Tcl_Obj *objPtr; @@ -422,7 +423,7 @@ static void DestroyMenuButton( char *memPtr) /* Info about button widget. */ { - register TkMenuButton *mbPtr = (TkMenuButton *) memPtr; + TkMenuButton *mbPtr = (TkMenuButton *) memPtr; TkpDestroyMenuButton(mbPtr); if (mbPtr->flags & REDRAW_PENDING) { @@ -490,7 +491,7 @@ DestroyMenuButton( static int ConfigureMenuButton( Tcl_Interp *interp, /* Used for error reporting. */ - register TkMenuButton *mbPtr, + TkMenuButton *mbPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ @@ -633,7 +634,7 @@ ConfigureMenuButton( if (mbPtr->text != NULL) { ckfree(mbPtr->text); } - mbPtr->text = ckalloc(strlen(value) + 1); + mbPtr->text = (char *)ckalloc(strlen(value) + 1); strcpy(mbPtr->text, value); } Tcl_TraceVar2(interp, mbPtr->textVarName, NULL, @@ -675,7 +676,7 @@ TkMenuButtonWorldChanged( XGCValues gcValues; GC gc; unsigned long mask; - TkMenuButton *mbPtr = instanceData; + TkMenuButton *mbPtr = (TkMenuButton *)instanceData; gcValues.font = Tk_FontId(mbPtr->tkfont); gcValues.foreground = mbPtr->normalFg->pixel; @@ -776,7 +777,7 @@ MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { goto redraw; @@ -835,7 +836,7 @@ static void MenuButtonCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; Tk_Window tkwin = mbPtr->tkwin; /* @@ -877,9 +878,11 @@ MenuButtonTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; const char *value; - unsigned len; + size_t len; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -924,8 +927,8 @@ MenuButtonTextVarProc( if (mbPtr->text != NULL) { ckfree(mbPtr->text); } - len = 1 + (unsigned) strlen(value); - mbPtr->text = ckalloc(len); + len = 1 + strlen(value); + mbPtr->text = (char *)ckalloc(len); memcpy(mbPtr->text, value, len); TkpComputeMenuButtonGeometry(mbPtr); @@ -964,7 +967,13 @@ MenuButtonImageProc( * 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { - register TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; if (mbPtr->tkwin != NULL) { TkpComputeMenuButtonGeometry(mbPtr); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index 29daf3b..b7e7ea3 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -180,7 +180,7 @@ static void MessageWorldChanged(ClientData instanceData); static void ComputeMessageGeometry(Message *msgPtr); static int ConfigureMessage(Tcl_Interp *interp, Message *msgPtr, int objc, Tcl_Obj *const objv[], int flags); -static void DestroyMessage(char *memPtr); +static void DestroyMessage(void *memPtr); static void DisplayMessage(ClientData clientData); /* @@ -214,14 +214,15 @@ static const Tk_ClassProcs messageClass = { int Tk_MessageObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr; + Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -241,7 +242,7 @@ Tk_MessageObjCmd( optionTable = Tk_CreateOptionTable(interp, optionSpecs); - msgPtr = ckalloc(sizeof(Message)); + msgPtr = (Message *)ckalloc(sizeof(Message)); memset(msgPtr, 0, sizeof(Message)); /* @@ -306,7 +307,7 @@ MessageWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; static const char *const optionStrings[] = { "cget", "configure", NULL }; enum options { MESSAGE_CGET, MESSAGE_CONFIGURE }; int index; @@ -382,9 +383,9 @@ MessageWidgetObjCmd( static void DestroyMessage( - char *memPtr) /* Info about message widget. */ + void *memPtr) /* Info about message widget. */ { - register Message *msgPtr = (Message *) memPtr; + Message *msgPtr = (Message *) memPtr; msgPtr->flags |= MESSAGE_DELETED; @@ -437,13 +438,14 @@ DestroyMessage( static int ConfigureMessage( Tcl_Interp *interp, /* Used for error reporting. */ - register Message *msgPtr, /* Information about widget; may or may not + Message *msgPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int flags) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; + (void)flags; /* * Eliminate any existing trace on a variable monitored by the message. @@ -478,7 +480,7 @@ ConfigureMessage( if (msgPtr->string != NULL) { ckfree(msgPtr->string); } - msgPtr->string = strcpy(ckalloc(strlen(value) + 1), value); + msgPtr->string = strcpy((char *)ckalloc(strlen(value) + 1), value); } Tcl_TraceVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, @@ -527,7 +529,7 @@ MessageWorldChanged( XGCValues gcValues; GC gc = NULL; Tk_FontMetrics fm; - Message *msgPtr = instanceData; + Message *msgPtr = (Message *)instanceData; if (msgPtr->border != NULL) { Tk_SetBackgroundFromBorder(msgPtr->tkwin, msgPtr->border); @@ -582,7 +584,7 @@ MessageWorldChanged( static void ComputeMessageGeometry( - register Message *msgPtr) /* Information about window. */ + Message *msgPtr) /* Information about window. */ { int width, inc, height; int thisWidth, thisHeight, maxWidth; @@ -666,8 +668,8 @@ static void DisplayMessage( ClientData clientData) /* Information about window. */ { - register Message *msgPtr = clientData; - register Tk_Window tkwin = msgPtr->tkwin; + Message *msgPtr = (Message *)clientData; + Tk_Window tkwin = msgPtr->tkwin; int x, y; int borderWidth = msgPtr->highlightWidth; @@ -742,7 +744,7 @@ MessageEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; if (((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) || (eventPtr->type == ConfigureNotify)) { @@ -795,7 +797,7 @@ static void MessageCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; /* * This function could be invoked either because the window was destroyed @@ -835,8 +837,10 @@ MessageTextVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register Message *msgPtr = clientData; + Message *msgPtr = (Message *)clientData; const char *value; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -882,7 +886,7 @@ MessageTextVarProc( ckfree(msgPtr->string); } msgPtr->numChars = Tcl_NumUtfChars(value, -1); - msgPtr->string = ckalloc(strlen(value) + 1); + msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index 1a98db6..e3b1107 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -50,6 +50,7 @@ typedef struct PixelRep { typedef struct { const Tcl_ObjType *doubleTypePtr; const Tcl_ObjType *intTypePtr; + const Tcl_ObjType *endTypePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; @@ -97,6 +98,29 @@ static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); +#if TCL_MAJOR_VERSION < 9 +#if defined(USE_TCL_STUBS) +/* Little hack to eliminate the need for "tclInt.h" here: + Just copy a small portion of TclIntStubs, just + enough to make it work */ +typedef struct TclIntStubs { + int magic; + void *hooks; + void (*dummy[34]) (void); /* dummy entries 0-33, not used */ + int (*tclGetIntForIndex) (Tcl_Interp *interp, Tcl_Obj *objPtr, int endValue, int *indexPtr); /* 34 */ +} TclIntStubs; +extern const struct TclIntStubs *tclIntStubsPtr; + +# undef Tcl_GetIntForIndex +# define Tcl_GetIntForIndex(interp, obj, max, ptr) ((tclIntStubsPtr->tclGetIntForIndex == NULL)? \ + ((int (*)(Tcl_Interp*, Tcl_Obj *, int, int*))(void *)((&(tclStubsPtr->tcl_PkgProvideEx))[645]))((interp), (obj), (max), (ptr)): \ + tclIntStubsPtr->tclGetIntForIndex((interp), (obj), (max), (ptr))) +#elif TCL_MINOR_VERSION < 7 +extern int TclGetIntForIndex(Tcl_Interp*, Tcl_Obj *, int, int*); +# define Tcl_GetIntForIndex TclGetIntForIndex +#endif +#endif + /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its @@ -153,19 +177,24 @@ static const Tcl_ObjType windowObjType = { static ThreadSpecificData * GetTypeCache(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->doubleTypePtr == NULL) { /* Smart initialization of doubleTypePtr/intTypePtr without * hash-table lookup or creating complete Tcl_Obj's */ Tcl_Obj obj; + obj.bytes = (char *)"end"; obj.length = 3; + obj.typePtr = NULL; + Tcl_GetIntForIndex(NULL, &obj, TCL_INDEX_NONE, (TkSizeT *)&obj.internalRep.doubleValue); + tsdPtr->endTypePtr = obj.typePtr; obj.bytes = (char *)"0.0"; + obj.length = 3; obj.typePtr = NULL; Tcl_GetDoubleFromObj(NULL, &obj, &obj.internalRep.doubleValue); tsdPtr->doubleTypePtr = obj.typePtr; - obj.bytes += 2; + obj.bytes = (char *)"0"; obj.length = 1; obj.typePtr = NULL; Tcl_GetLongFromObj(NULL, &obj, &obj.internalRep.longValue); @@ -177,6 +206,51 @@ GetTypeCache(void) /* *---------------------------------------------------------------------- * + * TkGetIntForIndex -- + * + * Almost the same as Tcl_GetIntForIndex, but it return an int, and it is + * more restricted. For example it only accepts "end", not "end-1", and + * only "2", not "1+1" + * + * Results: + * The return value is a standard Tcl object result. + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +int +TkGetIntForIndex(Tcl_Obj *indexObj, TkSizeT end, TkSizeT *indexPtr) { + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) + Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + + if (Tcl_GetIntForIndex(NULL, indexObj, end, indexPtr) != TCL_OK) { + return TCL_ERROR; + } + if (indexObj->typePtr == tsdPtr->endTypePtr) { + /* check for "end", but not "end-??" or "end+??" */ + return (*indexPtr == end) ? TCL_OK : TCL_ERROR; + } + if (indexObj->typePtr != tsdPtr->intTypePtr) { + /* Neither do we accept "??-??" or "??+??" */ + return TCL_ERROR; + } +#if TCL_MAJOR_VERSION < 9 + if ((*indexPtr < -1) || (end < -1)) { + return TCL_ERROR; + } +#endif + if ((*indexPtr + 1) > (end + 1)) { + *indexPtr = end + 1; + } + return TCL_OK; +} + +/* + *---------------------------------------------------------------------- + * * GetPixelsFromObjEx -- * * Attempt to return a pixel value from the Tcl object "objPtr". If the @@ -412,8 +486,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; @@ -423,7 +497,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; @@ -507,7 +581,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; @@ -568,7 +642,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) { @@ -632,14 +706,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; @@ -668,13 +742,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]; TkSizeT 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"); @@ -683,7 +757,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; } @@ -791,7 +865,7 @@ SetMMFromAny( objPtr->typePtr = &mmObjType; - mmPtr = ckalloc(sizeof(MMRep)); + mmPtr = (MMRep *)ckalloc(sizeof(MMRep)); mmPtr->value = d; mmPtr->units = units; mmPtr->tkwin = NULL; @@ -831,7 +905,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); @@ -840,7 +914,7 @@ TkGetWindowFromObj( } } - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; if (winPtr->tkwin == NULL || winPtr->mainPtr == NULL || winPtr->mainPtr != mainPtr @@ -886,11 +960,12 @@ TkGetWindowFromObj( static int SetWindowFromAny( - Tcl_Interp *interp, /* Used for error reporting if not NULL. */ - register Tcl_Obj *objPtr) /* The object to convert. */ + Tcl_Interp *dummy, /* Used for error reporting if not NULL. */ + Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; WindowRep *winPtr; + (void)dummy; /* * Free the old internalRep before setting the new one. @@ -902,7 +977,7 @@ SetWindowFromAny( typePtr->freeIntRepProc(objPtr); } - winPtr = ckalloc(sizeof(WindowRep)); + winPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); winPtr->tkwin = NULL; winPtr->mainPtr = NULL; winPtr->epoch = 0; @@ -933,13 +1008,13 @@ SetWindowFromAny( static void DupWindowInternalRep( - register Tcl_Obj *srcPtr, - register Tcl_Obj *copyPtr) + Tcl_Obj *srcPtr, + Tcl_Obj *copyPtr) { - register WindowRep *oldPtr, *newPtr; + WindowRep *oldPtr, *newPtr; - oldPtr = srcPtr->internalRep.twoPtrValue.ptr1; - newPtr = ckalloc(sizeof(WindowRep)); + oldPtr = (WindowRep *)srcPtr->internalRep.twoPtrValue.ptr1; + newPtr = (WindowRep *)ckalloc(sizeof(WindowRep)); newPtr->tkwin = oldPtr->tkwin; newPtr->mainPtr = oldPtr->mainPtr; newPtr->epoch = oldPtr->epoch; @@ -997,11 +1072,11 @@ TkNewWindowObj( { Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; - register WindowRep *winPtr; + WindowRep *winPtr; SetWindowFromAny(NULL, objPtr); - winPtr = objPtr->internalRep.twoPtrValue.ptr1; + winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1; winPtr->tkwin = tkwin; winPtr->mainPtr = mainPtr; winPtr->epoch = mainPtr->deletionEpoch; diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index d83c30b..67ac6e9 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -86,7 +86,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. */ @@ -249,8 +249,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; @@ -380,7 +380,7 @@ DoConfig( if (nullValue) { newStr = NULL; } else { - newStr = ckalloc(strlen(value) + 1); + newStr = (char *)ckalloc(strlen(value) + 1); strcpy(newStr, value); } oldStr = *((char **) ptr); @@ -550,7 +550,7 @@ DoConfig( } case TK_CONFIG_CUSTOM: if (specPtr->customPtr->parseProc(specPtr->customPtr->clientData, - interp, tkwin, value, widgRec, specPtr->offset)!=TCL_OK) { + interp, tkwin, value, (char *)widgRec, specPtr->offset)!=TCL_OK) { return TCL_ERROR; } break; @@ -607,7 +607,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 = "{"; @@ -690,7 +690,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. */ void *widgRec) /* Pointer to record holding current values of @@ -878,7 +878,7 @@ FormatConfigValue( } case TK_CONFIG_CUSTOM: result = specPtr->customPtr->printProc(specPtr->customPtr->clientData, - tkwin, widgRec, specPtr->offset, freeProcPtr); + tkwin, (char *)widgRec, specPtr->offset, freeProcPtr); break; default: result = "?? unknown type ??"; @@ -988,7 +988,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++) { @@ -1076,10 +1076,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); @@ -1093,7 +1093,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; @@ -1112,7 +1112,7 @@ GetCachedSpecs( * from the master copy. */ - cachedSpecs = ckalloc(entrySpace); + cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace); memcpy(cachedSpecs, staticSpecs, entrySpace); Tcl_SetHashValue(entryPtr, cachedSpecs); @@ -1136,7 +1136,7 @@ GetCachedSpecs( } } } else { - cachedSpecs = Tcl_GetHashValue(entryPtr); + cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr); } return cachedSpecs; @@ -1162,11 +1162,12 @@ GetCachedSpecs( static void DeleteSpecCacheTable( ClientData clientData, - Tcl_Interp *interp) + Tcl_Interp *dummy) { - Tcl_HashTable *tablePtr = clientData; + Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; + (void)dummy; for (entryPtr = Tcl_FirstHashEntry(tablePtr,&search); entryPtr != NULL; entryPtr = Tcl_NextHashEntry(&search)) { diff --git a/generic/tkOldTest.c b/generic/tkOldTest.c index 948883d..50d036d 100644 --- a/generic/tkOldTest.c +++ b/generic/tkOldTest.c @@ -106,9 +106,10 @@ static int ImageObjCmd(ClientData dummy, int TkOldTestInit( - Tcl_Interp *interp) + Tcl_Interp *dummy) { static int initialized = 0; + (void)dummy; if (!initialized) { initialized = 1; @@ -151,6 +152,7 @@ ImageCreate( TImageMaster *timPtr; const char *varName; int i; + (void)typePtr; varName = "log"; for (i = 0; i < argc; i += 2) { @@ -167,14 +169,14 @@ ImageCreate( varName = argv[i+1]; } - timPtr = ckalloc(sizeof(TImageMaster)); + timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster)); timPtr->master = master; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -207,7 +209,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; int x, y, width, height; if (objc < 2) { @@ -262,7 +264,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -271,7 +273,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->masterPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -309,7 +311,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; sprintf(buffer, "%s display %d %d %d %d %d %d", @@ -354,7 +356,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -388,7 +390,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); diff --git a/generic/tkOption.c b/generic/tkOption.c index 4848eba..54ddb34 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -254,16 +254,16 @@ Tk_AddOption( * TK_MAX_PRIO. */ { TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr; - register ElArray **arrayPtrPtr; - register Element *elPtr; + ElArray **arrayPtrPtr; + Element *elPtr; Element newEl; - register const char *p; + const char *p; const char *field; int count, firstField; size_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->mainPtr->optionRootPtr == NULL) { @@ -407,11 +407,11 @@ Tk_GetOption( { Tk_Uid nameId, classId = NULL; const char *masqName; - register Element *elPtr, *bestPtr; - register int count; + Element *elPtr, *bestPtr; + int count; StackLevel *levelPtr; int stackDepth[NUM_STACKS]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -521,8 +521,8 @@ Tk_GetOption( if (masqName != NULL) { char *masqClass; Tk_Uid nodeId, winClassId, winNameId; - unsigned int classNameLength; - register Element *nodePtr, *leafPtr; + size_t classNameLength; + Element *nodePtr, *leafPtr; static const int searchOrder[] = { EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS, WILDCARD_NODE_CLASS, -1 @@ -535,7 +535,7 @@ Tk_GetOption( */ classNameLength = (unsigned) (masqName - name); - masqClass = ckalloc(classNameLength + 1); + masqClass = (char *)ckalloc(classNameLength + 1); strncpy(masqClass, name, classNameLength); masqClass[classNameLength] = '\0'; @@ -615,9 +615,9 @@ Tk_OptionObjCmd( int objc, /* Number of Tcl_Obj arguments. */ Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; int index, result; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); static const char *const optionCmds[] = { "add", "clear", "get", "readfile", NULL @@ -738,9 +738,9 @@ Tk_OptionObjCmd( void TkOptionDeadWindow( - register TkWindow *winPtr) /* Window to be cleaned up. */ + TkWindow *winPtr) /* Window to be cleaned up. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -796,7 +796,7 @@ TkOptionClassChanged( { int i, j, *basePtr; ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->optionLevel == -1) { @@ -922,7 +922,7 @@ AddFromString( * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { - register char *src, *dst; + char *src, *dst; char *name, *value; int lineNum; @@ -1150,7 +1150,7 @@ static ElArray * NewArray( int numEls) /* How many elements of space to allocate. */ { - register ElArray *arrayPtr = ckalloc(EL_ARRAY_SIZE(numEls)); + ElArray *arrayPtr = (ElArray *)ckalloc(EL_ARRAY_SIZE(numEls)); arrayPtr->arraySize = numEls; arrayPtr->numUsed = 0; @@ -1177,17 +1177,17 @@ NewArray( static ElArray * ExtendArray( - register ElArray *arrayPtr, /* Array to be extended. */ - register Element *elPtr) /* Element to be copied into array. */ + ElArray *arrayPtr, /* Array to be extended. */ + Element *elPtr) /* Element to be copied into array. */ { /* * If the current array has filled up, make it bigger. */ if (arrayPtr->numUsed >= arrayPtr->arraySize) { - register int newSize = 2*arrayPtr->arraySize; + int newSize = 2*arrayPtr->arraySize; - arrayPtr = ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize)); + arrayPtr = (ElArray *)ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize)); arrayPtr->arraySize = newSize; arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed]; } @@ -1226,9 +1226,9 @@ SetupStacks( { int level, i; const int *iPtr; - register StackLevel *levelPtr; - register ElArray *arrayPtr; - ThreadSpecificData *tsdPtr = + StackLevel *levelPtr; + ElArray *arrayPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1305,7 +1305,7 @@ SetupStacks( */ if (tsdPtr->curLevel >= tsdPtr->numLevels) { - StackLevel *newLevels = + StackLevel *newLevels = (StackLevel *) ckalloc(tsdPtr->numLevels * 2 * sizeof(StackLevel)); memcpy(newLevels, tsdPtr->levels, @@ -1332,7 +1332,7 @@ SetupStacks( */ for (iPtr = searchOrder; *iPtr != -1; iPtr++) { - register Element *elPtr; + Element *elPtr; int count; Tk_Uid id; @@ -1387,9 +1387,9 @@ ExtendStacks( int leaf) /* If zero, then don't copy exact leaf * elements. */ { - register int count; - register Element *elPtr; - ThreadSpecificData *tsdPtr = + int count; + Element *elPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (elPtr = arrayPtr->els, count = arrayPtr->numUsed; @@ -1420,10 +1420,11 @@ ExtendStacks( static void OptionThreadExitProc( - ClientData clientData) /* not used */ + ClientData dummy) /* not used */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (tsdPtr->initialized) { int i; @@ -1454,13 +1455,13 @@ OptionThreadExitProc( static void OptionInit( - register TkMainInfo *mainPtr) + TkMainInfo *mainPtr) /* Top-level information about window that * isn't initialized yet. */ { int i; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Element *defaultMatchPtr = &tsdPtr->defaultMatch; @@ -1475,7 +1476,7 @@ OptionInit( tsdPtr->curLevel = -1; tsdPtr->serial = 0; - tsdPtr->levels = ckalloc(5 * sizeof(StackLevel)); + tsdPtr->levels = (StackLevel *)ckalloc(5 * sizeof(StackLevel)); for (i = 0; i < NUM_STACKS; i++) { tsdPtr->stacks[i] = NewArray(10); tsdPtr->levels[0].bases[i] = 0; @@ -1522,7 +1523,7 @@ ClearOptionTree( ElArray *arrayPtr) /* Array of options; delete everything * referred to recursively by this. */ { - register Element *elPtr; + Element *elPtr; int count; for (count = arrayPtr->numUsed, elPtr = arrayPtr->els; count > 0; diff --git a/generic/tkPack.c b/generic/tkPack.c index faa3533..4c41e0f 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -196,7 +196,7 @@ Tk_PackObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *argv2; static const char *const optionStrings[] = { #ifndef TK_NO_DEPRECATED @@ -259,7 +259,7 @@ Tk_PackObjCmd( } case PACK_APPEND: { Packer *masterPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -276,7 +276,7 @@ Tk_PackObjCmd( } case PACK_BEFORE: { Packer *packPtr, *masterPtr; - register Packer *prevPtr; + Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { @@ -337,7 +337,7 @@ Tk_PackObjCmd( break; } case PACK_INFO: { - register Packer *slavePtr; + Packer *slavePtr; Tk_Window slave; Tcl_Obj *infoObj; @@ -523,7 +523,8 @@ PackReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; + (void)tkwin; packPtr = packPtr->masterPtr; if (!(packPtr->flags & REQUESTED_REPACK)) { @@ -556,7 +557,8 @@ PackLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Packer *slavePtr = clientData; + Packer *slavePtr = (Packer *)clientData; + (void)tkwin; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); @@ -589,8 +591,8 @@ ArrangePacking( ClientData clientData) /* Structure describing master whose slaves * are to be re-layed out. */ { - register Packer *masterPtr = clientData; - register Packer *slavePtr; + Packer *masterPtr = (Packer *)clientData; + Packer *slavePtr; int cavityX, cavityY, cavityWidth, cavityHeight; /* These variables keep track of the * as-yet-unallocated space remaining in the @@ -913,7 +915,7 @@ ArrangePacking( static int XExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityWidth) /* Horizontal space left for all remaining * slaves. */ { @@ -979,7 +981,7 @@ XExpansion( static int YExpansion( - register Packer *slavePtr, /* First in list of remaining slaves. */ + Packer *slavePtr, /* First in list of remaining slaves. */ int cavityHeight) /* Vertical space left for all remaining * slaves. */ { @@ -1042,7 +1044,7 @@ GetPacker( Tk_Window tkwin) /* Token for window for which packer structure * is desired. */ { - register Packer *packPtr; + Packer *packPtr; Tcl_HashEntry *hPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; @@ -1060,9 +1062,9 @@ GetPacker( hPtr = Tcl_CreateHashEntry(&dispPtr->packerHashTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Packer *)Tcl_GetHashValue(hPtr); } - packPtr = ckalloc(sizeof(Packer)); + packPtr = (Packer *)ckalloc(sizeof(Packer)); packPtr->tkwin = tkwin; packPtr->masterPtr = NULL; packPtr->nextPtr = NULL; @@ -1112,7 +1114,7 @@ PackAfter( * window name and side against which to * pack. */ { - register Packer *packPtr; + Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; int index, optionCount, c; @@ -1340,9 +1342,9 @@ PackAfter( static void Unlink( - register Packer *packPtr) /* Window to unlink. */ + Packer *packPtr) /* Window to unlink. */ { - register Packer *masterPtr, *packPtr2; + Packer *masterPtr, *packPtr2; masterPtr = packPtr->masterPtr; if (masterPtr == NULL) { @@ -1410,7 +1412,7 @@ DestroyPacker( void *memPtr) /* Info about packed window that is now * dead. */ { - register Packer *packPtr = memPtr; + Packer *packPtr = (Packer *)memPtr; ckfree(packPtr); } @@ -1439,7 +1441,7 @@ PackStructureProc( * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Packer *packPtr = clientData; + Packer *packPtr = (Packer *)clientData; if (eventPtr->type == ConfigureNotify) { if ((packPtr->slavePtr != NULL) @@ -1456,7 +1458,7 @@ PackStructureProc( } } } else if (eventPtr->type == DestroyNotify) { - register Packer *slavePtr, *nextPtr; + Packer *slavePtr, *nextPtr; if (packPtr->masterPtr != NULL) { Unlink(packPtr); @@ -1494,7 +1496,7 @@ PackStructureProc( Tcl_DoWhenIdle(ArrangePacking, packPtr); } } else if (eventPtr->type == UnmapNotify) { - register Packer *packPtr2; + Packer *packPtr2; /* * Unmap all of the slaves when the master gets unmapped, so that they diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index a34a372..37bb699 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -383,7 +383,7 @@ static const Tk_OptionSpec slaveOptionSpecs[] = { int Tk_PanedWindowObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -392,6 +392,7 @@ Tk_PanedWindowObjCmd( Tk_Window tkwin, parent; OptionTables *pwOpts; XSetWindowAttributes atts; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -414,7 +415,7 @@ Tk_PanedWindowObjCmd( * easy access to it in the future. */ - pwOpts = ckalloc(sizeof(OptionTables)); + pwOpts = (OptionTables *)ckalloc(sizeof(OptionTables)); /* * Set up an exit handler to free the optionTables struct. @@ -437,7 +438,7 @@ Tk_PanedWindowObjCmd( * Allocate and initialize the widget record. */ - pwPtr = ckalloc(sizeof(PanedWindow)); + pwPtr = (PanedWindow *)ckalloc(sizeof(PanedWindow)); memset((void *)pwPtr, 0, (sizeof(PanedWindow))); pwPtr->tkwin = tkwin; pwPtr->display = Tk_Display(tkwin); @@ -535,7 +536,7 @@ PanedWindowWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int result = TCL_OK; static const char *const optionStrings[] = { "add", "cget", "configure", "forget", "identify", "panecget", @@ -903,7 +904,7 @@ ConfigureSlaves( * structures may already have existed, some may be new. */ - inserts = ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); + inserts = (Slave **)ckalloc(sizeof(Slave *) * (firstOptionArg - 2)); insertIndex = 0; /* @@ -970,7 +971,7 @@ ConfigureSlaves( * out with their "natural" dimensions. */ - slavePtr = ckalloc(sizeof(Slave)); + slavePtr = (Slave *)ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts, pwPtr->tkwin); @@ -1010,7 +1011,7 @@ ConfigureSlaves( */ i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves); - newSlaves = ckalloc(i); + newSlaves = (Slave **)ckalloc(i); memset(newSlaves, 0, i); if (index == -1) { /* @@ -1295,7 +1296,7 @@ PanedWindowWorldChanged( { XGCValues gcValues; GC newGC; - PanedWindow *pwPtr = instanceData; + PanedWindow *pwPtr = (PanedWindow *)instanceData; /* * Allocated a graphics context for drawing the paned window widget @@ -1352,7 +1353,7 @@ PanedWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; int i; if (eventPtr->type == Expose) { @@ -1405,7 +1406,7 @@ static void PanedWindowCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; /* * This function could be invoked either because the window was destroyed @@ -1442,7 +1443,7 @@ static void DisplayPanedWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Slave *slavePtr; Pixmap pixmap; Tk_Window tkwin = pwPtr->tkwin; @@ -1630,8 +1631,9 @@ PanedWindowReqProc( Tk_Window tkwin) /* Other Tk-related information about the * window. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + (void)tkwin; if (Tk_IsMapped(pwPtr->tkwin)) { if (!(pwPtr->flags & RESIZE_PENDING)) { @@ -1675,8 +1677,9 @@ PanedWindowLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = (PanedWindow *) slavePtr->masterPtr; + (void)tkwin; if (pwPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, pwPtr->tkwin); @@ -1714,8 +1717,8 @@ ArrangePanes( ClientData clientData) /* Structure describing parent whose slaves * are to be re-layed out. */ { - register PanedWindow *pwPtr = clientData; - register Slave *slavePtr; + PanedWindow *pwPtr = (PanedWindow *)clientData; + Slave *slavePtr; int i, slaveWidth, slaveHeight, slaveX, slaveY; int paneWidth, paneHeight, paneSize, paneMinSize; int doubleBw; @@ -2014,9 +2017,9 @@ ArrangePanes( static void Unlink( - register Slave *slavePtr) /* Window to unlink. */ + Slave *slavePtr) /* Window to unlink. */ { - register PanedWindow *masterPtr; + PanedWindow *masterPtr; int i, j; masterPtr = slavePtr->masterPtr; @@ -2160,7 +2163,7 @@ SlaveStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; PanedWindow *pwPtr = slavePtr->masterPtr; if (eventPtr->type == DestroyNotify) { @@ -2370,8 +2373,10 @@ ComputeGeometry( static void DestroyOptionTables( ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *interp) /* Pointer to the calling interp */ + Tcl_Interp *dummy) /* Pointer to the calling interp */ { + (void)dummy; + ckfree(clientData); } @@ -2394,7 +2399,7 @@ DestroyOptionTables( static Tcl_Obj * GetSticky( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the @@ -2403,6 +2408,8 @@ GetSticky( int sticky = *(int *)(recordPtr + internalOffset); char buffer[5]; char *p = &buffer[0]; + (void)dummy; + (void)tkwin; if (sticky & STICK_NORTH) { *p++ = 'n'; @@ -2442,7 +2449,7 @@ GetSticky( static int SetSticky( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, /* Current interp; may be used for errors. */ Tk_Window tkwin, /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. @@ -2458,6 +2465,8 @@ SetSticky( char c; void *internalPtr; const char *string; + (void)dummy; + (void)tkwin; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); @@ -2522,11 +2531,14 @@ SetSticky( static void RestoreSticky( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { + (void)dummy; + (void)tkwin; + *(int *)internalPtr = *(int *)oldInternalPtr; } @@ -2755,7 +2767,7 @@ ProxyWindowEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; if (eventPtr->type == Expose) { if (pwPtr->proxywin != NULL &&!(pwPtr->flags & PROXY_REDRAW_PENDING)) { @@ -2787,7 +2799,7 @@ static void DisplayProxyWindow( ClientData clientData) /* Information about window. */ { - PanedWindow *pwPtr = clientData; + PanedWindow *pwPtr = (PanedWindow *)clientData; Pixmap pixmap; Tk_Window tkwin = pwPtr->proxywin; pwPtr->flags &= ~PROXY_REDRAW_PENDING; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index a64a64b..00e3f7a 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -208,7 +208,7 @@ Tk_PlaceObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window main_win = clientData; + Tk_Window main_win = (Tk_Window)clientData; Tk_Window tkwin; Slave *slavePtr; TkDisplay *dispPtr; @@ -378,13 +378,13 @@ CreateSlave( Tk_OptionTable table) { Tcl_HashEntry *hPtr; - register Slave *slavePtr; + Slave *slavePtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->slaveTable, (char *) tkwin, &isNew); if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (Slave *)Tcl_GetHashValue(hPtr); } /* @@ -392,7 +392,7 @@ CreateSlave( * populate it with some default values. */ - slavePtr = ckalloc(sizeof(Slave)); + slavePtr = (Slave *)ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); slavePtr->tkwin = tkwin; slavePtr->inTkwin = NULL; @@ -452,14 +452,14 @@ static Slave * FindSlave( Tk_Window tkwin) /* Token for desired slave. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Slave *)Tcl_GetHashValue(hPtr); } /* @@ -483,8 +483,8 @@ static void UnlinkSlave( Slave *slavePtr) /* Slave structure to be unlinked. */ { - register Master *masterPtr; - register Slave *prevPtr; + Master *masterPtr; + Slave *prevPtr; masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { @@ -532,13 +532,13 @@ CreateMaster( Tk_Window tkwin) /* Token for desired master. */ { Tcl_HashEntry *hPtr; - register Master *masterPtr; + Master *masterPtr; int isNew; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_CreateHashEntry(&dispPtr->masterTable, (char *) tkwin, &isNew); if (isNew) { - masterPtr = ckalloc(sizeof(Master)); + masterPtr = (Master *)ckalloc(sizeof(Master)); masterPtr->tkwin = tkwin; masterPtr->slavePtr = NULL; masterPtr->abortPtr = NULL; @@ -547,7 +547,7 @@ CreateMaster( Tk_CreateEventHandler(masterPtr->tkwin, StructureNotifyMask, MasterStructureProc, masterPtr); } else { - masterPtr = Tcl_GetHashValue(hPtr); + masterPtr = (Master *)Tcl_GetHashValue(hPtr); } return masterPtr; } @@ -575,14 +575,14 @@ static Master * FindMaster( Tk_Window tkwin) /* Token for desired master. */ { - register Tcl_HashEntry *hPtr; + Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin); if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Master *)Tcl_GetHashValue(hPtr); } /* @@ -612,7 +612,7 @@ ConfigureSlave( int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { - register Master *masterPtr; + Master *masterPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; @@ -863,8 +863,8 @@ static void RecomputePlacement( ClientData clientData) /* Pointer to Master record. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr; + Master *masterPtr = (Master *)clientData; + Slave *slavePtr; int x, y, width, height, tmp; int masterWidth, masterHeight, masterX, masterY; double x1, y1, x2, y2; @@ -1084,8 +1084,8 @@ MasterStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Master *masterPtr = clientData; - register Slave *slavePtr, *nextPtr; + Master *masterPtr = (Master *)clientData; + Slave *slavePtr, *nextPtr; TkDisplay *dispPtr = ((TkWindow *) masterPtr->tkwin)->dispPtr; switch (eventPtr->type) { @@ -1163,7 +1163,7 @@ SlaveStructureProc( * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { @@ -1200,8 +1200,9 @@ PlaceRequestProc( ClientData clientData, /* Pointer to our record for slave. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; Master *masterPtr; + (void)tkwin; if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { @@ -1247,7 +1248,7 @@ PlaceLostSlaveProc( * stolen away. */ Tk_Window tkwin) /* Tk's handle for the slave window. */ { - register Slave *slavePtr = clientData; + Slave *slavePtr = (Slave *)clientData; TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { diff --git a/generic/tkPointer.c b/generic/tkPointer.c index a8f10ac..9213152 100644 --- a/generic/tkPointer.c +++ b/generic/tkPointer.c @@ -125,7 +125,7 @@ GenerateEnterLeave( int state) /* State flags. */ { int crossed = 0; /* 1 if mouse crossed a window boundary */ - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); TkWindow *restrictWinPtr = tsdPtr->restrictWinPtr; TkWindow *lastWinPtr = tsdPtr->lastWinPtr; @@ -218,7 +218,7 @@ Tk_UpdatePointer( int x, int y, /* Pointer location in root coords. */ int state) /* Modifier state mask. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); TkWindow *winPtr = (TkWindow *)tkwin; TkWindow *targetWinPtr; @@ -423,8 +423,15 @@ XGrabPointer( Cursor cursor, Time time) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)owner_events; + (void)event_mask; + (void)pointer_mode; + (void)keyboard_mode; + (void)confine_to; + (void)cursor; + (void)time; display->request++; tsdPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow(display, grab_window); @@ -458,8 +465,9 @@ XUngrabPointer( Display *display, Time time) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)time; display->request++; tsdPtr->grabWinPtr = NULL; @@ -489,7 +497,7 @@ void TkPointerDeadWindow( TkWindow *winPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr == tsdPtr->lastWinPtr) { @@ -536,7 +544,7 @@ UpdateCursor( TkWindow *winPtr) { Cursor cursor = None; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -582,8 +590,9 @@ XDefineCursor( Cursor cursor) { TkWindow *winPtr = (TkWindow *) Tk_IdToWindow(display, w); - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)cursor; if (tsdPtr->cursorWinPtr == winPtr) { UpdateCursor(winPtr); diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 6b679f8..42dcdb8 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -579,6 +579,7 @@ DeleteRectOval( Display *display) /* Display containing window for canvas. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; + (void)canvas; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); if (rectOvalPtr->fillColor != NULL) { @@ -752,6 +753,10 @@ DisplayRectOval( short x1, y1, x2, y2; Pixmap fillStipple; Tk_State state = itemPtr->state; + (void)x; + (void)y; + (void)width; + (void)height; /* * Compute the screen coordinates of the bounding box for the item. Make @@ -1446,6 +1451,7 @@ RectOvalToPostscript( Pixmap fillStipple; Tk_State state = itemPtr->state; Tcl_InterpState interpState; + (void)prepass; y1 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[1]); y2 = Tk_CanvasPsY(canvas, rectOvalPtr->bbox[3]); diff --git a/generic/tkScale.c b/generic/tkScale.c index 616d321..055e876 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -161,7 +161,7 @@ static void ComputeFormat(TkScale *scalePtr, int forTicks); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, int objc, Tcl_Obj *const objv[]); -static void DestroyScale(char *memPtr); +static void DestroyScale(void *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); static void ScaleCmdDeletedProc(ClientData clientData); @@ -248,14 +248,15 @@ ScaleRound( int Tk_ScaleObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - register TkScale *scalePtr; + TkScale *scalePtr; Tk_OptionTable optionTable; Tk_Window tkwin; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -385,7 +386,7 @@ ScaleWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; Tcl_Obj *objPtr; int index, result; @@ -540,9 +541,9 @@ ScaleWidgetObjCmd( static void DestroyScale( - char *memPtr) /* Info about scale widget. */ + void *memPtr) /* Info about scale widget. */ { - register TkScale *scalePtr = (TkScale *) memPtr; + TkScale *scalePtr = (TkScale *) memPtr; scalePtr->flags |= SCALE_DELETED; @@ -599,7 +600,7 @@ DestroyScale( static int ConfigureScale( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScale *scalePtr, /* Information about widget; may or may not + TkScale *scalePtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -769,7 +770,7 @@ ScaleWorldChanged( { XGCValues gcValues; GC gc; - TkScale *scalePtr = instanceData; + TkScale *scalePtr = (TkScale *)instanceData; gcValues.foreground = scalePtr->troughColorPtr->pixel; gc = Tk_GetGC(scalePtr->tkwin, GCForeground, &gcValues); @@ -1019,7 +1020,7 @@ ComputeFormat( static void ComputeScaleGeometry( - register TkScale *scalePtr) /* Information about widget. */ + TkScale *scalePtr) /* Information about widget. */ { char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, tickPixels, x, y, extraSpace; @@ -1163,7 +1164,7 @@ ScaleEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); @@ -1211,7 +1212,7 @@ static void ScaleCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; /* @@ -1248,7 +1249,7 @@ ScaleCmdDeletedProc( void TkEventuallyRedrawScale( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int what) /* What to redraw: REDRAW_SLIDER or * REDRAW_ALL. */ { @@ -1346,11 +1347,13 @@ ScaleVarProc( const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { - register TkScale *scalePtr = clientData; + TkScale *scalePtr = (TkScale *)clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; + (void)name1; + (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -1441,7 +1444,7 @@ ScaleVarProc( void TkScaleSetValue( - register TkScale *scalePtr, /* Info about widget. */ + TkScale *scalePtr, /* Info about widget. */ double value, /* New value for scale. Gets adjusted if it's * off the scale. */ int setVar, /* Non-zero means reflect new value through to @@ -1499,7 +1502,7 @@ TkScaleSetValue( static void ScaleSetVariable( - register TkScale *scalePtr) /* Info about widget. */ + TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; @@ -1535,7 +1538,7 @@ ScaleSetVariable( double TkScalePixelToValue( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ int x, int y) /* Coordinates of point within window. */ { double value, pixelRange; @@ -1593,7 +1596,7 @@ TkScalePixelToValue( int TkScaleValueToPixel( - register TkScale *scalePtr, /* Information about widget. */ + TkScale *scalePtr, /* Information about widget. */ double value) /* Reading of the widget. */ { int y, pixelRange; diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 5b0f6af..600c7d7 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -127,8 +127,8 @@ Tk_ScrollbarObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window tkwin = clientData; - register TkScrollbar *scrollPtr; + Tk_Window tkwin = (Tk_Window)clientData; + TkScrollbar *scrollPtr; Tk_Window newWin; if (objc < 2) { @@ -225,7 +225,7 @@ ScrollbarWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - register TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; int result = TCL_OK, cmdIndex; TkSizeT length; static const char *const commandNames[] = { @@ -524,7 +524,7 @@ ScrollbarWidgetObjCmd( static int ConfigureScrollbar( Tcl_Interp *interp, /* Used for error reporting. */ - register TkScrollbar *scrollPtr, + TkScrollbar *scrollPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of valid entries in argv. */ @@ -587,7 +587,7 @@ TkScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; if ((eventPtr->type == Expose) && (eventPtr->xexpose.count == 0)) { TkScrollbarEventuallyRedraw(scrollPtr); @@ -652,7 +652,7 @@ static void ScrollbarCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; /* diff --git a/generic/tkSelect.c b/generic/tkSelect.c index d4188b3..93a047f 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -125,7 +125,7 @@ Tk_CreateSelHandler( * listed in the ICCCM will be tolerated * (blech). */ { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->dispPtr->multipleAtom == None) { @@ -139,7 +139,7 @@ Tk_CreateSelHandler( for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) { if (selPtr == NULL) { - selPtr = ckalloc(sizeof(TkSelHandler)); + selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler)); selPtr->nextPtr = winPtr->selHandlerList; winPtr->selHandlerList = selPtr; break; @@ -177,7 +177,7 @@ Tk_CreateSelHandler( target = winPtr->dispPtr->utf8Atom; for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) { if (selPtr == NULL) { - selPtr = ckalloc(sizeof(TkSelHandler)); + selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler)); selPtr->nextPtr = winPtr->selHandlerList; winPtr->selHandlerList = selPtr; selPtr->selection = selection; @@ -239,9 +239,9 @@ Tk_DeleteSelHandler( * removed. */ { TkWindow *winPtr = (TkWindow *) tkwin; - register TkSelHandler *selPtr, *prevPtr; - register TkSelInProgress *ipPtr; - ThreadSpecificData *tsdPtr = + TkSelHandler *selPtr, *prevPtr; + TkSelInProgress *ipPtr; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -353,7 +353,7 @@ Tk_OwnSelection( ClientData clientData) /* Arbitrary one-word argument to pass to * proc. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; @@ -382,7 +382,7 @@ Tk_OwnSelection( } } if (infoPtr == NULL) { - infoPtr = ckalloc(sizeof(TkSelectionInfo)); + infoPtr = (TkSelectionInfo *)ckalloc(sizeof(TkSelectionInfo)); infoPtr->selection = selection; infoPtr->nextPtr = dispPtr->selectionInfoPtr; dispPtr->selectionInfoPtr = infoPtr; @@ -460,7 +460,7 @@ Tk_ClearSelection( Tk_Window tkwin, /* Window that selects a display. */ Atom selection) /* Selection to be cancelled. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; @@ -556,7 +556,7 @@ Tk_GetSelection( TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (dispPtr->multipleAtom == None) { @@ -577,7 +577,7 @@ Tk_GetSelection( } } if (infoPtr != NULL) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int offset, result, count; char buffer[TK_SEL_BYTES_AT_ONCE+1]; TkSelInProgress ip; @@ -670,7 +670,7 @@ Tk_SelectionObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; const char *path = NULL; Atom selection; const char *selName = NULL; @@ -830,7 +830,7 @@ Tk_SelectionObjCmd( Atom target, format; const char *targetName = NULL; const char *formatName = NULL; - register CommandInfo *cmdInfoPtr; + CommandInfo *cmdInfoPtr; TkSizeT cmdLength; static const char *const handleOptionStrings[] = { "-format", "-selection", "-type", NULL @@ -904,7 +904,7 @@ Tk_SelectionObjCmd( if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { - cmdInfoPtr = ckalloc(offsetof(CommandInfo, command) + cmdInfoPtr = (CommandInfo *)ckalloc(offsetof(CommandInfo, command) + 1 + cmdLength); cmdInfoPtr->interp = interp; cmdInfoPtr->charOffset = 0; @@ -919,7 +919,7 @@ Tk_SelectionObjCmd( } case SELECTION_OWN: { - register LostCommand *lostPtr; + LostCommand *lostPtr; Tcl_Obj *commandObj = NULL; static const char *const ownOptionStrings[] = { "-command", "-displayof", "-selection", NULL @@ -1008,7 +1008,7 @@ Tk_SelectionObjCmd( Tk_OwnSelection(tkwin, selection, NULL, NULL); return TCL_OK; } - lostPtr = ckalloc(sizeof(LostCommand)); + lostPtr = (LostCommand *)ckalloc(sizeof(LostCommand)); lostPtr->interp = interp; lostPtr->cmdObj = commandObj; Tcl_IncrRefCount(commandObj); @@ -1040,7 +1040,7 @@ Tk_SelectionObjCmd( TkSelInProgress * TkSelGetInProgress(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->pendingPtr; @@ -1067,7 +1067,7 @@ void TkSelSetInProgress( TkSelInProgress *pendingPtr) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->pendingPtr = pendingPtr; @@ -1092,12 +1092,12 @@ TkSelSetInProgress( void TkSelDeadWindow( - register TkWindow *winPtr) /* Window that's being deleted. */ + TkWindow *winPtr) /* Window that's being deleted. */ { - register TkSelHandler *selPtr; - register TkSelInProgress *ipPtr; + TkSelHandler *selPtr; + TkSelInProgress *ipPtr; TkSelectionInfo *infoPtr, *prevPtr, *nextPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1170,7 +1170,7 @@ TkSelInit( Tk_Window tkwin) /* Window token (used to find display to * initialize). */ { - register TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; /* * Fetch commonly-used atoms. @@ -1221,9 +1221,9 @@ TkSelInit( void TkSelClearSelection( Tk_Window tkwin, /* Window for which event was targeted. */ - register XEvent *eventPtr) /* X SelectionClear event. */ + XEvent *eventPtr) /* X SelectionClear event. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; @@ -1290,11 +1290,13 @@ static int SelGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ - Tcl_Interp *interp, /* Interpreter used for error reporting (not + Tcl_Interp *dummy, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend(clientData, portion, -1); + (void)dummy; + + Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); return TCL_OK; } @@ -1326,7 +1328,7 @@ HandleTclCommand( char *buffer, /* Place to store converted selection. */ int maxBytes) /* Maximum # of bytes to store at buffer. */ { - CommandInfo *cmdInfoPtr = clientData; + CommandInfo *cmdInfoPtr = (CommandInfo *)clientData; int length; Tcl_Obj *command; const char *string; @@ -1469,7 +1471,7 @@ TkSelDefaultSelection( Atom *typePtr) /* Store here the type of the selection, for * use in converting to proper X format. */ { - register TkWindow *winPtr = (TkWindow *) infoPtr->owner; + TkWindow *winPtr = (TkWindow *) infoPtr->owner; TkDisplay *dispPtr = winPtr->dispPtr; if (target == dispPtr->timestampAtom) { @@ -1482,7 +1484,7 @@ TkSelDefaultSelection( } if (target == dispPtr->targetsAtom) { - register TkSelHandler *selPtr; + TkSelHandler *selPtr; int length; Tcl_DString ds; @@ -1565,7 +1567,7 @@ static void LostSelection( ClientData clientData) /* Pointer to LostCommand structure. */ { - LostCommand *lostPtr = clientData; + LostCommand *lostPtr = (LostCommand *)clientData; Tcl_Interp *interp = lostPtr->interp; Tcl_InterpState savedState; int code; diff --git a/generic/tkSquare.c b/generic/tkSquare.c index 8421988..8bfa850 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -125,7 +125,7 @@ static int SquareWidgetObjCmd(ClientData clientData, int SquareObjCmd( - ClientData clientData, /* NULL. */ + ClientData dummy, /* NULL. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -133,6 +133,7 @@ SquareObjCmd( Square *squarePtr; Tk_Window tkwin; Tk_OptionTable optionTable; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -160,7 +161,7 @@ SquareObjCmd( * just the non-NULL/0 items. */ - squarePtr = ckalloc(sizeof(Square)); + squarePtr = (Square *)ckalloc(sizeof(Square)); memset(squarePtr, 0, sizeof(Square)); squarePtr->tkwin = tkwin; @@ -223,7 +224,7 @@ SquareWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; int result = TCL_OK; static const char *const squareOptions[] = {"cget", "configure", NULL}; enum { @@ -318,12 +319,13 @@ SquareWidgetObjCmd( static int SquareConfigure( - Tcl_Interp *interp, /* Used for error reporting. */ + Tcl_Interp *dummy, /* Used for error reporting. */ Square *squarePtr) /* Information about widget. */ { int borderWidth; Tk_3DBorder bgBorder; int doubleBuffer; + (void)dummy; /* * Set the background for the window and create a graphics context for use @@ -383,7 +385,7 @@ SquareObjEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; if (eventPtr->type == Expose) { if (!squarePtr->updatePending) { @@ -436,7 +438,7 @@ static void SquareDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; /* @@ -473,7 +475,7 @@ static void SquareDisplay( ClientData clientData) /* Information about window. */ { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; Pixmap pm = None; Drawable d; @@ -556,7 +558,7 @@ static void SquareDestroy( void *memPtr) /* Info about square widget. */ { - Square *squarePtr = memPtr; + Square *squarePtr = (Square *)memPtr; ckfree(squarePtr); } @@ -581,7 +583,7 @@ SquareDestroy( static void KeepInWindow( - register Square *squarePtr) /* Pointer to widget record. */ + Square *squarePtr) /* Pointer to widget record. */ { int i, bd, relief; int borderWidth, size; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index ce9615f..edfc091 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -30,7 +30,6 @@ #include "tkPlatDecls.h" #include "tkIntXlibDecls.h" -static const TkIntStubs tkIntStubs; MODULE_SCOPE const TkStubs tkStubs; /* @@ -83,12 +82,16 @@ static int TkWinGetPlatformId(void) { int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { + (void)tkwin; + (void)colormap; + /* dummy implementation, no need to do anything */ return 0; } void TkpSync(Display *display) { + (void)display; /* dummy implementation, no need to do anything */ } @@ -121,22 +124,21 @@ TkCreateXEventSource(void) */ #define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 0x00000004 +#ifdef __cplusplus +extern "C" { +#endif int __stdcall GetModuleHandleExW(unsigned int, const char *, void *); - -void *Tk_GetHINSTANCE() -{ - void *hInstance = NULL; - - GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (const char *) &tkIntStubs, &hInstance); - return hInstance; +#ifdef __cplusplus } +#endif void TkSetPixmapColormap( Pixmap pixmap, Colormap colormap) { + (void)pixmap; + (void)colormap; } void @@ -162,6 +164,9 @@ TkPutImage( unsigned int width, unsigned int height) /* Dimensions of subimage. */ { + (void)colors; + (void)ncolors; + return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height); } @@ -223,6 +228,9 @@ TkPutImage( unsigned int width, unsigned int height) /* Dimensions of subimage. */ { + (void)colors; + (void)ncolors; + return XPutImage(display, d, gc, image, src_x, src_y, dest_x, dest_y, width, height); } #endif /* MAC_OSX_TCL */ @@ -752,6 +760,8 @@ static const TkIntXlibStubs tkIntXlibStubs = { XSetIMValues, /* 154 */ XCreateFontSet, /* 155 */ XFreeStringList, /* 156 */ + XkbKeycodeToKeysym, /* 157 */ + XkbOpenDisplay, /* 158 */ #endif /* WIN */ #ifdef MAC_OSX_TCL /* MACOSX */ XSetDashes, /* 0 */ @@ -911,6 +921,8 @@ static const TkIntXlibStubs tkIntXlibStubs = { XSetIMValues, /* 154 */ XCreateFontSet, /* 155 */ XFreeStringList, /* 156 */ + XkbKeycodeToKeysym, /* 157 */ + XkbOpenDisplay, /* 158 */ #endif /* MACOSX */ }; @@ -1227,3 +1239,16 @@ const TkStubs tkStubs = { }; /* !END!: Do not edit above this line. */ + + +#ifdef __CYGWIN__ +void *Tk_GetHINSTANCE(void) +{ + void *hInstance = NULL; + + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, + (const char *) &tkIntStubs, &hInstance); + return hInstance; +} +#endif + diff --git a/generic/tkStubLib.c b/generic/tkStubLib.c index ea48894..aed0b80 100644 --- a/generic/tkStubLib.c +++ b/generic/tkStubLib.c @@ -77,10 +77,10 @@ Tk_InitStubs( { const char *packageName = "Tk"; const char *errMsg = NULL; - ClientData clientData = NULL; + void *clientData = NULL; const char *actualVersion = tclStubsPtr->tcl_PkgRequireEx(interp, packageName, version, 0, &clientData); - const TkStubs *stubsPtr = clientData; + const TkStubs *stubsPtr = (const TkStubs *)clientData; if (actualVersion == NULL) { return NULL; diff --git a/generic/tkStyle.c b/generic/tkStyle.c index e94ab52..9ec08ca 100644 --- a/generic/tkStyle.c +++ b/generic/tkStyle.c @@ -180,8 +180,9 @@ void TkStylePkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)mainPtr; if (tsdPtr->nbInit != 0) { return; @@ -235,12 +236,13 @@ void TkStylePkgFree( TkMainInfo *mainPtr) /* The application being deleted. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_HashSearch search; Tcl_HashEntry *entryPtr; StyleEngine *enginePtr; int i; + (void)mainPtr; tsdPtr->nbInit--; if (tsdPtr->nbInit != 0) { @@ -264,7 +266,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 +309,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 +333,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 +366,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 +391,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 +421,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 +456,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 +469,7 @@ Tk_GetStyleEngine( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Tk_StyleEngine)Tcl_GetHashValue(entryPtr); } /* @@ -523,6 +525,8 @@ static void FreeElement( Element *elementPtr) /* The element to free. */ { + (void)elementPtr; + /* Nothing to do. */ } @@ -604,7 +608,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 +646,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 +658,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 +690,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 +763,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 +790,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 +808,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 +848,7 @@ GetStyledElement( int elementId) /* Unique element ID */ { StyledElement *elementPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); StyleEngine *enginePtr2; @@ -924,7 +928,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 +1012,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); @@ -1090,7 +1094,7 @@ Tk_GetElementSize( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->getSize(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, width, height, inner, widthPtr, heightPtr); } @@ -1133,7 +1137,7 @@ Tk_GetElementBox( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->getBox(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, x, y, width, height, inner, xPtr, yPtr, widthPtr, heightPtr); } @@ -1166,7 +1170,7 @@ Tk_GetElementBorderWidth( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; return widgetSpecPtr->elementPtr->specPtr->getBorderWidth( - stylePtr->clientData, recordPtr, widgetSpecPtr->optionsPtr, tkwin); + stylePtr->clientData, (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin); } /* @@ -1201,7 +1205,7 @@ Tk_DrawElement( StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; widgetSpecPtr->elementPtr->specPtr->draw(stylePtr->clientData, - recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width, + (char *)recordPtr, widgetSpecPtr->optionsPtr, tkwin, d, x, y, width, height, state); } @@ -1229,7 +1233,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 +1257,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 +1348,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 +1365,7 @@ Tk_GetStyle( } return NULL; } - stylePtr = Tcl_GetHashValue(entryPtr); - - return (Tk_Style) stylePtr; + return (Tk_Style)Tcl_GetHashValue(entryPtr); } /* @@ -1381,6 +1382,7 @@ void Tk_FreeStyle( Tk_Style style) { + (void)style; } /* @@ -1410,7 +1412,7 @@ Tk_AllocStyleFromObj( return NULL; } } - return objPtr->internalRep.twoPtrValue.ptr1; + return (Tk_Style)objPtr->internalRep.twoPtrValue.ptr1; } /* diff --git a/generic/tkTest.c b/generic/tkTest.c index e697bf3..b0cff05 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -48,7 +48,14 @@ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT +#ifdef __cplusplus +extern "C" { +#endif EXTERN int Tktest_Init(Tcl_Interp *interp); +#ifdef __cplusplus +} +#endif + /* * The following data structure represents the master for a test image: */ @@ -340,6 +347,7 @@ TestbitmapObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "bitmap"); @@ -375,6 +383,7 @@ TestborderObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "border"); @@ -410,6 +419,8 @@ TestcolorObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; + if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "color"); return TCL_ERROR; @@ -444,6 +455,8 @@ TestcursorObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)clientData; + if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "cursor"); return TCL_ERROR; @@ -480,6 +493,10 @@ TestdeleteappsObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { NewApp *nextPtr; + (void)clientData; + (void)interp; + (void)objc; + (void)objv; while (newAppPtr != NULL) { nextPtr = newAppPtr->nextPtr; @@ -537,7 +554,7 @@ TestobjconfigObjCmd( CustomOptionFree, INT2PTR(1) }; - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin; int index, result = TCL_OK; @@ -651,14 +668,14 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(TypesRecord)); + recordPtr = (TypesRecord *)ckalloc(sizeof(TypesRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -706,7 +723,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -715,7 +732,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, baseSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -759,7 +776,7 @@ TestobjconfigObjCmd( Tk_Window tkwin; Tk_OptionTable optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; @@ -768,7 +785,7 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, extensionSpecs); tables[index] = optionTable; - recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); + recordPtr = (ExtensionWidgetRecord *)ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -929,14 +946,14 @@ TestobjconfigObjCmd( optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; - tkwin = Tk_CreateWindowFromPath(interp, clientData, + tkwin = Tk_CreateWindowFromPath(interp, (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(InternalRecord)); + recordPtr = (InternalRecord *)ckalloc(sizeof(InternalRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; @@ -1009,7 +1026,7 @@ TestobjconfigObjCmd( return TCL_ERROR; } - recordPtr = ckalloc(sizeof(FiveRecord)); + recordPtr = (FiveRecord *)ckalloc(sizeof(FiveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, smallSpecs); @@ -1081,14 +1098,14 @@ TestobjconfigObjCmd( {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, - clientData, Tcl_GetString(objv[2]), NULL); + (Tk_Window)clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); - recordPtr = ckalloc(sizeof(SlaveRecord)); + recordPtr = (SlaveRecord *)ckalloc(sizeof(SlaveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, slaveSpecs); @@ -1158,7 +1175,7 @@ TrivialConfigObjCmd( }; Tcl_Obj *resultObjPtr; int index, mask; - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; Tk_SavedOptions saved; @@ -1253,7 +1270,7 @@ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { @@ -1292,7 +1309,7 @@ TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { - TrivialCommandHeader *headerPtr = clientData; + TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { @@ -1338,7 +1355,7 @@ TestfontObjCmd( Tk_Window tkwin; Tk_Font tkfont; - tkwin = clientData; + tkwin = (Tk_Window)clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); @@ -1402,6 +1419,7 @@ ImageCreate( TImageMaster *timPtr; const char *varName; int i; + (void)typePtr; varName = "log"; for (i = 0; i < objc; i += 2) { @@ -1418,14 +1436,14 @@ ImageCreate( varName = Tcl_GetString(objv[i+1]); } - timPtr = ckalloc(sizeof(TImageMaster)); + timPtr = (TImageMaster *)ckalloc(sizeof(TImageMaster)); timPtr->master = master; timPtr->interp = interp; timPtr->width = 30; timPtr->height = 15; - timPtr->imageName = ckalloc(strlen(name) + 1); + timPtr->imageName = (char *)ckalloc(strlen(name) + 1); strcpy(timPtr->imageName, name); - timPtr->varName = ckalloc(strlen(varName) + 1); + timPtr->varName = (char *)ckalloc(strlen(varName) + 1); strcpy(timPtr->varName, varName); Tcl_CreateObjCommand(interp, name, ImageObjCmd, timPtr, NULL); *clientDataPtr = timPtr; @@ -1458,7 +1476,7 @@ ImageObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; int x, y, width, height; if (objc < 2) { @@ -1513,7 +1531,7 @@ ImageGet( * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; @@ -1522,7 +1540,7 @@ ImageGet( Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); - instPtr = ckalloc(sizeof(TImageInstance)); + instPtr = (TImageInstance *)ckalloc(sizeof(TImageInstance)); instPtr->masterPtr = timPtr; instPtr->fg = Tk_GetColor(timPtr->interp, tkwin, "#ff0000"); gcValues.foreground = instPtr->fg->pixel; @@ -1560,7 +1578,7 @@ ImageDisplay( /* Coordinates in drawable corresponding to * imageX and imageY. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; /* @@ -1635,7 +1653,7 @@ ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { - TImageInstance *instPtr = clientData; + TImageInstance *instPtr = (TImageInstance *)clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); @@ -1669,7 +1687,7 @@ ImageDelete( * this function is called, no more instances * exist. */ { - TImageMaster *timPtr = clientData; + TImageMaster *timPtr = (TImageMaster *)clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); @@ -1708,7 +1726,7 @@ TestmakeexistObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; int i; Tk_Window tkwin; @@ -1751,7 +1769,7 @@ TestmenubarObjCmd( Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; Tk_Window tkwin, menubar; if (objc < 2) { @@ -1811,13 +1829,14 @@ TestmenubarObjCmd( #if defined(_WIN32) static int TestmetricsObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { char buf[TCL_INTEGER_SPACE]; int val; + (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); @@ -1864,7 +1883,7 @@ TestpropObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { - Tk_Window mainWin = clientData; + Tk_Window mainWin = (Tk_Window)clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; @@ -1936,7 +1955,7 @@ TestpropObjCmd( /* ARGSUSED */ static int TestprintfObjCmd( - ClientData clientData, /* Not used */ + ClientData dummy, /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1948,6 +1967,7 @@ TestprintfObjCmd( #else long long longLongInt; #endif + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "wideint"); @@ -2005,7 +2025,7 @@ TestwrapperObjCmd( return TCL_ERROR; } - tkwin = clientData; + tkwin = (Tk_Window)clientData; winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; @@ -2050,7 +2070,7 @@ TestwrapperObjCmd( static int CustomOptionSet( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj **value, @@ -2061,6 +2081,8 @@ CustomOptionSet( { int objEmpty; char *newStr, *string, *internalPtr; + (void)dummy; + (void)tkwin; objEmpty = 0; @@ -2097,7 +2119,7 @@ CustomOptionSet( if (internalPtr != NULL) { if (*value != NULL) { string = Tcl_GetString(*value); - newStr = ckalloc((*value)->length + 1); + newStr = (char *)ckalloc((*value)->length + 1); strcpy(newStr, string); } else { newStr = NULL; @@ -2111,31 +2133,40 @@ CustomOptionSet( static Tcl_Obj * CustomOptionGet( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, int internalOffset) { + (void)dummy; + (void)tkwin; + return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1)); } static void CustomOptionRestore( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, char *saveInternalPtr) { + (void)dummy; + (void)tkwin; + *(char **)internalPtr = *(char **)saveInternalPtr; return; } static void CustomOptionFree( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr) { + (void)dummy; + (void)tkwin; + if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } @@ -2172,6 +2203,7 @@ TestPhotoStringMatchCmd( Tcl_Obj *dummy = NULL; Tcl_Obj *resultObj[2]; int width, height; + (void)clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "imageData"); diff --git a/generic/tkText.c b/generic/tkText.c index 33fa1d0..807ea48 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -461,7 +461,7 @@ Tk_TextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -502,7 +502,7 @@ CreateWidget( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkText *textPtr; + TkText *textPtr; Tk_OptionTable optionTable; TkTextIndex startIndex; Tk_Window newWin; @@ -523,7 +523,7 @@ CreateWidget( * and 'insert', 'current' mark pointers are all NULL to start. */ - textPtr = ckalloc(sizeof(TkText)); + textPtr = (TkText *)ckalloc(sizeof(TkText)); memset(textPtr, 0, sizeof(TkText)); textPtr->tkwin = newWin; @@ -534,7 +534,7 @@ CreateWidget( textPtr, TextCmdDeletedProc); if (sharedPtr == NULL) { - sharedPtr = ckalloc(sizeof(TkSharedText)); + sharedPtr = (TkSharedText *)ckalloc(sizeof(TkSharedText)); memset(sharedPtr, 0, sizeof(TkSharedText)); sharedPtr->refCount = 0; @@ -632,7 +632,7 @@ CreateWidget( */ textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL); - textPtr->selTagPtr->reliefString = + textPtr->selTagPtr->reliefString = (char *) ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF)); strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF); Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief); @@ -699,7 +699,7 @@ TextWidgetObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int result = TCL_OK; int index; @@ -1125,7 +1125,7 @@ TextWidgetObjCmd( objc -= 2; objv += 2; - indices = ckalloc((objc + 1) * sizeof(TkTextIndex)); + indices = (TkTextIndex *)ckalloc((objc + 1) * sizeof(TkTextIndex)); /* * First pass verifies that all indices are valid. @@ -1153,7 +1153,7 @@ TextWidgetObjCmd( COUNT_INDICES); objc++; } - useIdx = ckalloc(objc); + useIdx = (char *)ckalloc(objc); memset(useIdx, 0, objc); /* @@ -1607,7 +1607,7 @@ SharedTextObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - register TkSharedText *sharedPtr = clientData; + TkSharedText *sharedPtr = (TkSharedText *)clientData; int result = TCL_OK; int index; @@ -1977,7 +1977,7 @@ DestroyText( for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->windowTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { TkTextEmbWindowClient *loop; - TkTextSegment *ewPtr = Tcl_GetHashValue(hPtr); + TkTextSegment *ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); loop = ewPtr->body.ew.clients; if (loop->textPtr == textPtr) { @@ -2009,7 +2009,7 @@ DestroyText( for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); /* * No need to use 'TkTextDeleteTag' since we've already removed @@ -2075,7 +2075,7 @@ DestroyText( static int ConfigureText( Tcl_Interp *interp, /* Used for error reporting. */ - register TkText *textPtr, /* Information about widget; may or may not + TkText *textPtr, /* Information about widget; may or may not * already have values for some fields. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2378,7 +2378,7 @@ static void TextWorldChangedCallback( ClientData instanceData) /* Information about widget. */ { - TkText *textPtr = instanceData; + TkText *textPtr = (TkText *)instanceData; TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY); } @@ -2467,9 +2467,9 @@ TextWorldChanged( static void TextEventProc( ClientData clientData, /* Information about window. */ - register XEvent *eventPtr) /* Information about event. */ + XEvent *eventPtr) /* Information about event. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex index, index2; if (eventPtr->type == Expose) { @@ -2578,7 +2578,7 @@ static void TextCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { - TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; Tk_Window tkwin = textPtr->tkwin; /* @@ -2663,7 +2663,7 @@ InsertChars( resetViewCount = 0; if (sharedTextPtr->refCount > PIXEL_CLIENTS) { - lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); + lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } @@ -2961,7 +2961,7 @@ TextUndoRedoCallback( Tcl_Obj *objPtr) /* Arguments of a command to be handled by the * shared text data structure. */ { - TkSharedText *sharedPtr = clientData; + TkSharedText *sharedPtr = (TkSharedText *)clientData; int res, objc; Tcl_Obj **objv; TkText *textPtr; @@ -3200,9 +3200,7 @@ DeleteIndexRange( for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - TkTextTag *tagPtr = Tcl_GetHashValue(hPtr); - - TkBTreeTag(&index1, &index2, tagPtr, 0); + TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0); } /* @@ -3236,7 +3234,7 @@ DeleteIndexRange( resetViewCount = 0; if (sharedTextPtr->refCount > PIXEL_CLIENTS) { - lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); + lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount); } else { lineAndByteIndex = pixels; } @@ -3425,7 +3423,7 @@ TextFetchSelection( * not including terminating NULL * character. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex eof; int count, chunkSize, offsetInSeg; TkTextSearch search; @@ -3556,7 +3554,7 @@ void TkTextLostSelection( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; if (TkpAlwaysShowSelection(textPtr->tkwin)) { TkTextIndex start, end; @@ -3641,7 +3639,7 @@ static void TextBlinkProc( ClientData clientData) /* Pointer to record describing text. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TkTextIndex index; int x, y, w, h, charWidth; @@ -4021,7 +4019,7 @@ TextSearchGetLineIndex( { const TkTextIndex *indexPtr; int line; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr); if (indexPtr == NULL) { @@ -4086,7 +4084,7 @@ TextSearchIndexInLine( TkTextSegment *segPtr; TkTextIndex curIndex; int index, leftToScan; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; index = 0; curIndex.tree = textPtr->sharedTextPtr->tree; @@ -4156,7 +4154,7 @@ TextSearchAddNextLine( TkTextLine *linePtr, *thisLinePtr; TkTextIndex curIndex; TkTextSegment *segPtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; int nothingYet = 1; /* @@ -4278,7 +4276,7 @@ TextSearchFoundMatch( TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { /* @@ -4329,7 +4327,7 @@ TextSearchFoundMatch( * reached the end of the match or we have reached the end of the line. */ - linePtr = clientData; + linePtr = (TkTextLine *)clientData; if (linePtr == NULL) { linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr, lineNum); @@ -4539,7 +4537,7 @@ TkTextGetTabs( * Parse the elements of the list one at a time to fill in the array. */ - tabArrayPtr = ckalloc(sizeof(TkTextTabArray) + tabArrayPtr = (TkTextTabArray *)ckalloc(sizeof(TkTextTabArray) + (count - 1) * sizeof(TkTextTab)); tabArrayPtr->numTabs = 0; prevStop = 0.0; @@ -4666,7 +4664,7 @@ TkTextGetTabs( static int TextDumpCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -4903,7 +4901,7 @@ DumpLine( */ int length = last - first; - char *range = ckalloc(length + 1); + char *range = (char *)ckalloc(length + 1); memcpy(range, segPtr->body.chars + first, length); range[length] = '\0'; @@ -4934,7 +4932,7 @@ DumpLine( name = NULL; lineChanged = 0; } else { - name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, + name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, markPtr->hPtr); } if (name != NULL) { @@ -5064,6 +5062,7 @@ DumpSegment( { char buffer[TK_POS_CHARS]; Tcl_Obj *values[3], *tuple; + (void)what; TkTextPrintIndex(textPtr, index, buffer); values[0] = Tcl_NewStringObj(key, -1); @@ -5599,7 +5598,7 @@ void TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { @@ -5673,7 +5672,7 @@ SearchPerform( if (toPtr != NULL) { const TkTextIndex *indexToPtr, *indexFromPtr; - TkText *textPtr = searchSpecPtr->clientData; + TkText *textPtr = (TkText *)searchSpecPtr->clientData; indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr); if (indexToPtr == NULL) { @@ -6515,7 +6514,7 @@ SearchCore( * matches on the heap. */ - TkSizeT *newArray = + TkSizeT *newArray = (TkSizeT *) ckalloc(4 * matchNum * sizeof(TkSizeT)); memcpy(newArray, storeMatch, matchNum*sizeof(TkSizeT)); memcpy(newArray + 2*matchNum, storeLength, @@ -6776,13 +6775,15 @@ SearchCore( static Tcl_Obj * GetLineStartEnd( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *recordPtr, /* Pointer to widget record. */ int internalOffset) /* Offset within *recordPtr containing the * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); + (void)dummy; + (void)tkwin; if (linePtr == NULL) { return Tcl_NewObj(); @@ -6811,7 +6812,7 @@ GetLineStartEnd( static int SetLineStartEnd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, /* Current interp; may be used for errors. */ Tk_Window tkwin, /* Window for which option is being set. */ Tcl_Obj **value, /* Pointer to the pointer to the value object. @@ -6826,6 +6827,8 @@ SetLineStartEnd( TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; + (void)dummy; + (void)tkwin; if (internalOffset >= 0) { internalPtr = (char *)recordPtr + internalOffset; @@ -6870,11 +6873,14 @@ SetLineStartEnd( static void RestoreLineStartEnd( - ClientData clientData, + ClientData dummy, Tk_Window tkwin, char *internalPtr, /* Pointer to storage for value. */ char *oldInternalPtr) /* Pointer to old value. */ { + (void)dummy; + (void)tkwin; + *(TkTextLine **)internalPtr = *(TkTextLine **)oldInternalPtr; } @@ -6929,17 +6935,18 @@ ObjectIsEmpty( int TkpTesttextCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; - TkSizeT len; + size_t len; int lineIndex, byteIndex, byteOffset; TkTextIndex index; char buf[64]; Tcl_CmdInfo info; + (void)dummy; if (objc < 3) { return TCL_ERROR; @@ -6948,7 +6955,7 @@ TkpTesttextCmd( if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) == 0) { return TCL_ERROR; } - textPtr = info.objClientData; + textPtr = (TkText *)info.objClientData; len = strlen(Tcl_GetString(objv[2])); if (strncmp(Tcl_GetString(objv[2]), "byteindex", len) == 0) { if (objc != 5) { diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 07c3bbd..ced1e2e 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -261,10 +261,10 @@ TkTextBTree TkBTreeCreate( TkSharedText *sharedTextPtr) { - register BTree *treePtr; - register Node *rootPtr; - register TkTextLine *linePtr, *linePtr2; - register TkTextSegment *segPtr; + BTree *treePtr; + Node *rootPtr; + TkTextLine *linePtr, *linePtr2; + TkTextSegment *segPtr; /* * The tree will initially have two empty lines. The second line isn't @@ -273,9 +273,9 @@ TkBTreeCreate( * of the tree. */ - rootPtr = ckalloc(sizeof(Node)); - linePtr = ckalloc(sizeof(TkTextLine)); - linePtr2 = ckalloc(sizeof(TkTextLine)); + rootPtr = (Node *)ckalloc(sizeof(Node)); + linePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine)); + linePtr2 = (TkTextLine *)ckalloc(sizeof(TkTextLine)); rootPtr->parentPtr = NULL; rootPtr->nextPtr = NULL; @@ -296,7 +296,7 @@ TkBTreeCreate( linePtr->parentPtr = rootPtr; linePtr->nextPtr = linePtr2; - segPtr = ckalloc(CSEG_SIZE(1)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1)); linePtr->segPtr = segPtr; segPtr->typePtr = &tkTextCharType; segPtr->nextPtr = NULL; @@ -306,7 +306,7 @@ TkBTreeCreate( linePtr2->parentPtr = rootPtr; linePtr2->nextPtr = NULL; - segPtr = ckalloc(CSEG_SIZE(1)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(1)); linePtr2->segPtr = segPtr; segPtr->typePtr = &tkTextCharType; segPtr->nextPtr = NULL; @@ -314,7 +314,7 @@ TkBTreeCreate( segPtr->body.chars[0] = '\n'; segPtr->body.chars[1] = 0; - treePtr = ckalloc(sizeof(BTree)); + treePtr = (BTree *)ckalloc(sizeof(BTree)); treePtr->sharedTextPtr = sharedTextPtr; treePtr->rootPtr = rootPtr; treePtr->clients = 0; @@ -366,7 +366,7 @@ TkBTreeAddClient( int defaultHeight) /* Default line height for the new client, or * -1 if no pixel heights are to be kept. */ { - register BTree *treePtr = (BTree *) tree; + BTree *treePtr = (BTree *) tree; if (treePtr == NULL) { Tcl_Panic("NULL treePtr in TkBTreeAddClient"); @@ -632,9 +632,9 @@ AdjustStartEndRefs( i++; } treePtr->startEndCount = count; - treePtr->startEnd = ckrealloc(treePtr->startEnd, + treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd, sizeof(TkTextLine *) * count); - treePtr->startEndRef = ckrealloc(treePtr->startEndRef, + treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef, sizeof(TkText *) * count); } if ((action & TEXT_ADD_REFS) @@ -650,9 +650,9 @@ AdjustStartEndRefs( count = treePtr->startEndCount; - treePtr->startEnd = ckrealloc(treePtr->startEnd, + treePtr->startEnd = (TkTextLine **)ckrealloc(treePtr->startEnd, sizeof(TkTextLine *) * count); - treePtr->startEndRef = ckrealloc(treePtr->startEndRef, + treePtr->startEndRef = (TkText **)ckrealloc(treePtr->startEndRef, sizeof(TkText *) * count); if (textPtr->start != NULL) { @@ -725,7 +725,7 @@ AdjustPixelClient( loopPtr = loopPtr->nextPtr; } } else { - register TkTextLine *linePtr = nodePtr->children.linePtr; + TkTextLine *linePtr = nodePtr->children.linePtr; while (linePtr != NULL) { if (!*counting && (linePtr == start)) { @@ -735,7 +735,7 @@ AdjustPixelClient( *counting = 0; } if (newPixelReferences != treePtr->pixelReferences) { - linePtr->pixels = ckrealloc(linePtr->pixels, + linePtr->pixels = (int *)ckrealloc(linePtr->pixels, sizeof(int) * 2 * newPixelReferences); } @@ -752,7 +752,7 @@ AdjustPixelClient( } } if (newPixelReferences != treePtr->pixelReferences) { - nodePtr->numPixels = ckrealloc(nodePtr->numPixels, + nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels, sizeof(int) * newPixelReferences); } nodePtr->numPixels[useReference] = pixelCount; @@ -802,7 +802,7 @@ RemovePixelClient( ckfree(nodePtr->numPixels); nodePtr->numPixels = NULL; } else { - nodePtr->numPixels = ckrealloc(nodePtr->numPixels, + nodePtr->numPixels = (int *)ckrealloc(nodePtr->numPixels, sizeof(int) * (treePtr->pixelReferences - 1)); } if (nodePtr->level != 0) { @@ -812,7 +812,7 @@ RemovePixelClient( nodePtr = nodePtr->nextPtr; } } else { - register TkTextLine *linePtr = nodePtr->children.linePtr; + TkTextLine *linePtr = nodePtr->children.linePtr; while (linePtr != NULL) { if (overwriteWithLast != -1) { linePtr->pixels[2*overwriteWithLast] = @@ -823,7 +823,7 @@ RemovePixelClient( if (treePtr->pixelReferences == 1) { linePtr->pixels = NULL; } else { - linePtr->pixels = ckrealloc(linePtr->pixels, + linePtr->pixels = (int *)ckrealloc(linePtr->pixels, sizeof(int) * 2 * (treePtr->pixelReferences-1)); } linePtr = linePtr->nextPtr; @@ -850,7 +850,7 @@ RemovePixelClient( static void DestroyNode( - register Node *nodePtr) /* Destroy from this node downwards. */ + Node *nodePtr) /* Destroy from this node downwards. */ { if (nodePtr->level == 0) { TkTextLine *linePtr; @@ -868,7 +868,7 @@ DestroyNode( ckfree(linePtr); } } else { - register Node *childPtr; + Node *childPtr; while (nodePtr->children.nodePtr != NULL) { childPtr = nodePtr->children.nodePtr; @@ -900,10 +900,10 @@ DestroyNode( static void DeleteSummaries( - register Summary *summaryPtr) + Summary *summaryPtr) /* First in list of node's tag summaries. */ { - register Summary *nextPtr; + Summary *nextPtr; while (summaryPtr != NULL) { nextPtr = summaryPtr->nextPtr; @@ -932,7 +932,7 @@ DeleteSummaries( int TkBTreeAdjustPixelHeight( const TkText *textPtr, /* Client of the B-tree. */ - register TkTextLine *linePtr, + TkTextLine *linePtr, /* The logical line to update. */ int newPixelHeight, /* The line's known height in pixels. */ int mergedLogicalLines) /* The number of extra logical lines which @@ -942,7 +942,7 @@ TkBTreeAdjustPixelHeight( * height associated with the given * linePtr. */ { - register Node *nodePtr; + Node *nodePtr; int changeToPixelCount; /* Counts change to total number of pixels in * file. */ int pixelReference = textPtr->pixelReference; @@ -1001,7 +1001,7 @@ TkBTreeAdjustPixelHeight( void TkBTreeInsertChars( TkTextBTree tree, /* Tree to insert into. */ - register TkTextIndex *indexPtr, + TkTextIndex *indexPtr, /* Indicates where to insert text. When the * function returns, this index is no longer * valid because of changes to the segment @@ -1009,8 +1009,8 @@ TkBTreeInsertChars( const char *string) /* Pointer to bytes to insert (may contain * newlines, must be null-terminated). */ { - register Node *nodePtr; - register TkTextSegment *prevPtr; + Node *nodePtr; + TkTextSegment *prevPtr; /* The segment just before the first new * segment (NULL means new segment is at * beginning of line). */ @@ -1019,10 +1019,10 @@ TkBTreeInsertChars( * insert at beginning of line. */ TkTextLine *linePtr; /* Current line (new segments are added to * this line). */ - register TkTextSegment *segPtr; + TkTextSegment *segPtr; TkTextLine *newLinePtr; size_t chunkSize; /* # characters in current chunk. */ - register const char *eol; /* Pointer to character just after last one in + const char *eol; /* Pointer to character just after last one in * current chunk. */ int changeToLineCount; /* Counts change to total number of lines in * file. */ @@ -1044,7 +1044,7 @@ TkBTreeInsertChars( changeToLineCount = 0; if (treePtr->pixelReferences > PIXEL_CLIENTS) { - changeToPixelCount = ckalloc(sizeof(int) * treePtr->pixelReferences); + changeToPixelCount = (int *)ckalloc(sizeof(int) * treePtr->pixelReferences); } else { changeToPixelCount = pixels; } @@ -1060,7 +1060,7 @@ TkBTreeInsertChars( } } chunkSize = eol-string; - segPtr = ckalloc(CSEG_SIZE(chunkSize)); + segPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(chunkSize)); segPtr->typePtr = &tkTextCharType; if (curPtr == NULL) { segPtr->nextPtr = linePtr->segPtr; @@ -1082,8 +1082,8 @@ TkBTreeInsertChars( * the remainder of the old line to it. */ - newLinePtr = ckalloc(sizeof(TkTextLine)); - newLinePtr->pixels = + newLinePtr = (TkTextLine *)ckalloc(sizeof(TkTextLine)); + newLinePtr->pixels = (int *) ckalloc(sizeof(int) * 2 * treePtr->pixelReferences); newLinePtr->parentPtr = linePtr->parentPtr; @@ -1312,10 +1312,10 @@ CleanupLine( void TkBTreeDeleteIndexRange( TkTextBTree tree, /* Tree to delete from. */ - register TkTextIndex *index1Ptr, + TkTextIndex *index1Ptr, /* Indicates first character that is to be * deleted. */ - register TkTextIndex *index2Ptr) + TkTextIndex *index2Ptr) /* Indicates character just after the last one * that is to be deleted. */ { @@ -1596,8 +1596,8 @@ TkBTreeFindLine( int line) /* Index of desired line. */ { BTree *treePtr = (BTree *) tree; - register Node *nodePtr; - register TkTextLine *linePtr; + Node *nodePtr; + TkTextLine *linePtr; if (treePtr == NULL) { treePtr = (BTree *) textPtr->sharedTextPtr->tree; @@ -1686,8 +1686,8 @@ TkBTreeFindPixelLine( int *pixelOffset) /* Used to return offset. */ { BTree *treePtr = (BTree *) tree; - register Node *nodePtr; - register TkTextLine *linePtr; + Node *nodePtr; + TkTextLine *linePtr; int pixelReference = textPtr->pixelReference; nodePtr = treePtr->rootPtr; @@ -1755,10 +1755,10 @@ TkBTreeFindPixelLine( TkTextLine * TkBTreeNextLine( const TkText *textPtr, /* Next line in the context of this client. */ - register TkTextLine *linePtr) + TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register Node *nodePtr; + Node *nodePtr; if (linePtr->nextPtr != NULL) { if (textPtr != NULL && (linePtr == textPtr->end)) { @@ -1811,12 +1811,12 @@ TkBTreeNextLine( TkTextLine * TkBTreePreviousLine( TkText *textPtr, /* Relative to this client of the B-tree. */ - register TkTextLine *linePtr) + TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register Node *nodePtr; - register Node *node2Ptr; - register TkTextLine *prevPtr; + Node *nodePtr; + Node *node2Ptr; + TkTextLine *prevPtr; if (textPtr != NULL && textPtr->start == linePtr) { return NULL; @@ -1895,8 +1895,8 @@ TkBTreePixelsTo( const TkText *textPtr, /* Relative to this client of the B-tree. */ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register TkTextLine *linePtr2; - register Node *nodePtr, *parentPtr; + TkTextLine *linePtr2; + Node *nodePtr, *parentPtr; int index; int pixelReference = textPtr->pixelReference; @@ -1921,7 +1921,7 @@ TkBTreePixelsTo( for (parentPtr = nodePtr->parentPtr ; parentPtr != NULL; nodePtr = parentPtr, parentPtr = parentPtr->parentPtr) { - register Node *nodePtr2; + Node *nodePtr2; for (nodePtr2 = parentPtr->children.nodePtr; nodePtr2 != nodePtr; nodePtr2 = nodePtr2->nextPtr) { @@ -1957,8 +1957,8 @@ TkBTreeLinesTo( const TkText *textPtr, /* Relative to this client of the B-tree. */ TkTextLine *linePtr) /* Pointer to existing line in B-tree. */ { - register TkTextLine *linePtr2; - register Node *nodePtr, *parentPtr, *nodePtr2; + TkTextLine *linePtr2; + Node *nodePtr, *parentPtr, *nodePtr2; int index; /* @@ -2046,7 +2046,7 @@ TkBTreeLinkSegment( TkTextIndex *indexPtr) /* Where to add segment: it gets linked in * just before the segment indicated here. */ { - register TkTextSegment *prevPtr; + TkTextSegment *prevPtr; prevPtr = SplitSeg(indexPtr); if (prevPtr == NULL) { @@ -2086,7 +2086,7 @@ TkBTreeUnlinkSegment( TkTextSegment *segPtr, /* Segment to be unlinked. */ TkTextLine *linePtr) /* Line that currently contains segment. */ { - register TkTextSegment *prevPtr; + TkTextSegment *prevPtr; if (linePtr->segPtr == segPtr) { linePtr->segPtr = segPtr->nextPtr; @@ -2135,9 +2135,9 @@ TkBTreeUnlinkSegment( int TkBTreeTag( - register TkTextIndex *index1Ptr, + TkTextIndex *index1Ptr, /* Indicates first character in range. */ - register TkTextIndex *index2Ptr, + TkTextIndex *index2Ptr, /* Indicates character just after the last one * in range. */ TkTextTag *tagPtr, /* Tag to add or remove. */ @@ -2157,7 +2157,7 @@ TkBTreeTag( oldState = TkBTreeCharTagged(index1Ptr, tagPtr); if ((add != 0) ^ oldState) { - segPtr = ckalloc(TSEG_SIZE); + segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE); segPtr->typePtr = (add) ? &tkTextToggleOnType : &tkTextToggleOffType; prevPtr = SplitSeg(index1Ptr); if (prevPtr == NULL) { @@ -2228,7 +2228,7 @@ TkBTreeTag( } } if ((add != 0) ^ oldState) { - segPtr = ckalloc(TSEG_SIZE); + segPtr = (TkTextSegment *)ckalloc(TSEG_SIZE); segPtr->typePtr = (add) ? &tkTextToggleOffType : &tkTextToggleOnType; prevPtr = SplitSeg(index2Ptr); if (prevPtr == NULL) { @@ -2285,14 +2285,14 @@ TkBTreeTag( static void ChangeNodeToggleCount( - register Node *nodePtr, /* Node whose toggle count for a tag must be + Node *nodePtr, /* Node whose toggle count for a tag must be * changed. */ TkTextTag *tagPtr, /* Information about tag. */ int delta) /* Amount to add to current toggle count for * tag (may be negative). */ { - register Summary *summaryPtr, *prevPtr; - register Node *node2Ptr; + Summary *summaryPtr, *prevPtr; + Node *node2Ptr; int rootLevel; /* Level of original tag root. */ tagPtr->toggleCount += delta; @@ -2372,7 +2372,7 @@ ChangeNodeToggleCount( Node *rootNodePtr = tagPtr->tagRootPtr; - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = tagPtr->toggleCount - delta; summaryPtr->nextPtr = rootNodePtr->summaryPtr; @@ -2381,7 +2381,7 @@ ChangeNodeToggleCount( rootLevel = rootNodePtr->level; tagPtr->tagRootPtr = rootNodePtr; } - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = delta; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -2471,10 +2471,10 @@ FindTagStart( TkTextTag *tagPtr, /* Tag to search for. */ TkTextIndex *indexPtr) /* Return - index information. */ { - register Node *nodePtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; - register Summary *summaryPtr; + Node *nodePtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; + Summary *summaryPtr; int offset; nodePtr = tagPtr->tagRootPtr; @@ -2556,10 +2556,10 @@ FindTagEnd( TkTextTag *tagPtr, /* Tag to search for. */ TkTextIndex *indexPtr) /* Return - index information. */ { - register Node *nodePtr, *lastNodePtr; - register TkTextLine *linePtr ,*lastLinePtr; - register TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr; - register Summary *summaryPtr; + Node *nodePtr, *lastNodePtr; + TkTextLine *linePtr ,*lastLinePtr; + TkTextSegment *segPtr, *lastSegPtr, *last2SegPtr; + Summary *summaryPtr; int lastoffset, lastoffset2, offset; nodePtr = tagPtr->tagRootPtr; @@ -2652,7 +2652,7 @@ TkBTreeStartSearch( * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { @@ -2748,7 +2748,7 @@ TkBTreeStartSearchBack( * position *will* be returned. */ TkTextTag *tagPtr, /* Tag to search for. NULL means search for * any tag. */ - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Where to store information about search's * progress. */ { @@ -2849,14 +2849,14 @@ TkBTreeStartSearchBack( int TkBTreeNextTag( - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Information about search in progress; must * have been set up by call to * TkBTreeStartSearch. */ { - register TkTextSegment *segPtr; - register Node *nodePtr; - register Summary *summaryPtr; + TkTextSegment *segPtr; + Node *nodePtr; + Summary *summaryPtr; if (searchPtr->linesLeft <= 0) { goto searchOver; @@ -3014,15 +3014,15 @@ TkBTreeNextTag( int TkBTreePrevTag( - register TkTextSearch *searchPtr) + TkTextSearch *searchPtr) /* Information about search in progress; must * have been set up by call to * TkBTreeStartSearch. */ { - register TkTextSegment *segPtr, *prevPtr; - register TkTextLine *linePtr, *prevLinePtr; - register Node *nodePtr, *node2Ptr, *prevNodePtr; - register Summary *summaryPtr; + TkTextSegment *segPtr, *prevPtr; + TkTextLine *linePtr, *prevLinePtr; + Node *nodePtr, *node2Ptr, *prevNodePtr; + Summary *summaryPtr; int byteIndex, linesSkipped; int pastLast; /* Saw last marker during scan. */ @@ -3232,9 +3232,9 @@ TkBTreeCharTagged( * check for a tag. */ TkTextTag *tagPtr) /* Tag of interest. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; TkTextSegment *toggleSegPtr; int toggles, index; @@ -3288,8 +3288,8 @@ TkBTreeCharTagged( toggles = 0; for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3347,9 +3347,9 @@ TkBTreeGetTags( int *numTagsPtr) /* Store number of tags found at this * location. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; TkTextLine *linePtr; int src, dst, index; TagInfo tagInfo; @@ -3357,8 +3357,8 @@ TkBTreeGetTags( tagInfo.numTags = 0; tagInfo.arraySize = NUM_TAG_INFOS; - tagInfo.tagPtrs = ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *)); - tagInfo.counts = ckalloc(NUM_TAG_INFOS * sizeof(int)); + tagInfo.tagPtrs = (TkTextTag **)ckalloc(NUM_TAG_INFOS * sizeof(TkTextTag *)); + tagInfo.counts = (int *)ckalloc(NUM_TAG_INFOS * sizeof(int)); /* * Record tag toggles within the line of indexPtr but preceding indexPtr. @@ -3410,8 +3410,8 @@ TkBTreeGetTags( for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3492,17 +3492,17 @@ TkTextIsElided( * indexPtr's elide state will be stored and * returned. */ { - register Node *nodePtr; - register TkTextLine *siblingLinePtr; - register TkTextSegment *segPtr; - register TkTextTag *tagPtr = NULL; - register int i, index; - register TkTextElideInfo *infoPtr; + Node *nodePtr; + TkTextLine *siblingLinePtr; + TkTextSegment *segPtr; + TkTextTag *tagPtr = NULL; + int i, index; + TkTextElideInfo *infoPtr; TkTextLine *linePtr; int elide; if (elideInfo == NULL) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); } else { infoPtr = elideInfo; } @@ -3517,8 +3517,8 @@ TkTextIsElided( */ if (LOTSA_TAGS < infoPtr->numTags) { - infoPtr->tagCnts = ckalloc(sizeof(int) * infoPtr->numTags); - infoPtr->tagPtrs = ckalloc(sizeof(TkTextTag *) * infoPtr->numTags); + infoPtr->tagCnts = (int *)ckalloc(sizeof(int) * infoPtr->numTags); + infoPtr->tagPtrs = (TkTextTag **)ckalloc(sizeof(TkTextTag *) * infoPtr->numTags); } for (i=0; i<infoPtr->numTags; i++) { @@ -3591,8 +3591,8 @@ TkTextIsElided( for (nodePtr = indexPtr->linePtr->parentPtr; nodePtr->parentPtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *siblingPtr; - register Summary *summaryPtr; + Node *siblingPtr; + Summary *summaryPtr; for (siblingPtr = nodePtr->parentPtr->children.nodePtr; siblingPtr != nodePtr; siblingPtr = siblingPtr->nextPtr) { @@ -3697,7 +3697,7 @@ IncCount( TagInfo *tagInfoPtr) /* Holds cumulative information about tags; * increment count here. */ { - register TkTextTag **tagPtrPtr; + TkTextTag **tagPtrPtr; int count; for (tagPtrPtr = tagInfoPtr->tagPtrs, count = tagInfoPtr->numTags; @@ -3718,12 +3718,12 @@ IncCount( int *newCounts, newSize; newSize = 2 * tagInfoPtr->arraySize; - newTags = ckalloc(newSize * sizeof(TkTextTag *)); + newTags = (TkTextTag **)ckalloc(newSize * sizeof(TkTextTag *)); memcpy(newTags, tagInfoPtr->tagPtrs, tagInfoPtr->arraySize * sizeof(TkTextTag *)); ckfree(tagInfoPtr->tagPtrs); tagInfoPtr->tagPtrs = newTags; - newCounts = ckalloc(newSize * sizeof(int)); + newCounts = (int *)ckalloc(newSize * sizeof(int)); memcpy(newCounts, tagInfoPtr->counts, tagInfoPtr->arraySize * sizeof(int)); ckfree(tagInfoPtr->counts); @@ -3759,11 +3759,11 @@ TkBTreeCheck( TkTextBTree tree) /* Tree to check. */ { BTree *treePtr = (BTree *) tree; - register Summary *summaryPtr; - register Node *nodePtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; - register TkTextTag *tagPtr; + Summary *summaryPtr; + Node *nodePtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; + TkTextTag *tagPtr; Tcl_HashEntry *entryPtr; Tcl_HashSearch search; int count; @@ -3774,7 +3774,7 @@ TkBTreeCheck( for (entryPtr=Tcl_FirstHashEntry(&treePtr->sharedTextPtr->tagTable,&search); entryPtr != NULL ; entryPtr = Tcl_NextHashEntry(&search)) { - tagPtr = Tcl_GetHashValue(entryPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(entryPtr); nodePtr = tagPtr->tagRootPtr; if (nodePtr == NULL) { if (tagPtr->toggleCount != 0) { @@ -3898,14 +3898,14 @@ TkBTreeCheck( static void CheckNodeConsistency( - register Node *nodePtr, /* Node whose subtree should be checked. */ + Node *nodePtr, /* Node whose subtree should be checked. */ int references) /* Number of referring widgets which have * pixel counts. */ { - register Node *childNodePtr; - register Summary *summaryPtr, *summaryPtr2; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; + Node *childNodePtr; + Summary *summaryPtr, *summaryPtr2; + TkTextLine *linePtr; + TkTextSegment *segPtr; int numChildren, numLines, toggleCount, minChildren, i; int *numPixels; int pixels[PIXEL_CLIENTS]; @@ -3926,7 +3926,7 @@ CheckNodeConsistency( numChildren = 0; numLines = 0; if (references > PIXEL_CLIENTS) { - numPixels = ckalloc(sizeof(int) * references); + numPixels = (int *)ckalloc(sizeof(int) * references); } else { numPixels = pixels; } @@ -4087,7 +4087,7 @@ CheckNodeConsistency( static void Rebalance( BTree *treePtr, /* Tree that is being rebalanced. */ - register Node *nodePtr) /* Node that may be out of balance. */ + Node *nodePtr) /* Node that may be out of balance. */ { /* * Loop over the entire ancestral chain of the node, working up through @@ -4095,8 +4095,8 @@ Rebalance( */ for ( ; nodePtr != NULL; nodePtr = nodePtr->parentPtr) { - register Node *newPtr, *childPtr; - register TkTextLine *linePtr; + Node *newPtr, *childPtr; + TkTextLine *linePtr; int i; /* @@ -4114,7 +4114,7 @@ Rebalance( */ if (nodePtr->parentPtr == NULL) { - newPtr = ckalloc(sizeof(Node)); + newPtr = (Node *)ckalloc(sizeof(Node)); newPtr->parentPtr = NULL; newPtr->nextPtr = NULL; newPtr->summaryPtr = NULL; @@ -4122,7 +4122,7 @@ Rebalance( newPtr->children.nodePtr = nodePtr; newPtr->numChildren = 1; newPtr->numLines = nodePtr->numLines; - newPtr->numPixels = + newPtr->numPixels = (int *) ckalloc(sizeof(int) * treePtr->pixelReferences); for (i=0; i<treePtr->pixelReferences; i++) { newPtr->numPixels[i] = nodePtr->numPixels[i]; @@ -4130,8 +4130,8 @@ Rebalance( RecomputeNodeCounts(treePtr, newPtr); treePtr->rootPtr = newPtr; } - newPtr = ckalloc(sizeof(Node)); - newPtr->numPixels = + newPtr = (Node *)ckalloc(sizeof(Node)); + newPtr->numPixels = (int *) ckalloc(sizeof(int) * treePtr->pixelReferences); for (i=0; i<treePtr->pixelReferences; i++) { newPtr->numPixels[i] = 0; @@ -4170,7 +4170,7 @@ Rebalance( } while (nodePtr->numChildren < MIN_CHILDREN) { - register Node *otherPtr; + Node *otherPtr; Node *halfwayNodePtr = NULL; /* Initialization needed only */ TkTextLine *halfwayLinePtr = NULL; /* to prevent cc warnings. */ int totalChildren, firstChildren, i; @@ -4234,7 +4234,7 @@ Rebalance( otherPtr->children.linePtr = NULL; } if (nodePtr->level == 0) { - register TkTextLine *linePtr; + TkTextLine *linePtr; for (linePtr = nodePtr->children.linePtr, i = 1; linePtr->nextPtr != NULL; @@ -4250,7 +4250,7 @@ Rebalance( i++; } } else { - register Node *childPtr; + Node *childPtr; for (childPtr = nodePtr->children.nodePtr, i = 1; childPtr->nextPtr != NULL; @@ -4326,14 +4326,14 @@ Rebalance( static void RecomputeNodeCounts( - register BTree *treePtr, /* The whole B-tree. */ - register Node *nodePtr) /* Node whose tag summary information must be + BTree *treePtr, /* The whole B-tree. */ + Node *nodePtr) /* Node whose tag summary information must be * recomputed. */ { - register Summary *summaryPtr, *summaryPtr2; - register Node *childPtr; - register TkTextLine *linePtr; - register TkTextSegment *segPtr; + Summary *summaryPtr, *summaryPtr2; + Node *childPtr; + TkTextLine *linePtr; + TkTextSegment *segPtr; TkTextTag *tagPtr; int ref; @@ -4377,7 +4377,7 @@ RecomputeNodeCounts( for (summaryPtr = nodePtr->summaryPtr; ; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr == NULL) { - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = tagPtr; summaryPtr->toggleCount = 1; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -4405,7 +4405,7 @@ RecomputeNodeCounts( for (summaryPtr = nodePtr->summaryPtr; ; summaryPtr = summaryPtr->nextPtr) { if (summaryPtr == NULL) { - summaryPtr = ckalloc(sizeof(Summary)); + summaryPtr = (Summary *)ckalloc(sizeof(Summary)); summaryPtr->tagPtr = summaryPtr2->tagPtr; summaryPtr->toggleCount = summaryPtr2->toggleCount; summaryPtr->nextPtr = nodePtr->summaryPtr; @@ -4558,8 +4558,8 @@ CharSplitProc( { TkTextSegment *newPtr1, *newPtr2; - newPtr1 = ckalloc(CSEG_SIZE(index)); - newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index)); + newPtr1 = (TkTextSegment *)ckalloc(CSEG_SIZE(index)); + newPtr2 = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size - index)); newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; @@ -4600,12 +4600,13 @@ CharCleanupProc( TkTextLine *linePtr) /* Line containing segments (not used). */ { TkTextSegment *segPtr2, *newPtr; + (void)linePtr; segPtr2 = segPtr->nextPtr; if ((segPtr2 == NULL) || (segPtr2->typePtr != &tkTextCharType)) { return segPtr; } - newPtr = ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size)); + newPtr = (TkTextSegment *)ckalloc(CSEG_SIZE(segPtr->size + segPtr2->size)); newPtr->typePtr = &tkTextCharType; newPtr->nextPtr = segPtr2->nextPtr; newPtr->size = segPtr->size + segPtr2->size; @@ -4642,6 +4643,9 @@ CharDeleteProc( * deleted, so everything must get cleaned * up. */ { + (void)linePtr; + (void)treeGone; + ckfree(segPtr); return 0; } @@ -4669,6 +4673,8 @@ CharCheckProc( TkTextSegment *segPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + /* * Make sure that the segment contains the number of characters indicated * by its header, and that the last segment in a line ends in a newline. @@ -4858,7 +4864,7 @@ ToggleCheckProc( TkTextSegment *segPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { - register Summary *summaryPtr; + Summary *summaryPtr; int needSummary; if (segPtr->size != 0) { diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 33b9720..7bcaed9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -654,10 +654,10 @@ void TkTextCreateDInfo( TkText *textPtr) /* Overall information for text widget. */ { - register TextDInfo *dInfoPtr; + TextDInfo *dInfoPtr; XGCValues gcValues; - dInfoPtr = ckalloc(sizeof(TextDInfo)); + dInfoPtr = (TextDInfo *)ckalloc(sizeof(TextDInfo)); Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int)); dInfoPtr->dLinePtr = NULL; dInfoPtr->copyGC = NULL; @@ -713,7 +713,7 @@ void TkTextFreeDInfo( TkText *textPtr) /* Overall information for text widget. */ { - register TextDInfo *dInfoPtr = textPtr->dInfoPtr; + TextDInfo *dInfoPtr = textPtr->dInfoPtr; /* * Be careful to free up styleTable *after* freeing up all the DLines, so @@ -769,7 +769,7 @@ GetStyle( * information is wanted. */ { TkTextTag **tagPtrs; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; @@ -998,7 +998,7 @@ GetStyle( hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable, (char *) &styleValues, &isNew); if (!isNew) { - stylePtr = Tcl_GetHashValue(hPtr); + stylePtr = (TextStyle *)Tcl_GetHashValue(hPtr); stylePtr->refCount++; return stylePtr; } @@ -1007,7 +1007,7 @@ GetStyle( * No existing style matched. Make a new one. */ - stylePtr = ckalloc(sizeof(TextStyle)); + stylePtr = (TextStyle *)ckalloc(sizeof(TextStyle)); stylePtr->refCount = 1; if (styleValues.border != NULL) { gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel; @@ -1065,7 +1065,7 @@ GetStyle( static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ - register TextStyle *stylePtr) + TextStyle *stylePtr) /* Information about style to free. */ { if (stylePtr->refCount-- <= 1) { @@ -1127,7 +1127,7 @@ LayoutDLine( * necessarily point to a character * segment. */ { - register DLine *dlPtr; /* New display line. */ + DLine *dlPtr; /* New display line. */ TkTextSegment *segPtr; /* Current segment in text. */ TkTextDispChunk *lastChunkPtr; /* Last chunk allocated so far for line. */ @@ -1181,7 +1181,7 @@ LayoutDLine( * Create and initialize a new DLine structure. */ - dlPtr = ckalloc(sizeof(DLine)); + dlPtr = (DLine *)ckalloc(sizeof(DLine)); dlPtr->index = *indexPtr; dlPtr->byteCount = 0; dlPtr->y = 0; @@ -1430,7 +1430,7 @@ LayoutDLine( continue; } if (chunkPtr == NULL) { - chunkPtr = ckalloc(sizeof(TkTextDispChunk)); + chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk)); chunkPtr->nextPtr = NULL; chunkPtr->clientData = NULL; } @@ -1828,8 +1828,8 @@ static void UpdateDisplayInfo( TkText *textPtr) /* Text widget to update. */ { - register TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *prevPtr; + TextDInfo *dInfoPtr = textPtr->dInfoPtr; + DLine *dlPtr, *prevPtr; TkTextIndex index; TkTextLine *lastLinePtr; int y, maxY, xPixelOffset, maxOffset, lineHeight; @@ -1866,7 +1866,7 @@ UpdateDisplayInfo( y = dInfoPtr->y - dInfoPtr->newTopPixelOffset; maxY = dInfoPtr->maxY; while (1) { - register DLine *newPtr; + DLine *newPtr; if (index.linePtr == lastLinePtr) { break; @@ -1977,7 +1977,7 @@ UpdateDisplayInfo( */ if (index.linePtr != prevPtr->index.linePtr) { - register DLine *nextPtr; + DLine *nextPtr; nextPtr = dlPtr; while ((nextPtr != NULL) @@ -2346,7 +2346,7 @@ UpdateDisplayInfo( static void FreeDLines( TkText *textPtr, /* Information about overall text widget. */ - register DLine *firstPtr, /* Pointer to first DLine to free up. */ + DLine *firstPtr, /* Pointer to first DLine to free up. */ DLine *lastPtr, /* Pointer to DLine just after last one to * free (NULL means everything starting with * firstPtr). */ @@ -2359,8 +2359,8 @@ FreeDLines( * we shouldn't invalidate anything for the * overall widget. */ { - register TkTextDispChunk *chunkPtr, *nextChunkPtr; - register DLine *nextDLinePtr; + TkTextDispChunk *chunkPtr, *nextChunkPtr; + DLine *nextDLinePtr; if (action == DLINE_FREE_TEMP) { lineHeightsRecalculated++; @@ -2379,7 +2379,7 @@ FreeDLines( if (textPtr->dInfoPtr->dLinePtr == firstPtr) { textPtr->dInfoPtr->dLinePtr = lastPtr; } else { - register DLine *prevPtr; + DLine *prevPtr; for (prevPtr = textPtr->dInfoPtr->dLinePtr; prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) { @@ -2427,14 +2427,14 @@ FreeDLines( static void DisplayDLine( TkText *textPtr, /* Text widget in which to draw line. */ - register DLine *dlPtr, /* Information about line to draw. */ + DLine *dlPtr, /* Information about line to draw. */ DLine *prevPtr, /* Line just before one to draw, or NULL if * dlPtr is the top line. */ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller * must make sure it's large enough to hold * line. */ { - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; TextDInfo *dInfoPtr = textPtr->dInfoPtr; Display *display; int height, y_off; @@ -2606,7 +2606,7 @@ DisplayDLine( static void DisplayLineBackground( TkText *textPtr, /* Text widget containing line. */ - register DLine *dlPtr, /* Information about line to draw. */ + DLine *dlPtr, /* Information about line to draw. */ DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is * the top-most line in the window. */ Pixmap pixmap) /* Pixmap to use for double-buffering. Caller @@ -3002,7 +3002,7 @@ static void AsyncUpdateLineMetrics( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int lineNum; @@ -4160,9 +4160,9 @@ static void DisplayText( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr; + DLine *dlPtr; DLine *prevPtr; Pixmap pixmap; int maxHeight, borders; @@ -4246,7 +4246,7 @@ DisplayText( */ for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) { - register DLine *dlPtr2; + DLine *dlPtr2; int offset, height, y, oldY; TkRegion damageRgn; @@ -4544,7 +4544,7 @@ DisplayText( * proc of embedded windows only. */ #endif - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL); chunkPtr = chunkPtr->nextPtr) { @@ -4746,7 +4746,7 @@ TextInvalidateRegion( TkText *textPtr, /* Widget record for text widget. */ TkRegion region) /* Region of area to redraw. */ { - register DLine *dlPtr; + DLine *dlPtr; TextDInfo *dInfoPtr = textPtr->dInfoPtr; int maxY, inset; XRectangle rect; @@ -5004,7 +5004,7 @@ TextRedrawTag( int withTag) /* 1 means redraw characters that have the * tag, 0 means redraw those without. */ { - register DLine *dlPtr; + DLine *dlPtr; DLine *endPtr; int tagOn; TkTextSearch search; @@ -5344,7 +5344,7 @@ TkTextSetYView( * are to be off the top of the screen. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr; + DLine *dlPtr; int bottomY, close, lineIndex; TkTextIndex tmpIndex, rounded; int lineHeight; @@ -6350,7 +6350,7 @@ TkTextPendingsync( int TkTextScanCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -6836,7 +6836,7 @@ static void AsyncUpdateYScrollbar( ClientData clientData) /* Information about widget. */ { - register TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; textPtr->dInfoPtr->scrollbarTimer = NULL; @@ -6871,7 +6871,7 @@ AsyncUpdateYScrollbar( static DLine * FindDLine( TkText *textPtr, /* Widget record for text widget. */ - register DLine *dlPtr, /* Pointer to first in list of DLines to + DLine *dlPtr, /* Pointer to first in list of DLines to * search. */ const TkTextIndex *indexPtr)/* Index of desired character. */ { @@ -7041,7 +7041,7 @@ TkTextPixelIndex( * border of the widget). */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register DLine *dlPtr, *validDlPtr; + DLine *dlPtr, *validDlPtr; int nearby = 0; /* @@ -7143,7 +7143,7 @@ DlineIndexOfX( * the character nearest to x. */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; /* * Scan through the line's chunks to find the one that contains the @@ -7271,7 +7271,7 @@ DlineXOfIndex( int byteIndex) /* The byte index for which we want the * coordinate. */ { - register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr; + TkTextDispChunk *chunkPtr = dlPtr->chunkPtr; int x = 0; if (byteIndex == 0 || chunkPtr == NULL) { @@ -7341,7 +7341,7 @@ TkTextIndexBbox( { TextDInfo *dInfoPtr = textPtr->dInfoPtr; DLine *dlPtr; - register TkTextDispChunk *chunkPtr; + TkTextDispChunk *chunkPtr; int byteCount; /* @@ -7550,6 +7550,11 @@ ElideBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { + (void)textPtr; + (void)index; + (void)lineHeight; + (void)baseline; + *xPtr = chunkPtr->x; *yPtr = y; *widthPtr = *heightPtr = 0; @@ -7565,6 +7570,9 @@ ElideMeasureProc( int x) /* X-coordinate, in same coordinate system as * chunkPtr->x. */ { + (void)chunkPtr; + (void)x; + return 0 /*chunkPtr->numBytes - 1*/; } @@ -7606,7 +7614,7 @@ TkTextCharLayoutProc( TkWrapMode wrapMode, /* How to handle line wrapping: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ @@ -7623,6 +7631,8 @@ TkTextCharLayoutProc( BaseCharInfo *bciPtr; Tcl_DString *baseString; #endif + (void)textPtr; + (void)indexPtr; /* * Figure out how many characters will fit in the space we've got. Include @@ -7757,7 +7767,7 @@ TkTextCharLayoutProc( chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS - ciPtr = ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); + ciPtr = (CharInfo *)ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ @@ -7870,7 +7880,7 @@ CharChunkMeasureChars( * here. */ { Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont; - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; #if !TK_LAYOUT_WITH_BASE_CHUNKS if (chars == NULL) { @@ -7959,7 +7969,7 @@ CharDisplayProc( int screenY) /* Y-coordinate in text window that * corresponds to y. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; const char *string; TextStyle *stylePtr; StyleValues *sValuePtr; @@ -7967,6 +7977,9 @@ CharDisplayProc( #if TK_DRAW_IN_CONTEXT BaseCharInfo *bciPtr; #endif /* TK_DRAW_IN_CONTEXT */ + (void)textPtr; + (void)height; + (void)screenY; if ((x + chunkPtr->width) <= 0) { /* @@ -8110,7 +8123,8 @@ CharUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; + (void)textPtr; if (ciPtr) { #if TK_LAYOUT_WITH_BASE_CHUNKS @@ -8213,8 +8227,10 @@ CharBboxProc( int *heightPtr) /* Gets filled in with height of character, in * pixels. */ { - CharInfo *ciPtr = chunkPtr->clientData; + CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData; int maxX; + (void)textPtr; + (void)lineHeight; maxX = chunkPtr->width + chunkPtr->x; CharChunkMeasureChars(chunkPtr, NULL, 0, 0, byteIndex, @@ -8376,7 +8392,7 @@ AdjustForTab( if (chunkPtr2->displayProc != CharDisplayProc) { continue; } - ciPtr = chunkPtr2->clientData; + ciPtr = (CharInfo *)chunkPtr2->clientData; for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) { if (isdigit(UCHAR(*p))) { gotDigit = 1; @@ -8397,7 +8413,7 @@ AdjustForTab( if (decimalChunkPtr != NULL) { int curX; - ciPtr = decimalChunkPtr->clientData; + ciPtr = (CharInfo *)decimalChunkPtr->clientData; CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal, decimalChunkPtr->x, -1, 0, &curX); desired = tabX - (curX - x); diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 3384a1f..9cb43c4 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -117,7 +117,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextImageCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -125,7 +125,7 @@ TkTextImageCmd( * objv[1] is "image". */ { int idx; - register TkTextSegment *eiPtr; + TkTextSegment *eiPtr; TkTextIndex index; static const char *const optionStrings[] = { "cget", "configure", "create", "names", NULL @@ -242,7 +242,7 @@ TkTextImageCmd( * Create the new image segment and initialize it. */ - eiPtr = ckalloc(EI_SEG_SIZE); + eiPtr = (TkTextSegment *)ckalloc(EI_SEG_SIZE); eiPtr->typePtr = &tkTextEmbImageType; eiPtr->size = 1; eiPtr->body.ei.sharedTextPtr = textPtr->sharedTextPtr; @@ -287,7 +287,7 @@ TkTextImageCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -389,7 +389,7 @@ EmbImageConfigure( len = strlen(name); for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->imageTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - char *haveName = + char *haveName = (char *) Tcl_GetHashKey(&textPtr->sharedTextPtr->imageTable, hPtr); if (strncmp(name, haveName, len) == 0) { @@ -419,7 +419,7 @@ EmbImageConfigure( &dummy); Tcl_SetHashValue(hPtr, eiPtr); Tcl_SetObjResult(textPtr->interp, Tcl_NewStringObj(name, -1)); - eiPtr->body.ei.name = ckalloc(Tcl_DStringLength(&newName) + 1); + eiPtr->body.ei.name = (char *)ckalloc(Tcl_DStringLength(&newName) + 1); strcpy(eiPtr->body.ei.name, name); Tcl_DStringFree(&newName); @@ -454,6 +454,8 @@ EmbImageDeleteProc( * up. */ { Tcl_HashEntry *hPtr; + (void)linePtr; + (void)treeGone; if (eiPtr->body.ei.image != NULL) { hPtr = Tcl_FindHashEntry(&eiPtr->body.ei.sharedTextPtr->imageTable, @@ -544,12 +546,15 @@ EmbImageLayoutProc( TkWrapMode wrapMode, /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { int width, height; + (void)indexPtr; + (void)maxChars; + (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbImageLayoutProc"); @@ -621,6 +626,8 @@ EmbImageCheckProc( TkTextSegment *eiPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + if (eiPtr->nextPtr == NULL) { Tcl_Panic("EmbImageCheckProc: embedded image is last segment in line"); } @@ -665,9 +672,11 @@ EmbImageDisplayProc( int screenY) /* Y-coordinate in text window that * corresponds to y. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; int lineX, imageX, imageY, width, height; Tk_Image image; + (void)display; + (void)screenY; image = eiPtr->body.ei.image; if (image == NULL) { @@ -729,8 +738,10 @@ EmbImageBboxProc( int *heightPtr) /* Gets filled in with height of image, in * pixels. */ { - TkTextSegment *eiPtr = chunkPtr->clientData; + TkTextSegment *eiPtr = (TkTextSegment *)chunkPtr->clientData; Tk_Image image; + (void)textPtr; + (void)index; image = eiPtr->body.ei.image; if (image != NULL) { @@ -794,7 +805,7 @@ TkTextImageIndex( if (hPtr == NULL) { return 0; } - eiPtr = Tcl_GetHashValue(hPtr); + eiPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = eiPtr->body.ei.linePtr; indexPtr->byteIndex = TkTextSegToOffset(eiPtr, indexPtr->linePtr); @@ -828,8 +839,14 @@ EmbImageProc( int imgWidth, int imgHeight)/* New dimensions of image. */ { - TkTextSegment *eiPtr = clientData; + TkTextSegment *eiPtr = (TkTextSegment *)clientData; TkTextIndex index; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imgWidth; + (void)imgHeight; index.tree = eiPtr->body.ei.sharedTextPtr->tree; index.linePtr = eiPtr->body.ei.linePtr; diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index 523a8cb..1db1208 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -107,7 +107,7 @@ DupTextIndexInternalRep( TkSizeT epoch; TkTextIndex *dupIndexPtr, *indexPtr; - dupIndexPtr = ckalloc(sizeof(TkTextIndex)); + dupIndexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr = GET_TEXTINDEX(srcPtr); epoch = GET_INDEXEPOCH(srcPtr); @@ -139,7 +139,7 @@ UpdateStringOfTextIndex( len = TkTextPrintIndex(indexPtr->textPtr, indexPtr, buffer); - objPtr->bytes = ckalloc(len + 1); + objPtr->bytes = (char *)ckalloc(len + 1); strcpy(objPtr->bytes, buffer); objPtr->length = len; } @@ -176,7 +176,7 @@ MakeObjIndex( * position. */ const TkTextIndex *origPtr) /* Pointer to index. */ { - TkTextIndex *indexPtr = ckalloc(sizeof(TkTextIndex)); + TkTextIndex *indexPtr = (TkTextIndex *)ckalloc(sizeof(TkTextIndex)); indexPtr->tree = origPtr->tree; indexPtr->linePtr = origPtr->linePtr; @@ -477,7 +477,7 @@ TkTextMakeCharIndex( int charIndex, /* Index of desired character. */ TkTextIndex *indexPtr) /* Structure to fill in. */ { - register TkTextSegment *segPtr; + TkTextSegment *segPtr; char *p, *start, *end; int index, offset; int ch; @@ -816,7 +816,7 @@ GetIndex( hPtr = Tcl_FindHashEntry(&sharedPtr->tagTable, tagName); *p = '.'; if (hPtr != NULL) { - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); } } @@ -832,7 +832,7 @@ GetIndex( if (tagPtr == textPtr->selTagPtr) { tagName = "sel"; } else if (hPtr != NULL) { - tagName = Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); + tagName = (const char *)Tcl_GetHashKey(&sharedPtr->tagTable, hPtr); } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "text doesn't contain any characters tagged with \"%s\"", @@ -1151,7 +1151,7 @@ ForwBack( * or "-" that starts modifier. */ TkTextIndex *indexPtr) /* Index to update as specified in string. */ { - register const char *p, *units; + const char *p, *units; char *end; int count, lineIndex, modifier; size_t length; @@ -1499,7 +1499,7 @@ TkTextIndexForwChars( return; } if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, srcPtr, infoPtr); } @@ -1767,7 +1767,7 @@ TkTextIndexCount( seg2Ptr = TkTextIndexToSeg(indexPtr2, &maxBytes); if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, indexPtr1, infoPtr); } @@ -1844,9 +1844,9 @@ TkTextIndexCount( if (segPtr->typePtr == &tkTextCharType) { int byteLen = segPtr->size - byteOffset; - register unsigned char *str = (unsigned char *) + unsigned char *str = (unsigned char *) segPtr->body.chars + byteOffset; - register int i; + int i; if (segPtr == seg2Ptr) { if (byteLen > (maxBytes - byteOffset)) { @@ -2025,7 +2025,7 @@ TkTextIndexBackChars( return; } if (checkElided) { - infoPtr = ckalloc(sizeof(TkTextElideInfo)); + infoPtr = (TkTextElideInfo *)ckalloc(sizeof(TkTextElideInfo)); elide = TkTextIsElided(textPtr, srcPtr, infoPtr); } @@ -2225,7 +2225,7 @@ StartEnd( { const char *p; size_t length; - register TkTextSegment *segPtr; + TkTextSegment *segPtr; int modifier; /* diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index c516697..90af324 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -93,7 +93,7 @@ const Tk_SegType tkTextLeftMarkType = { int TkTextMarkCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -147,7 +147,7 @@ TkTextMarkCmd( NULL); return TCL_ERROR; } - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } if (objc == 4) { const char *typeStr; @@ -194,7 +194,7 @@ TkTextMarkCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->markTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -229,7 +229,7 @@ TkTextMarkCmd( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, Tcl_GetString(objv[i])); if (hPtr != NULL) { - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); /* * Special case not needed with peer widgets. @@ -290,7 +290,7 @@ TkTextSetMark( widgetSpecific = 0; hPtr = Tcl_CreateHashEntry(&textPtr->sharedTextPtr->markTable, name, &isNew); - markPtr = Tcl_GetHashValue(hPtr); + markPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } if (!isNew) { /* @@ -330,7 +330,7 @@ TkTextSetMark( } TkBTreeUnlinkSegment(markPtr, markPtr->body.mark.linePtr); } else { - markPtr = ckalloc(MSEG_SIZE); + markPtr = (TkTextSegment *)ckalloc(MSEG_SIZE); markPtr->typePtr = &tkTextRightMarkType; markPtr->size = 0; markPtr->body.mark.textPtr = textPtr; @@ -452,7 +452,7 @@ TkTextMarkNameToIndex( if (hPtr == NULL) { return TCL_ERROR; } - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); } TkTextMarkSegToIndex(textPtr, segPtr, indexPtr); @@ -508,6 +508,10 @@ MarkDeleteProc( * deleted, so everything must get cleaned * up. */ { + (void)segPtr; + (void)linePtr; + (void)treeGone; + return 1; } @@ -570,11 +574,18 @@ MarkLayoutProc( int noCharsYet, /* Non-zero means no characters have been * assigned to this line yet. */ TkWrapMode wrapMode, /* Not used. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { + (void)indexPtr; + (void)offset; + (void)maxX; + (void)maxChars; + (void)noCharsYet; + (void)wrapMode; + if (segPtr != textPtr->insertMarkPtr) { return -1; } @@ -641,6 +652,9 @@ TkTextInsertDisplayProc( int halfWidth = textPtr->insertWidth/2; int rightSideWidth; int ix = 0, iy = 0, iw = 0, ih = 0, charWidth = 0; + (void)chunkPtr; + (void)baseline; + (void)display; if (textPtr->insertCursorType) { TkTextMarkSegToIndex(textPtr, textPtr->insertMarkPtr, &index); @@ -727,6 +741,9 @@ InsertUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { + (void)textPtr; + (void)chunkPtr; + return; } @@ -809,7 +826,7 @@ MarkFindNext( { TkTextIndex index; Tcl_HashEntry *hPtr; - register TkTextSegment *segPtr; + TkTextSegment *segPtr; int offset; const char *string = Tcl_GetString(obj); @@ -830,7 +847,7 @@ MarkFindNext( * position. */ - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); segPtr = segPtr->nextPtr; } else { @@ -900,7 +917,7 @@ MarkFindPrev( { TkTextIndex index; Tcl_HashEntry *hPtr; - register TkTextSegment *segPtr, *seg2Ptr, *prevPtr; + TkTextSegment *segPtr, *seg2Ptr, *prevPtr; int offset; const char *string = Tcl_GetString(obj); @@ -919,7 +936,7 @@ MarkFindPrev( * position. */ - segPtr = Tcl_GetHashValue(hPtr); + segPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); TkTextMarkSegToIndex(textPtr, segPtr, &index); } else { /* @@ -1012,7 +1029,7 @@ GetMarkName( return NULL; } else { - markName = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, + markName = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, segPtr->body.mark.hPtr); } return Tcl_NewStringObj(markName, -1); diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 7b89fd9..5d2acb0 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -137,7 +137,7 @@ static void TagBindEvent(TkText *textPtr, XEvent *eventPtr, int TkTextTagCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -154,7 +154,7 @@ TkTextTagCmd( TAG_REMOVE }; int optionIndex, i; - register TkTextTag *tagPtr; + TkTextTag *tagPtr; TkTextIndex index1, index2; if (objc < 3) { @@ -584,7 +584,7 @@ TkTextTagCmd( continue; } - tagPtr = Tcl_GetHashValue(hPtr); + tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr); if (tagPtr == textPtr->selTagPtr) { continue; } @@ -645,12 +645,12 @@ TkTextTagCmd( Tcl_HashSearch search; Tcl_HashEntry *hPtr; - arrayPtr = ckalloc(textPtr->sharedTextPtr->numTags + arrayPtr = (TkTextTag **)ckalloc(textPtr->sharedTextPtr->numTags * sizeof(TkTextTag *)); for (i=0, hPtr = Tcl_FirstHashEntry( &textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) { - arrayPtr[i] = Tcl_GetHashValue(hPtr); + arrayPtr[i] = (TkTextTag *)Tcl_GetHashValue(hPtr); } /* @@ -986,7 +986,7 @@ TkTextCreateTag( int *newTag) /* If non-NULL, then return 1 if new, or 0 if * already exists. */ { - register TkTextTag *tagPtr; + TkTextTag *tagPtr; Tcl_HashEntry *hPtr = NULL; int isNew; const char *name; @@ -1009,9 +1009,9 @@ TkTextCreateTag( *newTag = isNew; } if (!isNew) { - return Tcl_GetHashValue(hPtr); + return (TkTextTag *)Tcl_GetHashValue(hPtr); } - name = Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr); + name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->tagTable, hPtr); } /* @@ -1019,7 +1019,7 @@ TkTextCreateTag( * to it to the hash table entry. */ - tagPtr = ckalloc(sizeof(TkTextTag)); + tagPtr = (TkTextTag *)ckalloc(sizeof(TkTextTag)); tagPtr->name = name; tagPtr->textPtr = NULL; tagPtr->toggleCount = 0; @@ -1118,7 +1118,7 @@ FindTag( hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(tagName)); if (hPtr != NULL) { - return Tcl_GetHashValue(hPtr); + return (TkTextTag *)Tcl_GetHashValue(hPtr); } if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -1158,7 +1158,7 @@ FindTag( void TkTextDeleteTag( TkText *textPtr, /* Info about overall widget. */ - register TkTextTag *tagPtr) /* Tag being deleted. */ + TkTextTag *tagPtr) /* Tag being deleted. */ { TkTextIndex first, last; @@ -1216,7 +1216,7 @@ TkTextDeleteTag( void TkTextFreeTag( TkText *textPtr, /* Info about overall widget. */ - register TkTextTag *tagPtr) /* Tag being deleted. */ + TkTextTag *tagPtr) /* Tag being deleted. */ { int i; @@ -1295,7 +1295,7 @@ SortTags( TkTextTag **tagArrayPtr) /* Pointer to array of pointers. */ { int i, j, prio; - register TkTextTag **tagPtrPtr; + TkTextTag **tagPtrPtr; TkTextTag **maxPtrPtr, *tmp; if (numTags < 2) { @@ -1379,7 +1379,7 @@ ChangeTagPriority( int prio) /* New priority for tag. */ { int low, high, delta; - register TkTextTag *tagPtr2; + TkTextTag *tagPtr2; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -1412,7 +1412,7 @@ ChangeTagPriority( } for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->tagTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { - tagPtr2 = Tcl_GetHashValue(hPtr); + tagPtr2 = (TkTextTag *)Tcl_GetHashValue(hPtr); if ((tagPtr2->priority >= low) && (tagPtr2->priority <= high)) { tagPtr2->priority += delta; } @@ -1443,7 +1443,7 @@ TkTextBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { - TkText *textPtr = clientData; + TkText *textPtr = (TkText *)clientData; int repick = 0; textPtr->refCount++; @@ -1529,7 +1529,7 @@ TkTextBindProc( void TkTextPickCurrent( - register TkText *textPtr, /* Text widget in which to select current + TkText *textPtr, /* Text widget in which to select current * character. */ XEvent *eventPtr) /* Event describing location of mouse cursor. * Must be EnterWindow, LeaveWindow, @@ -1633,7 +1633,7 @@ TkTextPickCurrent( SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr); if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); - copyArrayPtr = ckalloc(size); + copyArrayPtr = (TkTextTag **)ckalloc(size); memcpy(copyArrayPtr, newArrayPtr, size); for (i = 0; i < textPtr->numCurTags; i++) { for (j = 0; j < numNewTags; j++) { @@ -1737,7 +1737,7 @@ TagBindEvent( */ if (numTags > NUM_BIND_TAGS) { - nameArrPtr = ckalloc(numTags * sizeof(const char *)); + nameArrPtr = (const char **)ckalloc(numTags * sizeof(const char *)); } else { nameArrPtr = nameArray; } diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index 191c86c..2df4342 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -133,7 +133,7 @@ static const Tk_OptionSpec optionSpecs[] = { int TkTextWindowCmd( - register TkText *textPtr, /* Information about text widget. */ + TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already @@ -147,7 +147,7 @@ TkTextWindowCmd( enum windOptions { WIND_CGET, WIND_CONFIGURE, WIND_CREATE, WIND_NAMES }; - register TkTextSegment *ewPtr; + TkTextSegment *ewPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); @@ -290,7 +290,7 @@ TkTextWindowCmd( * Create the new window segment and initialize it. */ - ewPtr = ckalloc(EW_SEG_SIZE); + ewPtr = (TkTextSegment *)ckalloc(EW_SEG_SIZE); ewPtr->typePtr = &tkTextEmbWindowType; ewPtr->size = 1; ewPtr->body.ew.sharedTextPtr = textPtr->sharedTextPtr; @@ -302,7 +302,7 @@ TkTextWindowCmd( ewPtr->body.ew.stretch = 0; ewPtr->body.ew.optionTable = Tk_CreateOptionTable(interp, optionSpecs); - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = NULL; client->textPtr = textPtr; client->tkwin = NULL; @@ -345,7 +345,7 @@ TkTextWindowCmd( for (hPtr = Tcl_FirstHashEntry(&textPtr->sharedTextPtr->windowTable, &search); hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), + (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable, hPtr), -1)); } Tcl_SetObjResult(interp, resultObj); @@ -467,7 +467,7 @@ EmbWinConfigure( * Have to make the new client. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -526,7 +526,7 @@ EmbWinStructureProc( ClientData clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -579,9 +579,10 @@ EmbWinRequestProc( ClientData clientData, /* Pointer to record for window item. */ Tk_Window tkwin) /* Window that changed its desired size. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; + (void)tkwin; index.tree = ewPtr->body.ew.sharedTextPtr->tree; index.linePtr = ewPtr->body.ew.linePtr; @@ -616,7 +617,7 @@ EmbWinLostSlaveProc( Tk_Window tkwin) /* Window that was claimed away by another * geometry manager. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; TkTextSegment *ewPtr = client->parent; TkTextIndex index; Tcl_HashEntry *hPtr; @@ -747,6 +748,8 @@ EmbWinDeleteProc( { TkTextEmbWindowClient *client; client = ewPtr->body.ew.clients; + (void)linePtr; + (void)treeGone; while (client != NULL) { TkTextEmbWindowClient *next = client->next; @@ -833,13 +836,16 @@ EmbWinLayoutProc( TkWrapMode wrapMode, /* Wrap mode to use for line: * TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or * TEXT_WRAPMODE_WORD. */ - register TkTextDispChunk *chunkPtr) + TkTextDispChunk *chunkPtr) /* Structure to fill in with information about * this chunk. The x field has already been * set by the caller. */ { int width, height; TkTextEmbWindowClient *client; + (void)indexPtr; + (void)maxChars; + (void)wrapMode; if (offset != 0) { Tcl_Panic("Non-zero offset in EmbWinLayoutProc"); @@ -959,7 +965,7 @@ EmbWinLayoutProc( * now need to add to our client list. */ - client = ckalloc(sizeof(TkTextEmbWindowClient)); + client = (TkTextEmbWindowClient *)ckalloc(sizeof(TkTextEmbWindowClient)); client->next = ewPtr->body.ew.clients; client->textPtr = textPtr; client->tkwin = NULL; @@ -1054,6 +1060,8 @@ EmbWinCheckProc( TkTextSegment *ewPtr, /* Segment to check. */ TkTextLine *linePtr) /* Line containing segment. */ { + (void)linePtr; + if (ewPtr->nextPtr == NULL) { Tcl_Panic("EmbWinCheckProc: embedded window is last segment in line"); } @@ -1100,8 +1108,11 @@ TkTextEmbWinDisplayProc( { int lineX, windowX, windowY, width, height; Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); + (void)y; + (void)display; + (void)dst; if (client == NULL) { return; @@ -1180,7 +1191,7 @@ EmbWinUndisplayProc( TkText *textPtr, /* Overall information about text widget. */ TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */ { - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); if (client == NULL) { @@ -1243,8 +1254,9 @@ EmbWinBboxProc( * pixels. */ { Tk_Window tkwin; - TkTextSegment *ewPtr = chunkPtr->clientData; + TkTextSegment *ewPtr = (TkTextSegment *)chunkPtr->clientData; TkTextEmbWindowClient *client = EmbWinGetClient(textPtr, ewPtr); + (void)index; if (client == NULL) { tkwin = NULL; @@ -1305,7 +1317,7 @@ static void EmbWinDelayedUnmap( ClientData clientData) /* Token for the window to be unmapped. */ { - TkTextEmbWindowClient *client = clientData; + TkTextEmbWindowClient *client = (TkTextEmbWindowClient *)clientData; if (!client->displayed && (client->tkwin != NULL)) { if (client->textPtr->tkwin != Tk_Parent(client->tkwin)) { @@ -1353,7 +1365,7 @@ TkTextWindowIndex( return 0; } - ewPtr = Tcl_GetHashValue(hPtr); + ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr); indexPtr->tree = textPtr->sharedTextPtr->tree; indexPtr->linePtr = ewPtr->body.ew.linePtr; indexPtr->byteIndex = TkTextSegToOffset(ewPtr, indexPtr->linePtr); diff --git a/generic/tkTrig.c b/generic/tkTrig.c index a2bf456..101f09b 100644 --- a/generic/tkTrig.c +++ b/generic/tkTrig.c @@ -440,7 +440,7 @@ TkPolygonToPoint( * intersect a ray extending vertically * upwards from the point to infinity. */ int count; - register double *pPtr; + double *pPtr; /* * Iterate through all of the edges in the polygon, updating bestDist and @@ -588,7 +588,7 @@ TkPolygonToArea( * polygon: x0, y0, x1, y1, ... The polygon * may be self-intersecting. */ int numPoints, /* Total number of points at *polyPtr. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -596,7 +596,7 @@ TkPolygonToArea( * outside, 1 means inside, won't ever be * 0). */ int count; - register double *pPtr; + double *pPtr; /* * Iterate over all of the edges of the polygon and test them against the @@ -751,11 +751,11 @@ TkOvalToPoint( int TkOvalToArea( - register double *ovalPtr, /* Points to coordinates defining the + double *ovalPtr, /* Points to coordinates defining the * bounding rectangle for the oval: x1, y1, * x2, y2. X1 must be less than x2 and y1 less * than y2. */ - register double *rectPtr) /* Points to coords for rectangle, in the + double *rectPtr) /* Points to coords for rectangle, in the * order x1, y1, x2, y2. X1 and y1 must be * lower-left corner. */ { @@ -870,7 +870,7 @@ TkOvalToArea( /* ARGSUSED */ void TkIncludePoint( - register Tk_Item *itemPtr, /* Item whose bounding box is being + Tk_Item *itemPtr, /* Item whose bounding box is being * calculated. */ double *pointPtr) /* Address of two doubles giving x and y * coordinates of point. */ @@ -919,7 +919,7 @@ TkBezierScreenPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register XPoint *xPointPtr) /* Where to put new points. */ + XPoint *xPointPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; @@ -965,7 +965,7 @@ TkBezierPoints( double control[], /* Array of coordinates for four control * points: x0, y0, x1, y1, ... x3 y3. */ int numSteps, /* Number of curve points to generate. */ - register double *coordPtr) /* Where to put new points. */ + double *coordPtr) /* Where to put new points. */ { int i; double u, u2, u3, t, t2, t3; diff --git a/generic/tkUndo.c b/generic/tkUndo.c index c66905d..7494332 100644 --- a/generic/tkUndo.c +++ b/generic/tkUndo.c @@ -94,7 +94,7 @@ TkUndoInsertSeparator( TkUndoAtom *separator; if (*stack!=NULL && (*stack)->type!=TK_UNDO_SEPARATOR) { - separator = ckalloc(sizeof(TkUndoAtom)); + separator = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); separator->type = TK_UNDO_SEPARATOR; TkUndoPushStack(stack,separator); return 1; @@ -181,7 +181,7 @@ TkUndoPushAction( { TkUndoAtom *atom; - atom = ckalloc(sizeof(TkUndoAtom)); + atom = (TkUndoAtom *)ckalloc(sizeof(TkUndoAtom)); atom->type = TK_UNDO_ACTION; atom->apply = apply; atom->revert = revert; @@ -237,7 +237,7 @@ TkUndoMakeCmdSubAtom( Tcl_Panic("NULL command and actionScript in TkUndoMakeCmdSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = command; atom->funcPtr = NULL; atom->clientData = NULL; @@ -299,7 +299,7 @@ TkUndoMakeSubAtom( Tcl_Panic("NULL funcPtr in TkUndoMakeSubAtom"); } - atom = ckalloc(sizeof(TkUndoSubAtom)); + atom = (TkUndoSubAtom *)ckalloc(sizeof(TkUndoSubAtom)); atom->command = NULL; atom->funcPtr = funcPtr; atom->clientData = clientData; @@ -341,7 +341,7 @@ TkUndoInitStack( { TkUndoRedoStack *stack; /* An Undo/Redo stack */ - stack = ckalloc(sizeof(TkUndoRedoStack)); + stack = (TkUndoRedoStack *)ckalloc(sizeof(TkUndoRedoStack)); stack->undoStack = NULL; stack->redoStack = NULL; stack->interp = interp; diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 85cb06d..009adda 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -48,7 +48,7 @@ int TkStateParseProc( ClientData clientData, /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ @@ -57,8 +57,7 @@ TkStateParseProc( int flags = PTR2INT(clientData); size_t length; Tcl_Obj *msgObj; - - register Tk_State *statePtr = (Tk_State *) (widgRec + offset); + Tk_State *statePtr = (Tk_State *) (widgRec + offset); if (value == NULL || *value == 0) { *statePtr = TK_STATE_NULL; @@ -126,15 +125,15 @@ TkStateParseProc( const char * TkStatePrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ - Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with + TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { - register Tk_State *statePtr = (Tk_State *) (widgRec + offset); + Tk_State *statePtr = (Tk_State *) (widgRec + offset); switch (*statePtr) { case TK_STATE_NORMAL: @@ -170,17 +169,16 @@ TkStatePrintProc( int TkOrientParseProc( - ClientData clientData, /* some flags.*/ + TCL_UNUSED(void *), /* some flags.*/ Tcl_Interp *interp, /* Used for reporting errors. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ const char *value, /* Value of option. */ char *widgRec, /* Pointer to record for item. */ int offset) /* Offset into item. */ { int c; size_t length; - - register int *orientPtr = (int *) (widgRec + offset); + int *orientPtr = (int *) (widgRec + offset); if (value == NULL || *value == 0) { *orientPtr = 0; @@ -229,15 +227,15 @@ TkOrientParseProc( const char * TkOrientPrintProc( - ClientData clientData, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), /* Ignored. */ + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ int offset, /* Offset into item. */ - Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with + TCL_UNUSED(Tcl_FreeProc **)) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { - register int *statePtr = (int *) (widgRec + offset); + int *statePtr = (int *) (widgRec + offset); if (*statePtr) { return "vertical"; @@ -299,6 +297,7 @@ TkOffsetParseProc( tsoffset.flags = INT_MAX; goto goodTSOffset; } + break; case 'w': if (value[1] != '\0') {goto badTSOffset;} tsoffset.flags = TK_OFFSET_LEFT|TK_OFFSET_MIDDLE; @@ -410,8 +409,8 @@ TkOffsetParseProc( const char * TkOffsetPrintProc( - ClientData clientData, /* not used */ - Tk_Window tkwin, /* not used */ + TCL_UNUSED(void *), /* not used */ + TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ int offset, /* Offset of tile in record */ Tcl_FreeProc **freeProcPtr) /* not used */ @@ -423,7 +422,7 @@ TkOffsetPrintProc( if (offsetPtr->flags >= INT_MAX) { return "end"; } - p = ckalloc(32); + p = (char *)ckalloc(32); sprintf(p, "%d", offsetPtr->flags & ~TK_OFFSET_INDEX); *freeProcPtr = TCL_DYNAMIC; return p; @@ -453,7 +452,7 @@ TkOffsetPrintProc( return "se"; } } - q = p = ckalloc(32); + q = p = (char *)ckalloc(32); if (offsetPtr->flags & TK_OFFSET_RELATIVE) { *q++ = '#'; } @@ -511,14 +510,14 @@ TkPixelParseProc( const char * TkPixelPrintProc( - ClientData clientData, /* not used */ - Tk_Window tkwin, /* not used */ + TCL_UNUSED(void *), /* not used */ + TCL_UNUSED(Tk_Window), /* not used */ char *widgRec, /* Widget structure record */ int offset, /* Offset of tile in record */ Tcl_FreeProc **freeProcPtr) /* not used */ { double *doublePtr = (double *) (widgRec + offset); - char *p = ckalloc(24); + char *p = (char *)ckalloc(24); Tcl_PrintDouble(NULL, *doublePtr, p); *freeProcPtr = TCL_DYNAMIC; @@ -1086,7 +1085,7 @@ TkBackgroundEvalObjv( Tcl_Command TkMakeEnsemble( Tcl_Interp *interp, - const char *namespace, + const char *namesp, const char *name, ClientData clientData, const TkEnsemble map[]) @@ -1103,11 +1102,11 @@ TkMakeEnsemble( Tcl_DStringInit(&ds); - namespacePtr = Tcl_FindNamespace(interp, namespace, NULL, 0); + namespacePtr = Tcl_FindNamespace(interp, namesp, NULL, 0); if (namespacePtr == NULL) { - namespacePtr = Tcl_CreateNamespace(interp, namespace, NULL, NULL); + namespacePtr = Tcl_CreateNamespace(interp, namesp, NULL, NULL); if (namespacePtr == NULL) { - Tcl_Panic("failed to create namespace \"%s\"", namespace); + Tcl_Panic("failed to create namespace \"%s\"", namesp); } } @@ -1123,8 +1122,8 @@ TkMakeEnsemble( } Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, namespace, -1); - if (!(strlen(namespace) == 2 && namespace[1] == ':')) { + Tcl_DStringAppend(&ds, namesp, -1); + if (!(strlen(namesp) == 2 && namesp[1] == ':')) { Tcl_DStringAppend(&ds, "::", -1); } Tcl_DStringAppend(&ds, name, -1); diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 51ae3be..04afcbc 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -96,7 +96,7 @@ Tk_GetVisual( * Tk_FreeColormap. */ { Tk_Window tkwin2; - XVisualInfo template, *visInfoList, *bestPtr; + XVisualInfo templ, *visInfoList, *bestPtr; long mask; Visual *visual; size_t length; @@ -144,13 +144,13 @@ Tk_GetVisual( } return visual; } - template.depth = Tk_Depth(tkwin2); - template.c_class = visual->c_class; - template.red_mask = visual->red_mask; - template.green_mask = visual->green_mask; - template.blue_mask = visual->blue_mask; - template.colormap_size = visual->map_entries; - template.bits_per_rgb = visual->bits_per_rgb; + templ.depth = Tk_Depth(tkwin2); + templ.c_class = visual->c_class; + templ.red_mask = visual->red_mask; + templ.green_mask = visual->green_mask; + templ.blue_mask = visual->blue_mask; + templ.colormap_size = visual->map_entries; + templ.bits_per_rgb = visual->bits_per_rgb; mask = VisualDepthMask|VisualClassMask|VisualRedMaskMask |VisualGreenMaskMask|VisualBlueMaskMask|VisualColormapSizeMask |VisualBitsPerRGBMask; @@ -178,7 +178,7 @@ Tk_GetVisual( Tcl_SetErrorCode(interp, "TK", "VALUE", "VISUALID", NULL); return NULL; } - template.visualid = visualId; + templ.visualid = visualId; mask = VisualIDMask; } else { /* @@ -192,15 +192,15 @@ Tk_GetVisual( } } length = p - string; - template.c_class = -1; + templ.c_class = -1; for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) && (strncmp(string, dictPtr->name, length) == 0)) { - template.c_class = dictPtr->c_class; + templ.c_class = dictPtr->c_class; break; } } - if (template.c_class == -1) { + if (templ.c_class == -1) { Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", string); @@ -217,8 +217,8 @@ Tk_GetVisual( p++; } if (*p == 0) { - template.depth = 10000; - } else if (Tcl_GetInt(interp, p, &template.depth) != TCL_OK) { + templ.depth = 10000; + } else if (Tcl_GetInt(interp, p, &templ.depth) != TCL_OK) { return NULL; } if (c == 'b') { @@ -233,9 +233,9 @@ Tk_GetVisual( * an error if there are none that match. */ - template.screen = Tk_ScreenNumber(tkwin); + templ.screen = Tk_ScreenNumber(tkwin); mask |= VisualScreenMask; - visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &template, + visInfoList = XGetVisualInfo(Tk_Display(tkwin), mask, &templ, &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -285,11 +285,11 @@ Tk_GetVisual( goto newBest; } if (visInfoList[i].depth < bestPtr->depth) { - if (visInfoList[i].depth >= template.depth) { + if (visInfoList[i].depth >= templ.depth) { goto newBest; } } else if (visInfoList[i].depth > bestPtr->depth) { - if (bestPtr->depth < template.depth) { + if (bestPtr->depth < templ.depth) { goto newBest; } } else { @@ -327,7 +327,7 @@ Tk_GetVisual( goto done; } } - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), visual, AllocNone); @@ -382,7 +382,7 @@ Tk_GetColormap( */ if (strcmp(string, "new") == 0) { - cmapPtr = ckalloc(sizeof(TkColormap)); + cmapPtr = (TkColormap *)ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), Tk_Visual(tkwin), AllocNone); diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 1b24477..b3527e6 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -124,7 +124,7 @@ static const TkCmd commands[] = { {"place", Tk_PlaceObjCmd, PASSMAINWINDOW|ISSAFE}, {"raise", Tk_RaiseObjCmd, PASSMAINWINDOW|ISSAFE}, {"selection", Tk_SelectionObjCmd, PASSMAINWINDOW}, - {"tk", (Tcl_ObjCmdProc *) TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE}, + {"tk", (Tcl_ObjCmdProc *)(void *)TkInitTkCmd, USEINITPROC|PASSMAINWINDOW|ISSAFE}, {"tkwait", Tk_TkwaitObjCmd, PASSMAINWINDOW|ISSAFE}, {"update", Tk_UpdateObjCmd, PASSMAINWINDOW|ISSAFE}, {"winfo", Tk_WinfoObjCmd, PASSMAINWINDOW|ISSAFE}, @@ -316,10 +316,10 @@ CreateTopLevelWindow( * parent. */ unsigned int flags) /* Additional flags to set on the window. */ { - register TkWindow *winPtr; - register TkDisplay *dispPtr; + TkWindow *winPtr; + TkDisplay *dispPtr; int screenId; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -419,11 +419,11 @@ GetScreen( * DISPLAY envariable. */ int *screenPtr) /* Where to store screen number. */ { - register TkDisplay *dispPtr; + TkDisplay *dispPtr; const char *p; int screenId; size_t length; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -487,7 +487,7 @@ GetScreen( Tcl_InitHashTable(&dispPtr->winTable, TCL_ONE_WORD_KEYS); - dispPtr->name = ckalloc(length + 1); + dispPtr->name = (char *)ckalloc(length + 1); strncpy(dispPtr->name, screenName, length); dispPtr->name[length] = '\0'; break; @@ -530,7 +530,7 @@ TkGetDisplay( Display *display) /* X's display pointer */ { TkDisplay *dispPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (dispPtr = tsdPtr->displayList; dispPtr != NULL; @@ -563,7 +563,7 @@ TkGetDisplay( TkDisplay * TkGetDisplayList(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->displayList; @@ -590,7 +590,7 @@ TkGetDisplayList(void) TkMainInfo * TkGetMainInfoList(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->mainWindowList; @@ -620,7 +620,7 @@ TkAllocWindow( * inherit visual information. NULL means use * screen defaults instead of inheriting. */ { - register TkWindow *winPtr = ckalloc(sizeof(TkWindow)); + TkWindow *winPtr = (TkWindow *)ckalloc(sizeof(TkWindow)); winPtr->display = dispPtr->display; winPtr->dispPtr = dispPtr; @@ -699,7 +699,7 @@ TkAllocWindow( static int NameWindow( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ - register TkWindow *winPtr, /* Window that is to be named and inserted. */ + TkWindow *winPtr, /* Window that is to be named and inserted. */ TkWindow *parentPtr, /* Pointer to logical parent for winPtr (used * for naming, options, etc.). */ const char *name) /* Name for winPtr; must be unique among @@ -769,7 +769,7 @@ NameWindow( if ((length1 + length2 + 2) <= FIXED_SIZE) { pathName = staticSpace; } else { - pathName = ckalloc(length1 + length2 + 2); + pathName = (char *)ckalloc(length1 + length2 + 2); } if (length1 == 1) { pathName[0] = '.'; @@ -791,7 +791,7 @@ NameWindow( return TCL_ERROR; } Tcl_SetHashValue(hPtr, winPtr); - winPtr->pathName = Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr); + winPtr->pathName = (char *)Tcl_GetHashKey(&parentPtr->mainPtr->nameTable, hPtr); return TCL_OK; } @@ -830,11 +830,11 @@ TkCreateMainWindow( Tk_Window tkwin; int dummy, isSafe; Tcl_HashEntry *hPtr; - register TkMainInfo *mainPtr; - register TkWindow *winPtr; - register const TkCmd *cmdPtr; + TkMainInfo *mainPtr; + TkWindow *winPtr; + const TkCmd *cmdPtr; ClientData clientData; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -862,7 +862,7 @@ TkCreateMainWindow( */ winPtr = (TkWindow *) tkwin; - mainPtr = ckalloc(sizeof(TkMainInfo)); + mainPtr = (TkMainInfo *)ckalloc(sizeof(TkMainInfo)); mainPtr->winPtr = winPtr; mainPtr->refCount = 1; mainPtr->interp = interp; @@ -895,7 +895,7 @@ TkCreateMainWindow( winPtr->mainPtr = mainPtr; hPtr = Tcl_CreateHashEntry(&mainPtr->nameTable, ".", &dummy); Tcl_SetHashValue(hPtr, winPtr); - winPtr->pathName = Tcl_GetHashKey(&mainPtr->nameTable, hPtr); + winPtr->pathName = (char *)Tcl_GetHashKey(&mainPtr->nameTable, hPtr); Tcl_InitHashTable(&mainPtr->busyTable, TCL_ONE_WORD_KEYS); /* @@ -937,7 +937,7 @@ TkCreateMainWindow( clientData = NULL; } if (cmdPtr->flags & USEINITPROC) { - ((TkInitProc *) cmdPtr->objProc)(interp, clientData); + ((TkInitProc *)(void *)cmdPtr->objProc)(interp, clientData); } else { Tcl_CreateObjCommand(interp, cmdPtr->name, cmdPtr->objProc, clientData, NULL); @@ -1144,7 +1144,7 @@ Tk_CreateWindowFromPath( * the situation where the parent is ".". */ - p = strrchr(pathName, '.'); + p = (char *)strrchr(pathName, '.'); if (p == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad window path name \"%s\"", pathName)); @@ -1153,7 +1153,7 @@ Tk_CreateWindowFromPath( } numChars = p-pathName; if (numChars > FIXED_SPACE) { - p = ckalloc(numChars + 1); + p = (char *)ckalloc(numChars + 1); } else { p = fixedSpace; } @@ -1238,7 +1238,7 @@ Tk_DestroyWindow( TkDisplay *dispPtr = winPtr->dispPtr; XEvent event; TkHalfdeadWindow *halfdeadPtr, *prev_halfdeadPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_ALREADY_DEAD) { @@ -1261,7 +1261,7 @@ Tk_DestroyWindow( (tsdPtr->halfdeadWindowList->winPtr == winPtr)) { halfdeadPtr = tsdPtr->halfdeadWindowList; } else { - halfdeadPtr = ckalloc(sizeof(TkHalfdeadWindow)); + halfdeadPtr = (TkHalfdeadWindow *)ckalloc(sizeof(TkHalfdeadWindow)); halfdeadPtr->flags = 0; halfdeadPtr->winPtr = winPtr; halfdeadPtr->nextPtr = tsdPtr->halfdeadWindowList; @@ -1484,7 +1484,7 @@ Tk_DestroyWindow( winPtr->mainPtr->deletionEpoch++; } if (winPtr->mainPtr->refCount-- <= 1) { - register const TkCmd *cmdPtr; + const TkCmd *cmdPtr; /* * We just deleted the last window in the application. Delete the @@ -1671,7 +1671,7 @@ void Tk_MakeWindowExist( Tk_Window tkwin) /* Token for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *winPtr2; Window parent; Tcl_HashEntry *hPtr; @@ -1780,7 +1780,7 @@ void Tk_UnmapWindow( Tk_Window tkwin) /* Token for window to unmap. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (!(winPtr->flags & TK_MAPPED) || (winPtr->flags & TK_ALREADY_DEAD)) { return; @@ -1817,7 +1817,7 @@ Tk_ConfigureWindow( * are to be used. */ XWindowChanges *valuePtr) /* New values. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWX) { winPtr->changes.x = valuePtr->x; @@ -1853,7 +1853,7 @@ Tk_MoveWindow( Tk_Window tkwin, /* Window to move. */ int x, int y) /* New location for window (within parent). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1871,7 +1871,7 @@ Tk_ResizeWindow( Tk_Window tkwin, /* Window to resize. */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.width = (unsigned) width; winPtr->changes.height = (unsigned) height; @@ -1891,7 +1891,7 @@ Tk_MoveResizeWindow( int x, int y, /* New location for window (within parent). */ int width, int height) /* New dimensions for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.x = x; winPtr->changes.y = y; @@ -1912,7 +1912,7 @@ Tk_SetWindowBorderWidth( Tk_Window tkwin, /* Window to modify. */ int width) /* New border width for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->changes.border_width = width; if (winPtr->window != None) { @@ -1930,10 +1930,10 @@ Tk_ChangeWindowAttributes( Tk_Window tkwin, /* Window to manipulate. */ unsigned long valueMask, /* OR'ed combination of bits, indicating which * fields of *attsPtr are to be used. */ - register XSetWindowAttributes *attsPtr) + XSetWindowAttributes *attsPtr) /* New values for some attributes. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (valueMask & CWBackPixmap) { winPtr->atts.background_pixmap = attsPtr->background_pixmap; @@ -1996,7 +1996,7 @@ Tk_SetWindowBackground( unsigned long pixel) /* Pixel value to use for window's * background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixel = pixel; @@ -2013,7 +2013,7 @@ Tk_SetWindowBackgroundPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's background. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.background_pixmap = pixmap; @@ -2031,7 +2031,7 @@ Tk_SetWindowBorder( Tk_Window tkwin, /* Window to manipulate. */ unsigned long pixel) /* Pixel value to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixel = pixel; @@ -2048,7 +2048,7 @@ Tk_SetWindowBorderPixmap( Tk_Window tkwin, /* Window to manipulate. */ Pixmap pixmap) /* Pixmap to use for window's border. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.border_pixmap = pixmap; @@ -2066,7 +2066,7 @@ Tk_DefineCursor( Tk_Window tkwin, /* Window to manipulate. */ Tk_Cursor cursor) /* Cursor to use for window (may be None). */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.cursor = (Cursor) cursor; @@ -2089,7 +2089,7 @@ Tk_SetWindowColormap( Tk_Window tkwin, /* Window to manipulate. */ Colormap colormap) /* Colormap to use for window. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->atts.colormap = colormap; @@ -2131,7 +2131,7 @@ Tk_SetWindowVisual( int depth, /* New depth for window. */ Colormap colormap) /* An appropriate colormap for the visual. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->window != None) { /* Too late! */ @@ -2174,7 +2174,7 @@ Tk_SetWindowVisual( void TkDoConfigureNotify( - register TkWindow *winPtr) /* Window whose configuration was just + TkWindow *winPtr) /* Window whose configuration was just * changed. */ { XEvent event; @@ -2220,7 +2220,7 @@ Tk_SetClass( Tk_Window tkwin, /* Token for window to assign class. */ const char *className) /* New class for tkwin. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classUid = Tk_GetUid(className); if (winPtr->flags & TK_WIN_MANAGED) { @@ -2253,7 +2253,7 @@ Tk_SetClassProcs( const Tk_ClassProcs *procs, /* Class procs structure. */ ClientData instanceData) /* Data to be passed to class functions. */ { - register TkWindow *winPtr = (TkWindow *) tkwin; + TkWindow *winPtr = (TkWindow *) tkwin; winPtr->classProcsPtr = procs; winPtr->instanceData = instanceData; @@ -2312,7 +2312,7 @@ Tk_NameToWindow( } return NULL; } - return Tcl_GetHashValue(hPtr); + return (Tk_Window)Tcl_GetHashValue(hPtr); } /* @@ -2358,7 +2358,7 @@ Tk_IdToWindow( if (hPtr == NULL) { return NULL; } - return Tcl_GetHashValue(hPtr); + return (Tk_Window)Tcl_GetHashValue(hPtr); } /* @@ -2616,7 +2616,7 @@ Tk_MainWindow( return NULL; } #endif - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (mainPtr = tsdPtr->mainWindowList; mainPtr != NULL; mainPtr = mainPtr->nextPtr) { @@ -2686,7 +2686,7 @@ Tk_GetNumMainWindows(void) } #endif - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); return tsdPtr->numMainWindows; } @@ -2744,7 +2744,7 @@ DeleteWindowsExitProc( { TkDisplay *dispPtr, *nextPtr; Tcl_Interp *interp; - ThreadSpecificData *tsdPtr = clientData; + ThreadSpecificData *tsdPtr = (ThreadSpecificData *)clientData; if (tsdPtr == NULL) { return; @@ -2858,7 +2858,7 @@ TkCygwinMainEx( return 0; } tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *)) - GetProcAddress(tkcygwindll, "Tk_MainEx"); + (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); if (!tkmainex) { return 0; } @@ -2898,7 +2898,7 @@ Tk_Init( if (tkcygwindll) { int (*tkinit)(Tcl_Interp *); - tkinit = (int(*)(Tcl_Interp *)) GetProcAddress(tkcygwindll,"Tk_Init"); + tkinit = (int(*)(Tcl_Interp *))(void *)GetProcAddress(tkcygwindll,"Tk_Init"); if (tkinit) { return tkinit(interp); } @@ -2972,7 +2972,7 @@ Tk_SafeInit( int (*tksafeinit)(Tcl_Interp *); tksafeinit = (int (*)(Tcl_Interp *)) - GetProcAddress(tkcygwindll, "Tk_SafeInit"); + (void *)GetProcAddress(tkcygwindll, "Tk_SafeInit"); if (tksafeinit) { return tksafeinit(interp); } @@ -3007,6 +3007,8 @@ CopyValue( Tcl_Obj *objPtr, void *dstPtr) { + (void)dummy; + *(Tcl_Obj **)dstPtr = objPtr; return 1; } @@ -3033,17 +3035,17 @@ Initialize( const Tcl_ArgvInfo table[] = { {TCL_ARGV_CONSTANT, "-sync", INT2PTR(1), &sync, "Use synchronous mode for display server", NULL}, - {TCL_ARGV_FUNC, "-colormap", CopyValue, &colorMapObj, + {TCL_ARGV_FUNC, "-colormap", (void *)CopyValue, &colorMapObj, "Colormap for main window", NULL}, - {TCL_ARGV_FUNC, "-display", CopyValue, &displayObj, + {TCL_ARGV_FUNC, "-display", (void *)CopyValue, &displayObj, "Display to use", NULL}, - {TCL_ARGV_FUNC, "-geometry", CopyValue, &geometryObj, + {TCL_ARGV_FUNC, "-geometry", (void *)CopyValue, &geometryObj, "Initial geometry for window", NULL}, - {TCL_ARGV_FUNC, "-name", CopyValue, &nameObj, + {TCL_ARGV_FUNC, "-name", (void *)CopyValue, &nameObj, "Name to use for application", NULL}, - {TCL_ARGV_FUNC, "-visual", CopyValue, &visualObj, + {TCL_ARGV_FUNC, "-visual", (void *)CopyValue, &visualObj, "Visual for main window", NULL}, - {TCL_ARGV_FUNC, "-use", CopyValue, &useObj, + {TCL_ARGV_FUNC, "-use", (void *)CopyValue, &useObj, "Id of window in which to embed application", NULL}, TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; @@ -3068,7 +3070,7 @@ Initialize( TkRegisterObjTypes(); - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * We start by resetting the result because it might not be clean. diff --git a/generic/ttk/ttk.decls b/generic/ttk/ttk.decls index b3297b4..1c98b23 100644 --- a/generic/ttk/ttk.decls +++ b/generic/ttk/ttk.decls @@ -143,7 +143,7 @@ declare 35 { # # Utilities. # -declare 40 { +declare 40 {deprecated {}} { int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient) } diff --git a/generic/ttk/ttkBlink.c b/generic/ttk/ttkBlink.c index 484e66b..dcd342c 100644 --- a/generic/ttk/ttkBlink.c +++ b/generic/ttk/ttkBlink.c @@ -34,9 +34,11 @@ typedef struct /* CursorManagerDeleteProc -- * InterpDeleteProc for cursor manager. */ -static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) +static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *dummy) { CursorManager *cm = (CursorManager*)clientData; + (void)dummy; + if (cm->timer) { Tcl_DeleteTimerHandler(cm->timer); } @@ -49,10 +51,10 @@ static void CursorManagerDeleteProc(ClientData clientData, Tcl_Interp *interp) static CursorManager *GetCursorManager(Tcl_Interp *interp) { static const char *cm_key = "ttk::CursorManager"; - CursorManager *cm = Tcl_GetAssocData(interp, cm_key,0); + CursorManager *cm = (CursorManager *)Tcl_GetAssocData(interp, cm_key,0); if (!cm) { - cm = ckalloc(sizeof(*cm)); + cm = (CursorManager *)ckalloc(sizeof(*cm)); cm->timer = 0; cm->owner = 0; cm->onTime = DEF_CURSOR_ON_TIME; @@ -68,7 +70,7 @@ static CursorManager *GetCursorManager(Tcl_Interp *interp) static void CursorBlinkProc(ClientData clientData) { - CursorManager *cm = clientData; + CursorManager *cm = (CursorManager *)clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index 571c011..dec802b 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -106,7 +106,7 @@ static const Tk_OptionSpec BaseOptionSpecs[] = */ static void TextVariableChanged(void *clientData, const char *value) { - Base *basePtr = clientData; + Base *basePtr = (Base *)clientData; Tcl_Obj *newText; if (WidgetDestroyed(&basePtr->core)) { @@ -123,9 +123,11 @@ static void TextVariableChanged(void *clientData, const char *value) } static void -BaseInitialize(Tcl_Interp *interp, void *recordPtr) +BaseInitialize(Tcl_Interp *dummy, void *recordPtr) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; + (void)dummy; + basePtr->base.textVariableTrace = 0; basePtr->base.imageSpec = NULL; } @@ -133,7 +135,7 @@ BaseInitialize(Tcl_Interp *interp, void *recordPtr) static void BaseCleanup(void *recordPtr) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; if (basePtr->base.textVariableTrace) Ttk_UntraceVariable(basePtr->base.textVariableTrace); if (basePtr->base.imageSpec) @@ -146,12 +148,19 @@ BaseImageChanged( int imageWidth, int imageHeight) { Base *basePtr = (Base *)clientData; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; + TtkResizeWidget(&basePtr->core); } static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; Tcl_Obj *textVarName = basePtr->base.textVariableObj; Ttk_TraceHandle *vt = 0; Ttk_ImageSpec *imageSpec = NULL; @@ -194,10 +203,12 @@ error: } static int -BasePostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) +BasePostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask) { - Base *basePtr = recordPtr; + Base *basePtr = (Base *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (basePtr->base.textVariableTrace) { status = Ttk_FireTrace(basePtr->base.textVariableTrace); @@ -327,7 +338,7 @@ static const Tk_OptionSpec ButtonOptionSpecs[] = static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Button *buttonPtr = recordPtr; + Button *buttonPtr = (Button *)recordPtr; if (BaseConfigure(interp, recordPtr, mask) != TCL_OK) { return TCL_ERROR; @@ -355,7 +366,7 @@ static int ButtonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Button *buttonPtr = recordPtr; + Button *buttonPtr = (Button *)recordPtr; if (objc > 2) { Tcl_WrongNumArgs(interp, 1, objv, "invoke"); return TCL_ERROR; @@ -447,7 +458,7 @@ static const Tk_OptionSpec CheckbuttonOptionSpecs[] = */ static void CheckbuttonVariableChanged(void *clientData, const char *value) { - Checkbutton *checkPtr = clientData; + Checkbutton *checkPtr = (Checkbutton *)clientData; if (WidgetDestroyed(&checkPtr->core)) { return; @@ -469,7 +480,7 @@ static void CheckbuttonVariableChanged(void *clientData, const char *value) static void CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Tcl_Obj *variableObj; /* default -variable is the widget name: @@ -483,7 +494,7 @@ CheckbuttonInitialize(Tcl_Interp *interp, void *recordPtr) static void CheckbuttonCleanup(void *recordPtr) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Ttk_UntraceVariable(checkPtr->checkbutton.variableTrace); checkPtr->checkbutton.variableTrace = 0; BaseCleanup(recordPtr); @@ -492,7 +503,7 @@ CheckbuttonCleanup(void *recordPtr) static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; Tcl_Obj *varName = checkPtr->checkbutton.variableObj; Ttk_TraceHandle *vt = NULL; @@ -520,7 +531,7 @@ CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int CheckbuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; int status = TCL_OK; if (checkPtr->checkbutton.variableTrace) @@ -538,7 +549,7 @@ static int CheckbuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Checkbutton *checkPtr = recordPtr; + Checkbutton *checkPtr = (Checkbutton *)recordPtr; WidgetCore *corePtr = &checkPtr->core; Tcl_Obj *newValue; @@ -653,7 +664,7 @@ static const Tk_OptionSpec RadiobuttonOptionSpecs[] = static void RadiobuttonVariableChanged(void *clientData, const char *value) { - Radiobutton *radioPtr = clientData; + Radiobutton *radioPtr = (Radiobutton *)clientData; if (WidgetDestroyed(&radioPtr->core)) { return; @@ -675,7 +686,7 @@ RadiobuttonVariableChanged(void *clientData, const char *value) static void RadiobuttonCleanup(void *recordPtr) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; Ttk_UntraceVariable(radioPtr->radiobutton.variableTrace); radioPtr->radiobutton.variableTrace = 0; BaseCleanup(recordPtr); @@ -684,7 +695,7 @@ RadiobuttonCleanup(void *recordPtr) static int RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; Ttk_TraceHandle *vt = Ttk_TraceVariable( interp, radioPtr->radiobutton.variableObj, RadiobuttonVariableChanged, radioPtr); @@ -707,7 +718,7 @@ RadiobuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int RadiobuttonPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; int status = TCL_OK; if (radioPtr->radiobutton.variableTrace) @@ -725,7 +736,7 @@ static int RadiobuttonInvokeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Radiobutton *radioPtr = recordPtr; + Radiobutton *radioPtr = (Radiobutton *)recordPtr; WidgetCore *corePtr = &radioPtr->core; if (objc > 2) { diff --git a/generic/ttk/ttkCache.c b/generic/ttk/ttkCache.c index c29007c..9059c55 100644 --- a/generic/ttk/ttkCache.c +++ b/generic/ttk/ttkCache.c @@ -48,7 +48,7 @@ struct Ttk_ResourceCache_ { */ Ttk_ResourceCache Ttk_CreateResourceCache(Tcl_Interp *interp) { - Ttk_ResourceCache cache = ckalloc(sizeof(*cache)); + Ttk_ResourceCache cache = (Ttk_ResourceCache)ckalloc(sizeof(*cache)); cache->tkwin = NULL; /* initialized later */ cache->interp = interp; @@ -75,7 +75,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->fontTable, &search); while (entryPtr != NULL) { - Tcl_Obj *fontObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *fontObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (fontObj) { Tk_FreeFontFromObj(cache->tkwin, fontObj); Tcl_DecrRefCount(fontObj); @@ -90,7 +90,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->colorTable, &search); while (entryPtr != NULL) { - Tcl_Obj *colorObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *colorObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (colorObj) { Tk_FreeColorFromObj(cache->tkwin, colorObj); Tcl_DecrRefCount(colorObj); @@ -105,7 +105,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->borderTable, &search); while (entryPtr != NULL) { - Tcl_Obj *borderObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *borderObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); if (borderObj) { Tk_Free3DBorderFromObj(cache->tkwin, borderObj); Tcl_DecrRefCount(borderObj); @@ -120,7 +120,7 @@ static void Ttk_ClearCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->imageTable, &search); while (entryPtr != NULL) { - Tk_Image image = Tcl_GetHashValue(entryPtr); + Tk_Image image = (Tk_Image)Tcl_GetHashValue(entryPtr); if (image) { Tk_FreeImage(image); } @@ -153,7 +153,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) */ entryPtr = Tcl_FirstHashEntry(&cache->namedColors, &search); while (entryPtr != NULL) { - Tcl_Obj *colorNameObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *colorNameObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(colorNameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -168,7 +168,7 @@ void Ttk_FreeResourceCache(Ttk_ResourceCache cache) */ static void CacheWinEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_ResourceCache cache = clientData; + Ttk_ResourceCache cache = (Ttk_ResourceCache)clientData; if (eventPtr->type != DestroyNotify) { return; @@ -216,7 +216,7 @@ void Ttk_RegisterNamedColor( entryPtr = Tcl_CreateHashEntry(&cache->namedColors, colorName, &newEntry); if (!newEntry) { - Tcl_Obj *oldColor = Tcl_GetHashValue(entryPtr); + Tcl_Obj *oldColor = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(oldColor); } @@ -234,7 +234,7 @@ static Tcl_Obj *CheckNamedColor(Ttk_ResourceCache cache, Tcl_Obj *objPtr) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&cache->namedColors, Tcl_GetString(objPtr)); if (entryPtr) { /* Use named color instead */ - objPtr = Tcl_GetHashValue(entryPtr); + objPtr = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); } return objPtr; } @@ -257,7 +257,7 @@ static Tcl_Obj *Ttk_Use( Tcl_Obj *cacheObj; if (!newEntry) { - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); } cacheObj = Tcl_DuplicateObj(objPtr); @@ -314,9 +314,17 @@ Tcl_Obj *Ttk_UseBorder( * Tk_ImageChangedProc for Ttk_UseImage */ -static void NullImageChanged(ClientData clientData, +static void NullImageChanged(ClientData dummy, int x, int y, int width, int height, int imageWidth, int imageHeight) -{ /* No-op */ } +{ /* No-op */ + (void)dummy; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; +} /* * Ttk_UseImage -- @@ -333,7 +341,7 @@ Tk_Image Ttk_UseImage(Ttk_ResourceCache cache, Tk_Window tkwin, Tcl_Obj *objPtr) InitCacheWindow(cache, tkwin); if (!newEntry) { - return Tcl_GetHashValue(entryPtr); + return (Tk_Image)Tcl_GetHashValue(entryPtr); } image = Tk_GetImage(cache->interp, tkwin, imageName, NullImageChanged,0); diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index 573728a..ec35480 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -338,6 +338,7 @@ static void SashElementSize( int sashPad = 2, sashThickness = 6, handleSize = 8; Ttk_Orient orient = (Ttk_Orient)PTR2INT(clientData); (void)paddingPtr; + (void)paddingPtr; Tk_GetPixelsFromObj(NULL, tkwin, sash->sashThicknessObj, &sashThickness); Tk_GetPixelsFromObj(NULL, tkwin, sash->handleSizeObj, &handleSize); diff --git a/generic/ttk/ttkDecls.h b/generic/ttk/ttkDecls.h index 1aa0874..5f76634 100644 --- a/generic/ttk/ttkDecls.h +++ b/generic/ttk/ttkDecls.h @@ -17,6 +17,15 @@ extern const char *TtkInitializeStubs( #endif +#if !defined(BUILD_tk) +# define TTK_DEPRECATED(msg) TTKAPI TCL_DEPRECATED_API(msg) +#elif defined(TK_NO_DEPRECATED) +# define TTK_DEPRECATED(msg) MODULE_SCOPE +#else +# define TTK_DEPRECATED(msg) TTKAPI +#endif + + /* !BEGIN!: Do not edit below this line. */ @@ -130,7 +139,8 @@ TTKAPI Tcl_Obj * Ttk_NewBoxObj(Ttk_Box box); /* Slot 38 is reserved */ /* Slot 39 is reserved */ /* 40 */ -TTKAPI int Ttk_GetOrientFromObj(Tcl_Interp *interp, +TTK_DEPRECATED("") +int Ttk_GetOrientFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); typedef struct TtkStubs { @@ -179,7 +189,7 @@ typedef struct TtkStubs { void (*reserved37)(void); void (*reserved38)(void); void (*reserved39)(void); - int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */ + TCL_DEPRECATED_API("") int (*ttk_GetOrientFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *orient); /* 40 */ } TtkStubs; extern const TtkStubs *ttkStubsPtr; diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 1660107..cb5435a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -298,7 +298,7 @@ static char *EntryDisplayString(const char *showChar, int numChars) TkUtfToUniChar(showChar, &ch); size = TkUniCharToUtf(ch, buf); - p = displayString = ckalloc(numChars * size + 1); + p = displayString = (char *)ckalloc(numChars * size + 1); while (numChars--) { memcpy(p, buf, size); @@ -354,7 +354,7 @@ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; int byteCount; const char *string; const char *selStart, *selEnd; @@ -387,7 +387,7 @@ EntryFetchSelection( */ static void EntryLostSelection(ClientData clientData) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); @@ -419,8 +419,8 @@ static void EntryOwnSelection(Entry *entryPtr) static void ExpandPercents( Entry *entryPtr, /* Entry that needs validation. */ - const char *template, /* Script template */ - const char *new, /* Potential new value of entry string */ + const char *templ, /* Script template */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason, /* Reason for change */ @@ -433,28 +433,28 @@ ExpandPercents( int ch; char numStorage[2*TCL_INTEGER_SPACE]; - while (*template) { + while (*templ) { /* Find everything up to the next % character and append it * to the result string. */ - string = Tcl_UtfFindFirst(template, '%'); + string = Tcl_UtfFindFirst(templ, '%'); if (string == NULL) { /* No more %-sequences to expand. * Copy the rest of the template. */ - Tcl_DStringAppend(dsPtr, template, -1); + Tcl_DStringAppend(dsPtr, templ, -1); return; } - if (string != template) { - Tcl_DStringAppend(dsPtr, template, string - template); - template = string; + if (string != templ) { + Tcl_DStringAppend(dsPtr, templ, string - templ); + templ = string; } /* There's a percent sequence here. Process it. */ - ++template; /* skip over % */ - if (*template != '\0') { - template += TkUtfToUniChar(template, &ch); + ++templ; /* skip over % */ + if (*templ != '\0') { + templ += TkUtfToUniChar(templ, &ch); } else { ch = '%'; } @@ -477,14 +477,14 @@ ExpandPercents( string = numStorage; break; case 'P': /* 'Peeked' new value of the string */ - string = new; + string = newValue; break; case 's': /* Current string value */ string = entryPtr->entry.string; break; case 'S': /* string to be inserted/deleted, if any */ if (reason == VALIDATE_INSERT) { - string = Tcl_UtfAtIndex(new, index); + string = Tcl_UtfAtIndex(newValue, index); stringLength = Tcl_UtfAtIndex(string, count) - string; } else if (reason == VALIDATE_DELETE) { string = Tcl_UtfAtIndex(entryPtr->entry.string, index); @@ -528,9 +528,9 @@ ExpandPercents( static int RunValidationScript( Tcl_Interp *interp, /* Interpreter to use */ Entry *entryPtr, /* Entry being validated */ - const char *template, /* Script template */ + const char *templ, /* Script template */ const char *optionName, /* "-validatecommand", "-invalidcommand" */ - const char *new, /* Potential new value of entry string */ + const char *newValue, /* Potential new value of entry string */ int index, /* index of insert/delete */ int count, /* #changed characters */ VREASON reason) /* Reason for change */ @@ -539,7 +539,7 @@ static int RunValidationScript( int code; Tcl_DStringInit(&script); - ExpandPercents(entryPtr, template, new, index, count, reason, &script); + ExpandPercents(entryPtr, templ, newValue, index, count, reason, &script); code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), Tcl_DStringLength(&script), TCL_EVAL_GLOBAL); @@ -656,10 +656,11 @@ done: * Returns: * TCL_OK if valid, TCL_BREAK if invalid, TCL_ERROR on error. */ -static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) +static int EntryRevalidate(Tcl_Interp *dummy, Entry *entryPtr, VREASON reason) { int code = EntryValidateChange( entryPtr, entryPtr->entry.string, -1,0, reason); + (void)dummy; if (code == TCL_BREAK) { TtkWidgetChangeState(&entryPtr->core, TTK_STATE_INVALID, 0); @@ -751,7 +752,7 @@ EntryStoreValue(Entry *entryPtr, const char *value) /* Store new value: */ - entryPtr->entry.string = ckalloc(numBytes + 1); + entryPtr->entry.string = (char *)ckalloc(numBytes + 1); strcpy(entryPtr->entry.string, value); entryPtr->entry.numBytes = numBytes; entryPtr->entry.numChars = numChars; @@ -808,7 +809,7 @@ static int EntrySetValue(Entry *entryPtr, const char *value) */ static void EntryTextVariableTrace(void *recordPtr, const char *value) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (WidgetDestroyed(&entryPtr->core)) { return; @@ -842,29 +843,29 @@ InsertChars( size_t byteCount = strlen(value); int charsAdded = Tcl_NumUtfChars(value, byteCount); size_t newByteCount = entryPtr->entry.numBytes + byteCount + 1; - char *new; + char *newBytes; int code; if (byteCount == 0) { return TCL_OK; } - new = ckalloc(newByteCount); - memcpy(new, string, byteIndex); - strcpy(new + byteIndex, value); - strcpy(new + byteIndex + byteCount, string + byteIndex); + newBytes = (char *)ckalloc(newByteCount); + memcpy(newBytes, string, byteIndex); + strcpy(newBytes + byteIndex, value); + strcpy(newBytes + byteIndex + byteCount, string + byteIndex); code = EntryValidateChange( - entryPtr, new, index, charsAdded, VALIDATE_INSERT); + entryPtr, newBytes, index, charsAdded, VALIDATE_INSERT); if (code == TCL_OK) { AdjustIndices(entryPtr, index, charsAdded); - code = EntrySetValue(entryPtr, new); + code = EntrySetValue(entryPtr, newBytes); } else if (code == TCL_BREAK) { code = TCL_OK; } - ckfree(new); + ckfree(newBytes); return code; } @@ -879,7 +880,7 @@ DeleteChars( { char *string = entryPtr->entry.string; size_t byteIndex, byteCount, newByteCount; - char *new; + char *newBytes; int code; if (index < 0) { @@ -896,20 +897,20 @@ DeleteChars( byteCount = Tcl_UtfAtIndex(string+byteIndex, count) - (string+byteIndex); newByteCount = entryPtr->entry.numBytes + 1 - byteCount; - new = ckalloc(newByteCount); - memcpy(new, string, byteIndex); - strcpy(new + byteIndex, string + byteIndex + byteCount); + newBytes = (char *)ckalloc(newByteCount); + memcpy(newBytes, string, byteIndex); + strcpy(newBytes + byteIndex, string + byteIndex + byteCount); code = EntryValidateChange( - entryPtr, new, index, count, VALIDATE_DELETE); + entryPtr, newBytes, index, count, VALIDATE_DELETE); if (code == TCL_OK) { AdjustIndices(entryPtr, index, -count); - code = EntrySetValue(entryPtr, new); + code = EntrySetValue(entryPtr, newBytes); } else if (code == TCL_BREAK) { code = TCL_OK; } - ckfree(new); + ckfree(newBytes); return code; } @@ -926,7 +927,7 @@ DeleteChars( static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { @@ -949,9 +950,10 @@ EntryEventProc(ClientData clientData, XEvent *eventPtr) */ static void -EntryInitialize(Tcl_Interp *interp, void *recordPtr) +EntryInitialize(Tcl_Interp *dummy, void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; + (void)dummy; Tk_CreateEventHandler( entryPtr->core.tkwin, EntryEventMask, EntryEventProc, entryPtr); @@ -959,7 +961,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) EntryFetchSelection, (ClientData) entryPtr, XA_STRING); TtkBlinkCursor(&entryPtr->core); - entryPtr->entry.string = ckalloc(1); + entryPtr->entry.string = (char *)ckalloc(1); *entryPtr->entry.string = '\0'; entryPtr->entry.displayString = entryPtr->entry.string; entryPtr->entry.textVariableTrace = 0; @@ -978,7 +980,7 @@ EntryInitialize(Tcl_Interp *interp, void *recordPtr) static void EntryCleanup(void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (entryPtr->entry.textVariableTrace) Ttk_UntraceVariable(entryPtr->entry.textVariableTrace); @@ -1000,7 +1002,7 @@ EntryCleanup(void *recordPtr) */ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; Tcl_Obj *textVarName = entryPtr->entry.textVariableObj; Ttk_TraceHandle *vt = 0; @@ -1064,10 +1066,11 @@ static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) /* EntryPostConfigure -- * Post-configuration hook for entry widgets. */ -static int EntryPostConfigure(Tcl_Interp *interp, void *recordPtr, int mask) +static int EntryPostConfigure(Tcl_Interp *dummy, void *recordPtr, int mask) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int status = TCL_OK; + (void)dummy; if ((mask & TEXTVAR_CHANGED) && entryPtr->entry.textVariableTrace != NULL) { status = Ttk_FireTrace(entryPtr->entry.textVariableTrace); @@ -1105,7 +1108,7 @@ EntryCharPosition(Entry *entryPtr, int index) static void EntryDoLayout(void *recordPtr) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; WidgetCore *corePtr = &entryPtr->core; Tk_TextLayout textLayout = entryPtr->entry.textLayout; int leftIndex = entryPtr->entry.xscroll.first; @@ -1192,7 +1195,7 @@ static GC EntryGetGC(Entry *entryPtr, Tcl_Obj *colorObj, TkRegion clip) */ static void EntryDisplay(void *clientData, Drawable d) { - Entry *entryPtr = clientData; + Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->core.tkwin; int leftIndex = entryPtr->entry.xscroll.first, rightIndex = entryPtr->entry.xscroll.last + 1, @@ -1448,7 +1451,7 @@ static int EntryBBoxCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; Ttk_Box b; int index; @@ -1478,7 +1481,7 @@ static int EntryDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int first, last; if ((objc < 3) || (objc > 4)) { @@ -1507,7 +1510,7 @@ static int EntryGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; @@ -1523,7 +1526,7 @@ static int EntryICursorCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "pos"); return TCL_ERROR; @@ -1543,7 +1546,7 @@ static int EntryIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int index; if (objc != 3) { @@ -1565,7 +1568,7 @@ static int EntryInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int index; if (objc != 4) { @@ -1587,7 +1590,7 @@ EntryInsertCommand( static int EntrySelectionClearCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); @@ -1604,7 +1607,7 @@ static int EntrySelectionClearCommand( static int EntrySelectionPresentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; @@ -1620,7 +1623,7 @@ static int EntrySelectionPresentCommand( static int EntrySelectionRangeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int start, end; if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "start end"); @@ -1658,7 +1661,7 @@ static const Ttk_Ensemble EntrySelectionCommands[] = { static int EntrySetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "value"); return TCL_ERROR; @@ -1674,7 +1677,7 @@ static int EntrySetCommand( static int EntryValidateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; int code; if (objc != 2) { @@ -1696,7 +1699,7 @@ static int EntryValidateCommand( static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Entry *entryPtr = recordPtr; + Entry *entryPtr = (Entry *)recordPtr; if (objc == 3) { int newFirst; if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { @@ -1791,7 +1794,7 @@ static const Tk_OptionSpec ComboboxOptionSpecs[] = { static void ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) { - Combobox *cb = recordPtr; + Combobox *cb = (Combobox *)recordPtr; cb->combobox.currentIndex = -1; TtkTrackElementState(&cb->core); @@ -1804,7 +1807,7 @@ ComboboxInitialize(Tcl_Interp *interp, void *recordPtr) static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Combobox *cbPtr = recordPtr; + Combobox *cbPtr = (Combobox *)recordPtr; int unused; /* Make sure -values is a valid list: @@ -1824,7 +1827,7 @@ ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) static int ComboboxCurrentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Combobox *cbPtr = recordPtr; + Combobox *cbPtr = (Combobox *)recordPtr; int currentIndex = cbPtr->combobox.currentIndex; const char *currentValue = cbPtr->entry.string; int nValues; @@ -1895,7 +1898,7 @@ static int ComboboxCurrentCommand( cbPtr->combobox.currentIndex = currentIndex; - return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex])); + return EntrySetValue((Entry *)recordPtr, Tcl_GetString(values[currentIndex])); } else { Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?"); return TCL_ERROR; @@ -1997,7 +2000,7 @@ static const Tk_OptionSpec SpinboxOptionSpecs[] = { static void SpinboxInitialize(Tcl_Interp *interp, void *recordPtr) { - Spinbox *sb = recordPtr; + Spinbox *sb = (Spinbox *)recordPtr; TtkTrackElementState(&sb->core); EntryInitialize(interp, recordPtr); } @@ -2008,7 +2011,7 @@ SpinboxInitialize(Tcl_Interp *interp, void *recordPtr) static int SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Spinbox *sb = recordPtr; + Spinbox *sb = (Spinbox *)recordPtr; int unused; /* Make sure -values is a valid list: @@ -2070,18 +2073,20 @@ static const Ttk_ElementOptionSpec TextareaElementOptions[] = { offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, offsetof(TextareaElement,widthObj), "20" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TextareaElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TextareaElement *textarea = elementRecord; + TextareaElement *textarea = (TextareaElement *)elementRecord; Tk_Font font = Tk_GetFontFromObj(tkwin, textarea->fontObj); int avgWidth = Tk_TextWidth(font, "0", 1); Tk_FontMetrics fm; int prefWidth = 1; + (void)dummy; + (void)paddingPtr; Tk_GetFontMetrics(font, &fm); Tcl_GetIntFromObj(NULL, textarea->widthObj, &prefWidth); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index e623409..85ef9fa 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -90,7 +90,10 @@ static Ttk_Padding FrameMargins(Frame *framePtr) */ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; + (void)widthPtr; + (void)heightPtr; + Ttk_SetMargins(framePtr->core.tkwin, FrameMargins(framePtr)); return 0; } @@ -111,7 +114,7 @@ static int FrameSize(void *recordPtr, int *widthPtr, int *heightPtr) static int FrameConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Frame *framePtr = recordPtr; + Frame *framePtr = (Frame *)recordPtr; int width, height; /* @@ -339,11 +342,13 @@ LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) */ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; Ttk_Padding margins; LabelframeStyle style; int labelWidth, labelHeight; + (void)widthPtr; + (void)heightPtr; LabelframeStyleOptions(lframePtr, &style); @@ -384,7 +389,7 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) static Ttk_Layout LabelframeGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Labelframe *lf = recordPtr; + Labelframe *lf = (Labelframe *)recordPtr; Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout labelLayout; @@ -415,7 +420,7 @@ static Ttk_Layout LabelframeGetLayout( static void LabelframeDoLayout(void *recordPtr) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; WidgetCore *corePtr = &lframePtr->core; int lw, lh; /* Label width and height */ LabelframeStyle style; @@ -461,7 +466,7 @@ static void LabelframeDoLayout(void *recordPtr) static void LabelframeDisplay(void *recordPtr, Drawable d) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); if (lframePtr->label.labelLayout) { Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); @@ -476,7 +481,7 @@ static void LabelframeDisplay(void *recordPtr, Drawable d) */ static void LabelframePlaceSlaves(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; if (Ttk_NumberSlaves(lframe->label.mgr) == 1) { Ttk_Box b; @@ -489,6 +494,11 @@ static void LabelframePlaceSlaves(void *recordPtr) static int LabelRequest(void *managerData, TkSizeT index, int width, int height) { + (void)managerData; + (void)index; + (void)width; + (void)height; + return 1; } @@ -501,7 +511,9 @@ static int LabelRequest(void *managerData, TkSizeT index, int width, int height) */ static void LabelRemoved(void *managerData, TkSizeT slaveIndex) { - Labelframe *lframe = managerData; + Labelframe *lframe = (Labelframe *)managerData; + (void)slaveIndex; + lframe->label.labelWidget = 0; } @@ -516,9 +528,10 @@ static Ttk_ManagerSpec LabelframeManagerSpec = { /* LabelframeInitialize -- * Initialization hook. */ -static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) +static void LabelframeInitialize(Tcl_Interp *dummy, void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; + (void)dummy; lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); @@ -532,7 +545,7 @@ static void LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) */ static void LabelframeCleanup(void *recordPtr) { - Labelframe *lframe = recordPtr; + Labelframe *lframe = (Labelframe *)recordPtr; Ttk_DeleteManager(lframe->label.mgr); if (lframe->label.labelLayout) { Ttk_FreeLayout(lframe->label.labelLayout); @@ -563,7 +576,7 @@ static void RaiseLabelWidget(Labelframe *lframe) */ static int LabelframeConfigure(Tcl_Interp *interp,void *recordPtr,int mask) { - Labelframe *lframePtr = recordPtr; + Labelframe *lframePtr = (Labelframe *)recordPtr; Tk_Window labelWidget = lframePtr->label.labelWidget; Ttk_PositionSpec unused; diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index bcac5c1..e6ad27d 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -31,9 +31,17 @@ struct TtkImageSpec { /* NullImageChanged -- * Do-nothing Tk_ImageChangedProc. */ -static void NullImageChanged(ClientData clientData, +static void NullImageChanged(ClientData dummy, int x, int y, int width, int height, int imageWidth, int imageHeight) -{ /* No-op */ } +{ /* No-op */ + (void)dummy; + (void)x; + (void)y; + (void)width; + (void)height; + (void)imageWidth; + (void)imageHeight; +} /* ImageSpecImageChanged -- * Image changes should trigger a repaint. @@ -74,7 +82,7 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int i = 0, n = 0, objc; Tcl_Obj **objv; - imageSpec = ckalloc(sizeof(*imageSpec)); + imageSpec = (Ttk_ImageSpec *)ckalloc(sizeof(*imageSpec)); imageSpec->baseImage = 0; imageSpec->mapCount = 0; imageSpec->states = 0; @@ -97,8 +105,8 @@ TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, } n = (objc - 1) / 2; - imageSpec->states = ckalloc(n * sizeof(Ttk_StateSpec)); - imageSpec->images = ckalloc(n * sizeof(Tk_Image *)); + imageSpec->states = (Ttk_StateSpec *)ckalloc(n * sizeof(Ttk_StateSpec)); + imageSpec->images = (Tk_Image *)ckalloc(n * sizeof(Tk_Image)); /* Get base image: */ @@ -205,6 +213,7 @@ static void Ttk_Fill( int dr = dst.x + dst.width; int db = dst.y + dst.height; int x,y; + (void)tkwin; if (!(src.width && src.height && dst.width && dst.height)) return; @@ -262,7 +271,7 @@ typedef struct { /* ClientData for image elements */ static void FreeImageData(void *clientData) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; if (imageData->imageSpec) { TtkFreeImageSpec(imageData->imageSpec); } #if TILE_07_COMPAT if (imageData->imageMap) { Tcl_DecrRefCount(imageData->imageMap); } @@ -274,8 +283,10 @@ static void ImageElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; Tk_Image image = imageData->imageSpec->baseImage; + (void)elementRecord; + (void)tkwin; if (image) { Tk_SizeOfImage(image, widthPtr, heightPtr); @@ -294,10 +305,11 @@ static void ImageElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ImageData *imageData = clientData; + ImageData *imageData = (ImageData *)clientData; Tk_Image image = 0; int imgWidth, imgHeight; Ttk_Box src, dst; + (void)elementRecord; #if TILE_07_COMPAT if (imageData->imageMap) { @@ -339,7 +351,7 @@ static const Ttk_ElementSpec ImageElementSpec = static int Ttk_CreateImageElement( Tcl_Interp *interp, - void *clientData, + void *dummy, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) @@ -352,6 +364,7 @@ Ttk_CreateImageElement( ImageData *imageData = 0; int padding_specified = 0; int i; + (void)dummy; if (objc <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -365,7 +378,7 @@ Ttk_CreateImageElement( return TCL_ERROR; } - imageData = ckalloc(sizeof(*imageData)); + imageData = (ImageData *)ckalloc(sizeof(*imageData)); imageData->imageSpec = imageSpec; imageData->minWidth = imageData->minHeight = -1; imageData->sticky = TTK_FILL_BOTH; diff --git a/generic/ttk/ttkInit.c b/generic/ttk/ttkInit.c index 360760a..f7f0066 100644 --- a/generic/ttk/ttkInit.c +++ b/generic/ttk/ttkInit.c @@ -55,6 +55,7 @@ const char *const ttkOrientStrings[] = { "horizontal", "vertical", NULL }; +#if !defined(TK_NO_DEPRECATED) && TK_MAJOR_VERSION < 9 int Ttk_GetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { @@ -62,6 +63,7 @@ int Ttk_GetOrientFromObj( return Tcl_GetIndexFromObjStruct(interp, objPtr, ttkOrientStrings, sizeof(char *), "orientation", 0, resultPtr); } +#endif int TtkGetOrientFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, Ttk_Orient *resultPtr) diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 228b72d..a4dbf96 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -65,7 +65,7 @@ static const Ttk_ElementOptionSpec TextElementOptions[] = { offsetof(TextElement,wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, offsetof(TextElement,embossedObj), "0"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static int TextSetup(TextElement *text, Tk_Window tkwin) @@ -193,10 +193,12 @@ static void TextDraw(TextElement *text, Tk_Window tkwin, Drawable d, Ttk_Box b) } static void TextElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TextElement *text = elementRecord; + TextElement *text = (TextElement *)elementRecord; + (void)dummy; + (void)paddingPtr; if (!TextSetup(text, tkwin)) return; @@ -210,10 +212,13 @@ static void TextElementSize( } static void TextElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - TextElement *text = elementRecord; + TextElement *text = (TextElement *)elementRecord; + (void)dummy; + (void)state; + if (TextSetup(text, tkwin)) { TextDraw(text, tkwin, d, b); TextCleanup(text); @@ -253,7 +258,7 @@ static const Ttk_ElementOptionSpec ImageElementOptions[] = { offsetof(ImageElement,stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -360,10 +365,12 @@ static void ImageDraw( } static void ImageElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ImageElement *image = elementRecord; + ImageElement *image = (ImageElement *)elementRecord; + (void)dummy; + (void)paddingPtr; if (ImageSetup(image, tkwin, 0)) { *widthPtr = image->width; @@ -373,10 +380,11 @@ static void ImageElementSize( } static void ImageElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - ImageElement *image = elementRecord; + ImageElement *image = (ImageElement *)elementRecord; + (void)dummy; if (ImageSetup(image, tkwin, state)) { ImageDraw(image, tkwin, d, b, state); @@ -477,7 +485,7 @@ static const Ttk_ElementOptionSpec LabelElementOptions[] = { offsetof(LabelElement,image.stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -561,11 +569,13 @@ static void LabelCleanup(LabelElement *c) } static void LabelElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - LabelElement *label = elementRecord; + LabelElement *label = (LabelElement *)elementRecord; int textReqWidth = 0; + (void)dummy; + (void)paddingPtr; LabelSetup(label, tkwin, 0); @@ -607,7 +617,7 @@ static void LabelElementSize( */ static void DrawCompound( LabelElement *l, Ttk_Box b, Tk_Window tkwin, Drawable d, Ttk_State state, - int imageSide, int textSide) + Ttk_Side imageSide, Ttk_Side textSide) { Ttk_Box imageBox = Ttk_PlaceBox(&b, l->image.width, l->image.height, imageSide, 0); @@ -618,11 +628,12 @@ static void DrawCompound( } static void LabelElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - LabelElement *l = elementRecord; + LabelElement *l = (LabelElement *)elementRecord; Tk_Anchor anchor = TK_ANCHOR_CENTER; + (void)dummy; LabelSetup(l, tkwin, state); diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index 795ffb5..5e8c69c 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -524,7 +524,7 @@ struct Ttk_LayoutNode_ static Ttk_LayoutNode *Ttk_NewLayoutNode( unsigned flags, Ttk_ElementClass *elementClass) { - Ttk_LayoutNode *node = ckalloc(sizeof(*node)); + Ttk_LayoutNode *node = (Ttk_LayoutNode *)ckalloc(sizeof(*node)); node->flags = flags; node->eclass = elementClass; @@ -557,8 +557,8 @@ struct Ttk_TemplateNode_ { static Ttk_TemplateNode *Ttk_NewTemplateNode(const char *name, unsigned flags) { - Ttk_TemplateNode *op = ckalloc(sizeof(*op)); - op->name = ckalloc(strlen(name) + 1); strcpy(op->name, name); + Ttk_TemplateNode *op = (Ttk_TemplateNode *)ckalloc(sizeof(*op)); + op->name = (char *)ckalloc(strlen(name) + 1); strcpy(op->name, name); op->flags = flags; op->next = op->child = 0; return op; @@ -843,7 +843,7 @@ static Ttk_Layout TTKNewLayout( void *recordPtr,Tk_OptionTable optionTable, Tk_Window tkwin, Ttk_LayoutNode *root) { - Ttk_Layout layout = ckalloc(sizeof(*layout)); + Ttk_Layout layout = (Ttk_Layout)ckalloc(sizeof(*layout)); layout->style = style; layout->recordPtr = recordPtr; layout->optionTable = optionTable; diff --git a/generic/ttk/ttkManager.c b/generic/ttk/ttkManager.c index caf452c..5de14bd 100644 --- a/generic/ttk/ttkManager.c +++ b/generic/ttk/ttkManager.c @@ -115,7 +115,7 @@ static void RecomputeLayout(Ttk_Manager *mgr) */ static void ManagerIdleProc(ClientData clientData) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; mgr->flags &= ~MGR_UPDATE_PENDING; if (mgr->flags & MGR_RESIZE_REQUIRED) { @@ -141,7 +141,7 @@ static void ManagerIdleProc(ClientData clientData) static const int ManagerEventMask = StructureNotifyMask; static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int i; switch (eventPtr->type) @@ -173,7 +173,7 @@ static void ManagerEventHandler(ClientData clientData, XEvent *eventPtr) static const unsigned SlaveEventMask = StructureNotifyMask; static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) { - Ttk_Slave *slave = clientData; + Ttk_Slave *slave = (Ttk_Slave *)clientData; if (eventPtr->type == DestroyNotify) { slave->manager->managerSpec->tkGeomMgr.lostSlaveProc( slave->manager, slave->slaveWindow); @@ -187,7 +187,7 @@ static void SlaveEventHandler(ClientData clientData, XEvent *eventPtr) static Ttk_Slave *NewSlave( Ttk_Manager *mgr, Tk_Window slaveWindow, void *slaveData) { - Ttk_Slave *slave = ckalloc(sizeof(*slave)); + Ttk_Slave *slave = (Ttk_Slave *)ckalloc(sizeof(*slave)); slave->slaveWindow = slaveWindow; slave->manager = mgr; @@ -209,7 +209,7 @@ static void DeleteSlave(Ttk_Slave *slave) Ttk_Manager *Ttk_CreateManager( Ttk_ManagerSpec *managerSpec, void *managerData, Tk_Window masterWindow) { - Ttk_Manager *mgr = ckalloc(sizeof(*mgr)); + Ttk_Manager *mgr = (Ttk_Manager *)ckalloc(sizeof(*mgr)); mgr->managerSpec = managerSpec; mgr->managerData = managerData; @@ -251,7 +251,7 @@ void Ttk_DeleteManager(Ttk_Manager *mgr) static void InsertSlave(Ttk_Manager *mgr, Ttk_Slave *slave, int index) { int endIndex = mgr->nSlaves++; - mgr->slaves = ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); + mgr->slaves = (Ttk_Slave **)ckrealloc(mgr->slaves, mgr->nSlaves * sizeof(Ttk_Slave *)); while (endIndex > index) { mgr->slaves[endIndex] = mgr->slaves[endIndex - 1]; @@ -313,7 +313,7 @@ static void RemoveSlave(Ttk_Manager *mgr, int index) void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); @@ -327,7 +327,7 @@ void Ttk_GeometryRequestProc(ClientData clientData, Tk_Window slaveWindow) void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { - Ttk_Manager *mgr = clientData; + Ttk_Manager *mgr = (Ttk_Manager *)clientData; int index = Ttk_SlaveIndex(mgr, slaveWindow); /* ASSERT: index >= 0 */ diff --git a/generic/ttk/ttkNotebook.c b/generic/ttk/ttkNotebook.c index 4b0a16c..93178f4 100644 --- a/generic/ttk/ttkNotebook.c +++ b/generic/ttk/ttkNotebook.c @@ -190,7 +190,7 @@ static void NotebookStyleOptions(Notebook *nb, NotebookStyle *nbstyle) static Tab *CreateTab(Tcl_Interp *interp, Notebook *nb, Tk_Window slaveWindow) { Tk_OptionTable optionTable = nb->notebook.paneOptionTable; - void *record = ckalloc(sizeof(Tab)); + Tab *record = (Tab *)ckalloc(sizeof(Tab)); memset(record, 0, sizeof(Tab)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { @@ -258,7 +258,7 @@ static TkSizeT IdentifyTab(Notebook *nb, int x, int y) { TkSizeT index; for (index = 0; index < Ttk_NumberSlaves(nb->notebook.mgr); ++index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index); if ( tab->state != TAB_STATE_HIDDEN && Ttk_BoxContains(tab->parcel, x,y)) { @@ -290,7 +290,7 @@ static void ActivateTab(Notebook *nb, int index) static Ttk_State TabState(Notebook *nb, TkSizeT index) { Ttk_State state = nb->core.state; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); TkSizeT i = 0; if ((int)index == nb->notebook.currentIndex) { @@ -303,7 +303,7 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index) state |= TTK_STATE_ACTIVE; } for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -313,7 +313,7 @@ static Ttk_State TabState(Notebook *nb, TkSizeT index) break; } for (i = Ttk_NumberSlaves(nb->notebook.mgr) - 1; i != TCL_INDEX_NONE; --i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); if (tab->state == TAB_STATE_HIDDEN) { continue; } @@ -354,7 +354,7 @@ static void TabrowSize( TkSizeT i; for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb,i); Ttk_RebindSublayout(tabLayout, tab); @@ -384,7 +384,7 @@ static void TabrowSize( static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; NotebookStyle nbstyle; Ttk_Padding padding; Ttk_Element clientNode = Ttk_FindElement(nb->core.layout, "client"); @@ -399,7 +399,7 @@ static int NotebookSize(void *clientData, int *widthPtr, int *heightPtr) */ for (i = 0; i < Ttk_NumberSlaves(nb->notebook.mgr); ++i) { Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, i); - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); int slaveWidth = Tk_ReqWidth(slaveWindow) + Ttk_PaddingWidth(tab->padding); int slaveHeight @@ -470,7 +470,7 @@ static void SqueezeTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,i); double ad = slack + tab->width * delta; tab->width += (int)ad; slack = ad - (int)ad; @@ -489,7 +489,7 @@ static void PlaceTabs( int i; for (i = 0; i < nTabs; ++i) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, i); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, i); Ttk_State tabState = TabState(nb, i); if (tab->state != TAB_STATE_HIDDEN) { @@ -517,7 +517,7 @@ static void PlaceTabs( */ static void NotebookDoLayout(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Tk_Window nbwin = nb->core.tkwin; Ttk_Box cavity = Ttk_WinBox(nbwin); int tabrowWidth = 0, tabrowHeight = 0; @@ -573,7 +573,7 @@ static void NotebookDoLayout(void *recordPtr) */ static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex); Tk_Window slaveWindow = Ttk_SlaveWindow(nb->notebook.mgr, slaveIndex); Ttk_Box slaveBox = Ttk_StickBox(Ttk_PadBox(nb->notebook.clientArea, tab->padding), @@ -588,7 +588,7 @@ static void NotebookPlaceSlave(Notebook *nb, int slaveIndex) */ static void NotebookPlaceSlaves(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int currentIndex = nb->notebook.currentIndex; if (currentIndex >= 0) { NotebookDoLayout(nb); @@ -602,7 +602,7 @@ static void NotebookPlaceSlaves(void *recordPtr) */ static void SelectTab(Notebook *nb, int index) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr,index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr,index); int currentIndex = nb->notebook.currentIndex; if (index == currentIndex) { @@ -647,7 +647,7 @@ static int NextTab(Notebook *nb, int index) /* Scan forward for following usable tab: */ for (nextIndex = index + 1; nextIndex < nTabs; ++nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -656,7 +656,7 @@ static int NextTab(Notebook *nb, int index) /* Not found -- scan backwards. */ for (nextIndex = index - 1; nextIndex >= 0; --nextIndex) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, nextIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, nextIndex); if (tab->state == TAB_STATE_NORMAL) { return nextIndex; } @@ -697,8 +697,8 @@ static void SelectNearestTab(Notebook *nb) */ static void TabRemoved(void *managerData, TkSizeT index) { - Notebook *nb = managerData; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Notebook *nb = (Notebook *)managerData; + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); if ((int)index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -715,6 +715,11 @@ static void TabRemoved(void *managerData, TkSizeT index) static int TabRequest(void *managerData, TkSizeT index, int width, int height) { + (void)managerData; + (void)index; + (void)width; + (void)height; + return 1; } @@ -785,7 +790,7 @@ static const int NotebookEventMask ; static void NotebookEventHandler(ClientData clientData, XEvent *eventPtr) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; if (eventPtr->type == DestroyNotify) { /* Remove self */ Tk_DeleteEventHandler(nb->core.tkwin, @@ -881,7 +886,7 @@ static int GetTabIndex( static int NotebookAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index = Ttk_NumberSlaves(nb->notebook.mgr); Tk_Window slaveWindow; int slaveIndex; @@ -902,7 +907,7 @@ static int NotebookAddCommand( return AddTab(interp, nb, index, slaveWindow, objc-3,objv+3); } - tab = Ttk_SlaveData(nb->notebook.mgr, slaveIndex); + tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, slaveIndex); if (tab->state == TAB_STATE_HIDDEN) { tab->state = TAB_STATE_NORMAL; } @@ -921,7 +926,7 @@ static int NotebookAddCommand( static int NotebookInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int current = nb->notebook.currentIndex; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int srcIndex, destIndex; @@ -961,7 +966,7 @@ static int NotebookInsertCommand( /* Move existing slave: */ if (ConfigureTab(interp, nb, - Ttk_SlaveData(nb->notebook.mgr,srcIndex), + (Tab *)Ttk_SlaveData(nb->notebook.mgr,srcIndex), Ttk_SlaveWindow(nb->notebook.mgr,srcIndex), objc-4,objv+4) != TCL_OK) { @@ -995,7 +1000,7 @@ static int NotebookInsertCommand( static int NotebookForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; if (objc != 3) { @@ -1019,7 +1024,7 @@ static int NotebookForgetCommand( static int NotebookHideCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index; Tab *tab; @@ -1032,7 +1037,7 @@ static int NotebookHideCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(nb->notebook.mgr, index); + tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); tab->state = TAB_STATE_HIDDEN; if (index == nb->notebook.currentIndex) { SelectNearestTab(nb); @@ -1052,7 +1057,7 @@ static int NotebookIdentifyCommand( static const char *const whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Element element = NULL; int x, y; TkSizeT tabIndex; @@ -1072,7 +1077,7 @@ static int NotebookIdentifyCommand( tabIndex = IdentifyTab(nb, x, y); if (tabIndex != TCL_INDEX_NONE) { - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, tabIndex); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, tabIndex); Ttk_State state = TabState(nb, tabIndex); Ttk_Layout tabLayout = nb->notebook.tabLayout; @@ -1107,7 +1112,7 @@ static int NotebookIdentifyCommand( static int NotebookIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; int index, status; if (objc != 3) { @@ -1139,7 +1144,7 @@ static int NotebookIndexCommand( static int NotebookSelectCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; if (objc == 2) { if (nb->notebook.currentIndex >= 0) { @@ -1165,7 +1170,7 @@ static int NotebookSelectCommand( static int NotebookTabsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; Tcl_Obj *result; TkSizeT i; @@ -1190,7 +1195,7 @@ static int NotebookTabsCommand( static int NotebookTabCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Manager *mgr = nb->notebook.mgr; int index; Tk_Window slaveWindow; @@ -1205,7 +1210,7 @@ static int NotebookTabCommand( return TCL_ERROR; } - tab = Ttk_SlaveData(mgr, index); + tab = (Tab *)Ttk_SlaveData(mgr, index); slaveWindow = Ttk_SlaveWindow(mgr, index); if (objc == 3) { @@ -1255,7 +1260,7 @@ static const Ttk_Ensemble NotebookCommands[] = { static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; nb->notebook.mgr = Ttk_CreateManager( &NotebookManagerSpec, recordPtr, nb->core.tkwin); @@ -1275,7 +1280,7 @@ static void NotebookInitialize(Tcl_Interp *interp, void *recordPtr) static void NotebookCleanup(void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_DeleteManager(nb->notebook.mgr); if (nb->notebook.tabLayout) @@ -1284,7 +1289,7 @@ static void NotebookCleanup(void *recordPtr) static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; /* * Error-checks: @@ -1308,7 +1313,7 @@ static int NotebookConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout NotebookGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Notebook *nb = recordPtr; + Notebook *nb = (Notebook *)recordPtr; Ttk_Layout notebookLayout = TtkWidgetGetLayout(interp, theme, recordPtr); Ttk_Layout tabLayout; @@ -1336,7 +1341,7 @@ static Ttk_Layout NotebookGetLayout( static void DisplayTab(Notebook *nb, int index, Drawable d) { Ttk_Layout tabLayout = nb->notebook.tabLayout; - Tab *tab = Ttk_SlaveData(nb->notebook.mgr, index); + Tab *tab = (Tab *)Ttk_SlaveData(nb->notebook.mgr, index); Ttk_State state = TabState(nb, index); if (tab->state != TAB_STATE_HIDDEN) { @@ -1348,7 +1353,7 @@ static void DisplayTab(Notebook *nb, int index, Drawable d) static void NotebookDisplay(void *clientData, Drawable d) { - Notebook *nb = clientData; + Notebook *nb = (Notebook *)clientData; int nSlaves = Ttk_NumberSlaves(nb->notebook.mgr); int index; diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 1b12d50..105f823 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -111,7 +111,7 @@ static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) { Tk_OptionTable optionTable = pw->paned.paneOptionTable; void *record = ckalloc(sizeof(Pane)); - Pane *pane = record; + Pane *pane = (Pane *)record; memset(record, 0, sizeof(Pane)); if (Tk_InitOptions(interp, record, optionTable, slaveWindow) != TCL_OK) { @@ -188,14 +188,14 @@ error: static int ShoveUp(Paned *pw, int i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i); int sashThickness = pw->paned.sashThickness; if (i == 0) { if (pos < 0) pos = 0; } else { - Pane *prevPane = Ttk_SlaveData(pw->paned.mgr, i-1); + Pane *prevPane = (Pane *)Ttk_SlaveData(pw->paned.mgr, i-1); if (pos < prevPane->sashPos + sashThickness) pos = ShoveUp(pw, i-1, pos - sashThickness) + sashThickness; } @@ -208,13 +208,13 @@ static int ShoveUp(Paned *pw, int i, int pos) */ static int ShoveDown(Paned *pw, TkSizeT i, int pos) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr,i); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i); int sashThickness = pw->paned.sashThickness; if (i == Ttk_NumberSlaves(pw->paned.mgr) - 1) { pos = pane->sashPos; /* Sentinel value == master window size */ } else { - Pane *nextPane = Ttk_SlaveData(pw->paned.mgr,i+1); + Pane *nextPane = (Pane *)Ttk_SlaveData(pw->paned.mgr,i+1); if (pos + sashThickness > nextPane->sashPos) pos = ShoveDown(pw, i+1, pos + sashThickness) - sashThickness; } @@ -229,7 +229,7 @@ static int ShoveDown(Paned *pw, TkSizeT i, int pos) */ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int nPanes = Ttk_NumberSlaves(pw->paned.mgr); int nSashes = nPanes - 1; int sashThickness = pw->paned.sashThickness; @@ -238,7 +238,7 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) if (pw->paned.orient == TTK_ORIENT_HORIZONTAL) { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (height < Tk_ReqHeight(slaveWindow)) @@ -248,7 +248,7 @@ static int PanedSize(void *recordPtr, int *widthPtr, int *heightPtr) width += nSashes * sashThickness; } else { for (index = 0; index < nPanes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); if (width < Tk_ReqWidth(slaveWindow)) @@ -278,7 +278,7 @@ static void AdjustPanes(Paned *pw) TkSizeT index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; pane->reqSize = size >= 0 ? size : 0; pos = pane->sashPos + sashThickness; @@ -316,7 +316,7 @@ static void PlaceSashes(Paned *pw, int width, int height) /* Compute total required size and total available weight: */ for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); reqSize += pane->reqSize; totalWeight += pane->weight * (pane->reqSize != 0); } @@ -340,7 +340,7 @@ static void PlaceSashes(Paned *pw, int width, int height) */ pos = 0; for (i = 0; i < nPanes; ++i) { - Pane *pane = Ttk_SlaveData(mgr, i); + Pane *pane = (Pane *)Ttk_SlaveData(mgr, i); int weight = pane->weight * (pane->reqSize != 0); int size = pane->reqSize + delta * weight; @@ -375,7 +375,7 @@ static void PlacePanes(Paned *pw) TkSizeT index; for (index = 0; index < Ttk_NumberSlaves(pw->paned.mgr); ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int size = pane->sashPos - pos; if (size > 0) { @@ -398,15 +398,15 @@ static void PlacePanes(Paned *pw) static void PanedPlaceSlaves(void *managerData) { - Paned *pw = managerData; + Paned *pw = (Paned *)managerData; PlaceSashes(pw, Tk_Width(pw->core.tkwin), Tk_Height(pw->core.tkwin)); PlacePanes(pw); } static void PaneRemoved(void *managerData, TkSizeT index) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); DestroyPane(pw, pane); } @@ -447,8 +447,8 @@ static int AddPane( */ static int PaneRequest(void *managerData, TkSizeT index, int width, int height) { - Paned *pw = managerData; - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Paned *pw = (Paned *)managerData; + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); Tk_Window slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, index); int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL; @@ -482,7 +482,7 @@ static Ttk_ManagerSpec PanedManagerSpec = { static const unsigned PanedEventMask = LeaveWindowMask; static void PanedEventProc(ClientData clientData, XEvent *eventPtr) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; if ( eventPtr->type == LeaveNotify && eventPtr->xcrossing.detail == NotifyInferior) { @@ -496,7 +496,7 @@ static void PanedEventProc(ClientData clientData, XEvent *eventPtr) static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_CreateEventHandler(pw->core.tkwin, PanedEventMask, PanedEventProc, recordPtr); @@ -508,7 +508,7 @@ static void PanedInitialize(Tcl_Interp *interp, void *recordPtr) static void PanedCleanup(void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; if (pw->paned.sashLayout) Ttk_FreeLayout(pw->paned.sashLayout); @@ -519,9 +519,10 @@ static void PanedCleanup(void *recordPtr) /* Post-configuration hook. */ -static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) +static int PanedPostConfigure(Tcl_Interp *dummy, void *clientData, int mask) { - Paned *pw = clientData; + Paned *pw = (Paned *)clientData; + (void)dummy; if (mask & GEOMETRY_CHANGED) { /* User has changed -width or -height. @@ -542,7 +543,7 @@ static int PanedPostConfigure(Tcl_Interp *interp, void *clientData, int mask) static Ttk_Layout PanedGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); if (panedLayout) { @@ -580,7 +581,7 @@ static Ttk_Layout PanedGetLayout( */ static Ttk_Layout SashLayout(Paned *pw, int index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); int thickness = pw->paned.sashThickness, height = Tk_Height(pw->core.tkwin), width = Tk_Width(pw->core.tkwin), @@ -602,7 +603,7 @@ static void DrawSash(Paned *pw, int index, Drawable d) static void PanedDisplay(void *recordPtr, Drawable d) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; TkSizeT i, nSlaves = Ttk_NumberSlaves(pw->paned.mgr); TtkWidgetDisplay(recordPtr, d); @@ -620,7 +621,7 @@ static void PanedDisplay(void *recordPtr, Drawable d) static int PanedAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Tk_Window slaveWindow; if (objc < 3) { @@ -645,7 +646,7 @@ static int PanedAddCommand( static int PanedInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int nSlaves = Ttk_NumberSlaves(pw->paned.mgr); int srcIndex, destIndex; Tk_Window slaveWindow; @@ -680,7 +681,7 @@ static int PanedInsertCommand( return objc == 4 ? TCL_OK : ConfigurePane(interp, pw, - Ttk_SlaveData(pw->paned.mgr, destIndex), + (Pane *)Ttk_SlaveData(pw->paned.mgr, destIndex), Ttk_SlaveWindow(pw->paned.mgr, destIndex), objc-4,objv+4); } @@ -690,7 +691,7 @@ static int PanedInsertCommand( static int PanedForgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; if (objc != 3) { @@ -717,7 +718,7 @@ static int PanedIdentifyCommand( static const char *const whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; int x, y, pos; @@ -738,7 +739,7 @@ static int PanedIdentifyCommand( pos = pw->paned.orient == TTK_ORIENT_HORIZONTAL ? x : y; for (index = 0; index < nSashes; ++index) { - Pane *pane = Ttk_SlaveData(pw->paned.mgr, index); + Pane *pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, index); if (pane->sashPos <= pos && pos <= pane->sashPos + sashThickness) { /* Found it. */ switch (what) { @@ -768,7 +769,7 @@ static int PanedIdentifyCommand( static int PanedPaneCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int paneIndex; Tk_Window slaveWindow; Pane *pane; @@ -784,7 +785,7 @@ static int PanedPaneCommand( return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, paneIndex); + pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, paneIndex); slaveWindow = Ttk_SlaveWindow(pw->paned.mgr, paneIndex); switch (objc) { @@ -805,7 +806,7 @@ static int PanedPaneCommand( static int PanedPanesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; Ttk_Manager *mgr = pw->paned.mgr; Tcl_Obj *panes; TkSizeT i; @@ -832,7 +833,7 @@ static int PanedPanesCommand( static int PanedSashposCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Paned *pw = recordPtr; + Paned *pw = (Paned *)recordPtr; int sashIndex, position = -1; Pane *pane; @@ -850,7 +851,7 @@ static int PanedSashposCommand( return TCL_ERROR; } - pane = Ttk_SlaveData(pw->paned.mgr, sashIndex); + pane = (Pane *)Ttk_SlaveData(pw->paned.mgr, sashIndex); if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pane->sashPos)); @@ -923,15 +924,19 @@ typedef struct { static const Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, offsetof(SashElement,thicknessObj), "5" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SashElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SashElement *sash = elementRecord; + SashElement *sash = (SashElement *)elementRecord; int thickness = DEFAULT_SASH_THICKNESS; + (void)dummy; + (void)tkwin; + (void)paddingPtr; + Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } diff --git a/generic/ttk/ttkProgress.c b/generic/ttk/ttkProgress.c index eade8b8..60b69ad 100644 --- a/generic/ttk/ttkProgress.c +++ b/generic/ttk/ttkProgress.c @@ -122,7 +122,7 @@ static int AnimationEnabled(Progressbar *pb) */ static void AnimateProgressProc(ClientData clientData) { - Progressbar *pb = clientData; + Progressbar *pb = (Progressbar *)clientData; pb->progress.timer = 0; @@ -175,7 +175,7 @@ static void CheckAnimation(Progressbar *pb) static void VariableChanged(void *recordPtr, const char *value) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Tcl_Obj *newValue; double scratch; @@ -208,16 +208,18 @@ static void VariableChanged(void *recordPtr, const char *value) * +++ Widget class methods: */ -static void ProgressbarInitialize(Tcl_Interp *interp, void *recordPtr) +static void ProgressbarInitialize(Tcl_Interp *dummy, void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; + (void)dummy; + pb->progress.variableTrace = 0; pb->progress.timer = 0; } static void ProgressbarCleanup(void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; if (pb->progress.variableTrace) Ttk_UntraceVariable(pb->progress.variableTrace); if (pb->progress.timer) @@ -231,7 +233,7 @@ static void ProgressbarCleanup(void *recordPtr) */ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Tcl_Obj *varName = pb->progress.variableObj; Ttk_TraceHandle *vt = 0; @@ -257,10 +259,12 @@ static int ProgressbarConfigure(Tcl_Interp *interp, void *recordPtr, int mask) * Post-configuration hook: */ static int ProgressbarPostConfigure( - Tcl_Interp *interp, void *recordPtr, int mask) + Tcl_Interp *dummy, void *recordPtr, int mask) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (pb->progress.variableTrace) { status = Ttk_FireTrace(pb->progress.variableTrace); @@ -288,16 +292,16 @@ static int ProgressbarPostConfigure( */ static int ProgressbarSize(void *recordPtr, int *widthPtr, int *heightPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; int length = 100; - int orient = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; TtkWidgetSize(recordPtr, widthPtr, heightPtr); /* Override requested width (height) based on -length and -orient */ Tk_GetPixelsFromObj(NULL, pb->core.tkwin, pb->progress.lengthObj, &length); - Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); + TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = length; @@ -357,11 +361,11 @@ static void ProgressbarIndeterminateLayout( static void ProgressbarDoLayout(void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; WidgetCore *corePtr = &pb->core; Ttk_Element pbar = Ttk_FindElement(corePtr->layout, "pbar"); double value = 0.0, maximum = 100.0; - int orient = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); @@ -370,7 +374,7 @@ static void ProgressbarDoLayout(void *recordPtr) Tcl_GetDoubleFromObj(NULL, pb->progress.valueObj, &value); Tcl_GetDoubleFromObj(NULL, pb->progress.maximumObj, &maximum); - Ttk_GetOrientFromObj(NULL, pb->progress.orientObj, &orient); + TtkGetOrientFromObj(NULL, pb->progress.orientObj, &orient); if (pbar) { double fraction = value / maximum; @@ -389,7 +393,7 @@ static void ProgressbarDoLayout(void *recordPtr) static Ttk_Layout ProgressbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; Ttk_Layout layout = TtkWidgetGetOrientedLayout( interp, theme, recordPtr, pb->progress.orientObj); @@ -419,7 +423,7 @@ static Ttk_Layout ProgressbarGetLayout( static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Progressbar *pb = recordPtr; + Progressbar *pb = (Progressbar *)recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; @@ -495,6 +499,8 @@ static int ProgressbarStartStopCommand( static int ProgressbarStartCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)recordPtr; + return ProgressbarStartStopCommand( interp, "::ttk::progressbar::start", objc, objv); } @@ -502,6 +508,8 @@ static int ProgressbarStartCommand( static int ProgressbarStopCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)recordPtr; + return ProgressbarStartStopCommand( interp, "::ttk::progressbar::stop", objc, objv); } diff --git a/generic/ttk/ttkScale.c b/generic/ttk/ttkScale.c index cd09a42..0b0f121 100644 --- a/generic/ttk/ttkScale.c +++ b/generic/ttk/ttkScale.c @@ -92,7 +92,7 @@ static double PointToValue(Scale *scalePtr, int x, int y); */ static void ScaleVariableChanged(void *recordPtr, const char *value) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; double v; if (value == NULL || Tcl_GetDouble(0, value, &v) != TCL_OK) { @@ -110,15 +110,17 @@ static void ScaleVariableChanged(void *recordPtr, const char *value) /* ScaleInitialize -- * Scale widget initialization hook. */ -static void ScaleInitialize(Tcl_Interp *interp, void *recordPtr) +static void ScaleInitialize(Tcl_Interp *dummy, void *recordPtr) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; + (void)dummy; + TtkTrackElementState(&scalePtr->core); } static void ScaleCleanup(void *recordPtr) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; if (scale->scale.variableTrace) { Ttk_UntraceVariable(scale->scale.variableTrace); @@ -131,7 +133,7 @@ static void ScaleCleanup(void *recordPtr) */ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; Tcl_Obj *varName = scale->scale.variableObj; Ttk_TraceHandle *vt = 0; @@ -161,10 +163,12 @@ static int ScaleConfigure(Tcl_Interp *interp, void *recordPtr, int mask) * Post-configuration hook. */ static int ScalePostConfigure( - Tcl_Interp *interp, void *recordPtr, int mask) + Tcl_Interp *dummy, void *recordPtr, int mask) { - Scale *scale = recordPtr; + Scale *scale = (Scale *)recordPtr; int status = TCL_OK; + (void)dummy; + (void)mask; if (scale->scale.variableTrace) { status = Ttk_FireTrace(scale->scale.variableTrace); @@ -190,7 +194,7 @@ static int ScalePostConfigure( static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } @@ -258,7 +262,7 @@ static int ScaleGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; int x, y, r = TCL_OK; double value = 0; @@ -286,7 +290,7 @@ static int ScaleSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; double from = 0.0, to = 1.0, value; int result = TCL_OK; @@ -354,7 +358,7 @@ static int ScaleCoordsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scale *scalePtr = recordPtr; + Scale *scalePtr = (Scale *)recordPtr; double value; int r = TCL_OK; @@ -381,7 +385,7 @@ ScaleCoordsCommand( static void ScaleDoLayout(void *clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; Ttk_Element slider = Ttk_FindElement(corePtr->layout, "slider"); Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); @@ -389,7 +393,7 @@ static void ScaleDoLayout(void *clientData) /* Adjust the slider position: */ if (slider) { - Scale *scalePtr = clientData; + Scale *scalePtr = (Scale *)clientData; Ttk_Box troughBox = TroughBox(scalePtr); Ttk_Box sliderBox = Ttk_ElementParcel(slider); double value = 0.0; @@ -416,8 +420,8 @@ static void ScaleDoLayout(void *clientData) */ static int ScaleSize(void *clientData, int *widthPtr, int *heightPtr) { - WidgetCore *corePtr = clientData; - Scale *scalePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; + Scale *scalePtr = (Scale *)clientData; int length; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 47db6ac..a351d91 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -55,7 +55,7 @@ struct ScrollHandleRec */ ScrollHandle TtkCreateScrollHandle(WidgetCore *corePtr, Scrollable *scrollPtr) { - ScrollHandle h = ckalloc(sizeof(*h)); + ScrollHandle h = (ScrollHandle)ckalloc(sizeof(*h)); h->flags = 0; h->corePtr = corePtr; diff --git a/generic/ttk/ttkScrollbar.c b/generic/ttk/ttkScrollbar.c index b309eca..55a2bd2 100644 --- a/generic/ttk/ttkScrollbar.c +++ b/generic/ttk/ttkScrollbar.c @@ -50,9 +50,11 @@ static const Tk_OptionSpec ScrollbarOptionSpecs[] = */ static void -ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) +ScrollbarInitialize(Tcl_Interp *dummy, void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; + (void)dummy; + sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; @@ -62,7 +64,7 @@ ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) static Ttk_Layout ScrollbarGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sb->scrollbar.orientObj); } @@ -76,7 +78,7 @@ static Ttk_Layout ScrollbarGetLayout( */ static void ScrollbarDoLayout(void *recordPtr) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; WidgetCore *corePtr = &sb->core; Ttk_Element thumb; Ttk_Box thumbBox; @@ -132,7 +134,7 @@ static int ScrollbarSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *scrollbar = recordPtr; + Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *firstObj, *lastObj; double first, last; @@ -183,7 +185,7 @@ static int ScrollbarGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *scrollbar = recordPtr; + Scrollbar *scrollbar = (Scrollbar *)recordPtr; Tcl_Obj *result[2]; if (objc != 2) { @@ -206,7 +208,7 @@ static int ScrollbarDeltaCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; double dx, dy; double delta = 0.0; @@ -246,7 +248,7 @@ static int ScrollbarFractionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Scrollbar *sb = recordPtr; + Scrollbar *sb = (Scrollbar *)recordPtr; Ttk_Box b = sb->scrollbar.troughBox; int minSize = sb->scrollbar.minSize; double x, y; diff --git a/generic/ttk/ttkSeparator.c b/generic/ttk/ttkSeparator.c index 6623fa5..00605dc 100644 --- a/generic/ttk/ttkSeparator.c +++ b/generic/ttk/ttkSeparator.c @@ -39,7 +39,7 @@ static const Tk_OptionSpec SeparatorOptionSpecs[] = { static Ttk_Layout SeparatorGetLayout( Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { - Separator *sep = recordPtr; + Separator *sep = (Separator *)recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, sep->separator.orientObj); } diff --git a/generic/ttk/ttkSquare.c b/generic/ttk/ttkSquare.c index 3f5c0d1..a65591c 100644 --- a/generic/ttk/ttkSquare.c +++ b/generic/ttk/ttkSquare.c @@ -109,7 +109,7 @@ SquareDoLayout(void *clientData) */ if (squareNode) { - Square *squarePtr = clientData; + Square *squarePtr = (Square *)clientData; Tk_Anchor anchor = TK_ANCHOR_CENTER; Ttk_Box b; @@ -188,7 +188,7 @@ static const Ttk_ElementOptionSpec SquareElementOptions[] = "raised" }, { "-width", TK_OPTION_PIXELS, offsetof(SquareElement,widthObj), "20"}, { "-height", TK_OPTION_PIXELS, offsetof(SquareElement,heightObj), "20"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; /* @@ -198,11 +198,12 @@ static const Ttk_ElementOptionSpec SquareElementOptions[] = */ static void SquareElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SquareElement *square = elementRecord; + SquareElement *square = (SquareElement *)elementRecord; int borderWidth = 0; + (void)dummy; Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); *paddingPtr = Ttk_UniformPadding((short)borderWidth); @@ -215,12 +216,14 @@ static void SquareElementSize( */ static void SquareElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - SquareElement *square = elementRecord; + SquareElement *square = (SquareElement *)elementRecord; Tk_3DBorder foreground = NULL; int borderWidth = 1, relief = TK_RELIEF_FLAT; + (void)dummy; + (void)state; foreground = Tk_Get3DBorderFromObj(tkwin, square->foregroundObj); Tcl_GetIntFromObj(NULL, square->borderWidthObj, &borderWidth); diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 115aaf8..a704fa4 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -145,14 +145,14 @@ static void StateSpecUpdateString(Tcl_Obj *objPtr) len = Tcl_DStringLength(&result); if (len) { /* 'len' includes extra trailing ' ' */ - objPtr->bytes = ckalloc(len); + objPtr->bytes = (char *)ckalloc(len); objPtr->length = len-1; strncpy(objPtr->bytes, Tcl_DStringValue(&result), len-1); objPtr->bytes[len-1] = '\0'; } else { /* empty string */ objPtr->length = 0; - objPtr->bytes = ckalloc(1); + objPtr->bytes = (char *)ckalloc(1); *objPtr->bytes = '\0'; } diff --git a/generic/ttk/ttkStubInit.c b/generic/ttk/ttkStubInit.c index 87b33dc..31cdaa8 100644 --- a/generic/ttk/ttkStubInit.c +++ b/generic/ttk/ttkStubInit.c @@ -8,6 +8,18 @@ MODULE_SCOPE const TtkStubs ttkStubs; +#if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 +#define Ttk_GetOrientFromObj 0 +#endif + +#ifdef __GNUC__ +/* + * The rest of this file shouldn't warn about deprecated functions; they're + * there because we intend them to be so and know that this file is OK to + * touch those fields. + */ +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif /* !BEGIN!: Do not edit below this line. */ const TtkStubs ttkStubs = { diff --git a/generic/ttk/ttkStubLib.c b/generic/ttk/ttkStubLib.c index c17f1e9..5675416 100644 --- a/generic/ttk/ttkStubLib.c +++ b/generic/ttk/ttkStubLib.c @@ -36,10 +36,10 @@ TtkInitializeStubs( int exact = 0; const char *packageName = "Ttk"; const char *errMsg = NULL; - ClientData pkgClientData = NULL; + void *pkgClientData = NULL; const char *actualVersion = Tcl_PkgRequireEx( interp, packageName, version, exact, &pkgClientData); - const TtkStubs *stubsPtr = pkgClientData; + const TtkStubs *stubsPtr = (const TtkStubs *)pkgClientData; if (!actualVersion) { return NULL; diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index fac2cc2..e923d77 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -31,7 +31,7 @@ struct TtkTagTable { */ static Ttk_Tag NewTag(Ttk_TagTable tagTable, const char *tagName) { - Ttk_Tag tag = ckalloc(sizeof(*tag)); + Ttk_Tag tag = (Ttk_Tag)ckalloc(sizeof(*tag)); tag->tagRecord = ckalloc(tagTable->recordSize); memset(tag->tagRecord, 0, tagTable->recordSize); /* Don't need Tk_InitOptions() here, all defaults should be NULL. */ @@ -55,7 +55,7 @@ Ttk_TagTable Ttk_CreateTagTable( Tcl_Interp *interp, Tk_Window tkwin, const Tk_OptionSpec *optionSpecs, int recordSize) { - Ttk_TagTable tagTable = ckalloc(sizeof(*tagTable)); + Ttk_TagTable tagTable = (Ttk_TagTable)ckalloc(sizeof(*tagTable)); tagTable->tkwin = tkwin; tagTable->optionSpecs = optionSpecs; tagTable->optionTable = Tk_CreateOptionTable(interp, optionSpecs); @@ -72,7 +72,7 @@ void Ttk_DeleteTagTable(Ttk_TagTable tagTable) entryPtr = Tcl_FirstHashEntry(&tagTable->tags, &search); while (entryPtr != NULL) { - DeleteTag(tagTable, Tcl_GetHashValue(entryPtr)); + DeleteTag(tagTable, (Ttk_Tag)Tcl_GetHashValue(entryPtr)); entryPtr = Tcl_NextHashEntry(&search); } @@ -87,10 +87,10 @@ Ttk_Tag Ttk_GetTag(Ttk_TagTable tagTable, const char *tagName) &tagTable->tags, tagName, &isNew); if (isNew) { - tagName = Tcl_GetHashKey(&tagTable->tags, entryPtr); + tagName = (char *)Tcl_GetHashKey(&tagTable->tags, entryPtr); Tcl_SetHashValue(entryPtr, NewTag(tagTable,tagName)); } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Tag)Tcl_GetHashValue(entryPtr); } Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) @@ -113,7 +113,7 @@ Ttk_Tag Ttk_GetTagFromObj(Ttk_TagTable tagTable, Tcl_Obj *objPtr) Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable tagTable, Tcl_Obj *objPtr) { - Ttk_TagSet tagset = ckalloc(sizeof(*tagset)); + Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset)); Tcl_Obj **objv; int i, objc; @@ -128,7 +128,7 @@ Ttk_TagSet Ttk_GetTagSetFromObj( return NULL; } - tagset->tags = ckalloc((objc+1) * sizeof(Ttk_Tag)); + tagset->tags = (Ttk_Tag *)ckalloc((objc+1) * sizeof(Ttk_Tag)); for (i=0; i<objc; ++i) { tagset->tags[i] = Ttk_GetTagFromObj(tagTable, objv[i]); } @@ -185,7 +185,7 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) return 0; } } - tagset->tags = ckrealloc(tagset->tags, + tagset->tags = (Ttk_Tag *)ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index b492351..e5e756d 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -35,9 +35,9 @@ typedef struct Ttk_Style_ Ttk_ResourceCache cache; /* Back-pointer to resource cache */ } Style; -static Style *NewStyle() +static Style *NewStyle(void) { - Style *stylePtr = ckalloc(sizeof(Style)); + Style *stylePtr = (Style *)ckalloc(sizeof(Style)); stylePtr->styleName = NULL; stylePtr->parentStyle = NULL; @@ -56,7 +56,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->settingsTable, &search); while (entryPtr != NULL) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(stateMap); entryPtr = Tcl_NextHashEntry(&search); } @@ -64,7 +64,7 @@ static void FreeStyle(Style *stylePtr) entryPtr = Tcl_FirstHashEntry(&stylePtr->defaultsTable, &search); while (entryPtr != NULL) { - Tcl_Obj *defaultValue = Tcl_GetHashValue(entryPtr); + Tcl_Obj *defaultValue = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_DecrRefCount(defaultValue); entryPtr = Tcl_NextHashEntry(&search); } @@ -85,7 +85,7 @@ Tcl_Obj *Ttk_StyleMap(Ttk_Style style, const char *optionName, Ttk_State state) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->settingsTable, optionName); if (entryPtr) { - Ttk_StateMap stateMap = Tcl_GetHashValue(entryPtr); + Ttk_StateMap stateMap = (Ttk_StateMap)Tcl_GetHashValue(entryPtr); return Ttk_StateMapLookup(NULL, stateMap, state); } style = style->parentStyle; @@ -103,7 +103,7 @@ Tcl_Obj *Ttk_StyleDefault(Ttk_Style style, const char *optionName) Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(&style->defaultsTable, optionName); if (entryPtr) - return Tcl_GetHashValue(entryPtr); + return (Tcl_Obj *)Tcl_GetHashValue(entryPtr); style= style->parentStyle; } return 0; @@ -176,7 +176,7 @@ static const Tk_OptionSpec *TTKGetOptionSpec( static OptionMap BuildOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) { - OptionMap optionMap = ckalloc( + OptionMap optionMap = (OptionMap)ckalloc( sizeof(const Tk_OptionSpec) * elementClass->nResources + 1); int i; @@ -204,7 +204,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) optionMap = BuildOptionMap(elementClass, optionTable); Tcl_SetHashValue(entryPtr, optionMap); } else { - optionMap = Tcl_GetHashValue(entryPtr); + optionMap = (OptionMap)Tcl_GetHashValue(entryPtr); } return optionMap; @@ -218,7 +218,7 @@ GetOptionMap(Ttk_ElementClass *elementClass, Tk_OptionTable optionTable) static Ttk_ElementClass * NewElementClass(const char *name, const Ttk_ElementSpec *specPtr, void *clientData) { - Ttk_ElementClass *elementClass = ckalloc(sizeof(Ttk_ElementClass)); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)ckalloc(sizeof(Ttk_ElementClass)); int i; elementClass->name = name; @@ -234,7 +234,7 @@ NewElementClass(const char *name, const Ttk_ElementSpec *specPtr, void *clientDa /* Initialize default values: */ - elementClass->defaultValues = + elementClass->defaultValues = (Tcl_Obj **) ckalloc(elementClass->nResources * sizeof(Tcl_Obj *) + 1); for (i=0; i < elementClass->nResources; ++i) { const char *defaultValue = specPtr->options[i].defaultValue; @@ -291,8 +291,14 @@ static void FreeElementClass(Ttk_ElementClass *elementClass) * +++ Themes. */ -static int ThemeEnabled(Ttk_Theme theme, void *clientData) { return 1; } +static int ThemeEnabled(Ttk_Theme theme, void *dummy) +{ + (void)theme; + (void)dummy; + /* Default ThemeEnabledProc -- always return true */ + return 1; +} typedef struct Ttk_Theme_ { @@ -307,7 +313,7 @@ typedef struct Ttk_Theme_ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) { - Theme *themePtr = ckalloc(sizeof(Theme)); + Theme *themePtr = (Theme *)ckalloc(sizeof(Theme)); Tcl_HashEntry *entryPtr; int unused; @@ -324,7 +330,7 @@ static Theme *NewTheme(Ttk_ResourceCache cache, Ttk_Theme parent) entryPtr = Tcl_CreateHashEntry(&themePtr->styleTable, ".", &unused); themePtr->rootStyle = NewStyle(); themePtr->rootStyle->styleName = - Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); themePtr->rootStyle->cache = themePtr->cache; Tcl_SetHashValue(entryPtr, themePtr->rootStyle); @@ -341,7 +347,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->elementTable, &search); while (entryPtr != NULL) { - Ttk_ElementClass *elementClass = Tcl_GetHashValue(entryPtr); + Ttk_ElementClass *elementClass = (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); FreeElementClass(elementClass); entryPtr = Tcl_NextHashEntry(&search); } @@ -352,7 +358,7 @@ static void FreeTheme(Theme *themePtr) */ entryPtr = Tcl_FirstHashEntry(&themePtr->styleTable, &search); while (entryPtr != NULL) { - Style *stylePtr = Tcl_GetHashValue(entryPtr); + Style *stylePtr = (Style *)Tcl_GetHashValue(entryPtr); FreeStyle(stylePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -403,12 +409,13 @@ static void ThemeChangedProc(ClientData); /* Forward */ /* Ttk_StylePkgFree -- * Cleanup procedure for StylePackageData. */ -static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) +static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *dummy) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr; Cleanup *cleanup; + (void)dummy; /* * Cancel any pending ThemeChanged calls: @@ -422,7 +429,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) */ entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *themePtr = Tcl_GetHashValue(entryPtr); + Theme *themePtr = (Theme *)Tcl_GetHashValue(entryPtr); FreeTheme(themePtr); entryPtr = Tcl_NextHashEntry(&search); } @@ -464,7 +471,7 @@ static void Ttk_StylePkgFree(ClientData clientData, Tcl_Interp *interp) static StylePackageData *GetStylePackageData(Tcl_Interp *interp) { - return Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); + return (StylePackageData *)Tcl_GetAssocData(interp, PKG_ASSOC_KEY, NULL); } /* @@ -479,8 +486,8 @@ static StylePackageData *GetStylePackageData(Tcl_Interp *interp) void Ttk_RegisterCleanup( Tcl_Interp *interp, ClientData clientData, Ttk_CleanupProc *cleanupProc) { - StylePackageData *pkgPtr = GetStylePackageData(interp); - Cleanup *cleanup = ckalloc(sizeof(*cleanup)); + StylePackageData *pkgPtr = (StylePackageData *)GetStylePackageData(interp); + Cleanup *cleanup = (Cleanup *)ckalloc(sizeof(*cleanup)); cleanup->clientData = clientData; cleanup->cleanupProc = cleanupProc; @@ -503,7 +510,7 @@ void Ttk_RegisterCleanup( static void ThemeChangedProc(ClientData clientData) { static char ThemeChangedScript[] = "ttk::ThemeChanged"; - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; int code = Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { @@ -599,7 +606,7 @@ static Ttk_Theme LookupTheme( return NULL; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Theme)Tcl_GetHashValue(entryPtr); } /* @@ -707,12 +714,12 @@ Ttk_Style Ttk_GetStyle(Ttk_Theme themePtr, const char *styleName) stylePtr->parentStyle = themePtr->rootStyle; } - stylePtr->styleName = Tcl_GetHashKey(&themePtr->styleTable, entryPtr); + stylePtr->styleName = (const char *)Tcl_GetHashKey(&themePtr->styleTable, entryPtr); stylePtr->cache = stylePtr->parentStyle->cache; Tcl_SetHashValue(entryPtr, stylePtr); return stylePtr; } - return Tcl_GetHashValue(entryPtr); + return (Ttk_Style)Tcl_GetHashValue(entryPtr); } /* FindLayoutTemplate -- @@ -758,7 +765,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, elementName); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -769,7 +776,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, dot); } if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } /* @@ -785,7 +792,7 @@ Ttk_ElementClass *Ttk_GetElement(Ttk_Theme themePtr, const char *elementName) */ entryPtr = Tcl_FindHashEntry(&themePtr->elementTable, ""); /* ASSERT: entryPtr != 0 */ - return Tcl_GetHashValue(entryPtr); + return (Ttk_ElementClass *)Tcl_GetHashValue(entryPtr); } const char *Ttk_ElementClassName(Ttk_ElementClass *elementClass) @@ -802,7 +809,7 @@ int Ttk_RegisterElementFactory( Ttk_ElementFactory factory, void *clientData) { StylePackageData *pkgPtr = GetStylePackageData(interp); - FactoryRec *recPtr = ckalloc(sizeof(*recPtr)); + FactoryRec *recPtr = (FactoryRec *)ckalloc(sizeof(*recPtr)); Tcl_HashEntry *entryPtr; int newEntry; @@ -823,12 +830,13 @@ int Ttk_RegisterElementFactory( * (style element create $name) "from" $theme ?$element? */ static int Ttk_CloneElement( - Tcl_Interp *interp, void *clientData, + Tcl_Interp *interp, void *dummy, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; Ttk_ElementClass *fromElement; + (void)dummy; if (objc <= 0 || objc > 2) { Tcl_WrongNumArgs(interp, 0, objv, "theme ?element?"); @@ -898,7 +906,7 @@ Ttk_ElementClass *Ttk_RegisterElement( return 0; } - name = Tcl_GetHashKey(&theme->elementTable, entryPtr); + name = (char *)Tcl_GetHashKey(&theme->elementTable, entryPtr); elementClass = NewElementClass(name, specPtr, clientData); Tcl_SetHashValue(entryPtr, elementClass); @@ -1137,7 +1145,7 @@ int TtkEnumerateHashTable(Tcl_Interp *interp, Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); Tcl_ListObjAppendElement(interp, result, nameObj); entryPtr = Tcl_NextHashEntry(&search); } @@ -1157,8 +1165,8 @@ static Tcl_Obj* HashTableToDict(Tcl_HashTable *ht) Tcl_HashEntry *entryPtr = Tcl_FirstHashEntry(ht, &search); while (entryPtr != NULL) { - Tcl_Obj *nameObj = Tcl_NewStringObj(Tcl_GetHashKey(ht, entryPtr),-1); - Tcl_Obj *valueObj = Tcl_GetHashValue(entryPtr); + Tcl_Obj *nameObj = Tcl_NewStringObj((const char *)Tcl_GetHashKey(ht, entryPtr),-1); + Tcl_Obj *valueObj = (Tcl_Obj *)Tcl_GetHashValue(entryPtr); Tcl_ListObjAppendElement(NULL, result, nameObj); Tcl_ListObjAppendElement(NULL, result, valueObj); entryPtr = Tcl_NextHashEntry(&search); @@ -1179,7 +1187,7 @@ StyleMapCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1243,7 +1251,7 @@ usage: static int StyleConfigureCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *styleName; Style *stylePtr; @@ -1298,7 +1306,7 @@ usage: static int StyleLookupCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; Ttk_Style style = NULL; const char *optionName; @@ -1340,7 +1348,7 @@ static int StyleLookupCmd( static int StyleThemeCurrentCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Tcl_HashSearch search; Tcl_HashEntry *entryPtr = NULL; const char *name = NULL; @@ -1352,9 +1360,9 @@ static int StyleThemeCurrentCmd( entryPtr = Tcl_FirstHashEntry(&pkgPtr->themeTable, &search); while (entryPtr != NULL) { - Theme *ptr = Tcl_GetHashValue(entryPtr); + Theme *ptr = (Theme *)Tcl_GetHashValue(entryPtr); if (ptr == pkgPtr->currentTheme) { - name = Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); + name = (char *)Tcl_GetHashKey(&pkgPtr->themeTable, entryPtr); break; } entryPtr = Tcl_NextHashEntry(&search); @@ -1376,7 +1384,7 @@ static int StyleThemeCurrentCmd( static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; static const char *const optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; @@ -1440,7 +1448,10 @@ static int StyleThemeCreateCmd( static int StyleThemeNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; + (void)objc; + (void)objv; + return TtkEnumerateHashTable(interp, &pkgPtr->themeTable); } @@ -1456,7 +1467,7 @@ StyleThemeSettingsCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme oldTheme = pkgPtr->currentTheme; Ttk_Theme newTheme; int status; @@ -1482,7 +1493,7 @@ StyleThemeSettingsCmd( static int StyleElementCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName, *factoryName; Tcl_HashEntry *entryPtr; @@ -1505,7 +1516,7 @@ static int StyleElementCreateCmd( return TCL_ERROR; } - recPtr = Tcl_GetHashValue(entryPtr); + recPtr = (FactoryRec *)Tcl_GetHashValue(entryPtr); return recPtr->factory(interp, recPtr->clientData, theme, elementName, objc - 5, objv + 5); @@ -1517,7 +1528,7 @@ static int StyleElementCreateCmd( static int StyleElementNamesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; if (objc != 3) { @@ -1533,7 +1544,7 @@ static int StyleElementNamesCmd( static int StyleElementOptionsCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *elementName; Ttk_ElementClass *elementClass; @@ -1571,7 +1582,7 @@ static int StyleElementOptionsCmd( static int StyleLayoutCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme = pkgPtr->currentTheme; const char *layoutName; Ttk_LayoutTemplate layoutTemplate; @@ -1614,7 +1625,7 @@ StyleThemeUseCmd( int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ { - StylePackageData *pkgPtr = clientData; + StylePackageData *pkgPtr = (StylePackageData *)clientData; Ttk_Theme theme; if (objc < 3 || objc > 4) { @@ -1709,7 +1720,7 @@ void Ttk_StylePkgInit(Tcl_Interp *interp) { Tcl_Namespace *nsPtr; - StylePackageData *pkgPtr = ckalloc(sizeof(StylePackageData)); + StylePackageData *pkgPtr = (StylePackageData *)ckalloc(sizeof(StylePackageData)); pkgPtr->interp = interp; Tcl_InitHashTable(&pkgPtr->themeTable, TCL_STRING_KEYS); diff --git a/generic/ttk/ttkTrace.c b/generic/ttk/ttkTrace.c index f7cdf43..7e02b58 100644 --- a/generic/ttk/ttkTrace.c +++ b/generic/ttk/ttkTrace.c @@ -30,9 +30,11 @@ VarTraceProc( const char *name2, /* (unused) */ int flags) /* Information about what happened. */ { - Ttk_TraceHandle *tracePtr = clientData; + Ttk_TraceHandle *tracePtr = (Ttk_TraceHandle *)clientData; const char *name, *value; Tcl_Obj *valuePtr; + (void)name1; + (void)name2; if (Tcl_InterpDeleted(interp)) { return NULL; @@ -85,7 +87,7 @@ Ttk_TraceHandle *Ttk_TraceVariable( Ttk_TraceProc callback, void *clientData) { - Ttk_TraceHandle *h = ckalloc(sizeof(*h)); + Ttk_TraceHandle *h = (Ttk_TraceHandle *)ckalloc(sizeof(*h)); int status; h->interp = interp; diff --git a/generic/ttk/ttkTrack.c b/generic/ttk/ttkTrack.c index 0def559..b9aa776 100644 --- a/generic/ttk/ttkTrack.c +++ b/generic/ttk/ttkTrack.c @@ -118,7 +118,7 @@ static const unsigned ElementStateMask = static void ElementStateEventProc(ClientData clientData, XEvent *ev) { - ElementStateTracker *es = clientData; + ElementStateTracker *es = (ElementStateTracker *)clientData; Ttk_Layout layout = es->corePtr->layout; Ttk_Element element; @@ -173,7 +173,7 @@ ElementStateEventProc(ClientData clientData, XEvent *ev) void TtkTrackElementState(WidgetCore *corePtr) { - ElementStateTracker *es = ckalloc(sizeof(*es)); + ElementStateTracker *es = (ElementStateTracker *)ckalloc(sizeof(*es)); es->corePtr = corePtr; es->tracking = 0; es->activeElement = es->pressedElement = 0; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index 6113803..bb36322 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -84,7 +84,7 @@ static const Tk_OptionSpec ItemOptionSpecs[] = { */ static TreeItem *NewItem(void) { - TreeItem *item = ckalloc(sizeof(*item)); + TreeItem *item = (TreeItem *)ckalloc(sizeof(*item)); item->entryPtr = 0; item->parent = item->children = item->next = item->prev = NULL; @@ -119,7 +119,7 @@ static void FreeItem(TreeItem *item) ckfree(item); } -static void FreeItemCB(void *clientData) { FreeItem(clientData); } +static void FreeItemCB(void *clientData) { FreeItem((TreeItem *)clientData); } /* + DetachItem -- * Unlink an item from the tree. @@ -525,7 +525,7 @@ static TreeColumn *GetColumn( entryPtr = Tcl_FindHashEntry( &tv->tree.columnNames, Tcl_GetString(columnIDObj)); if (entryPtr) { - return Tcl_GetHashValue(entryPtr); + return (TreeColumn *)Tcl_GetHashValue(entryPtr); } /* Check for number: @@ -586,7 +586,7 @@ static TreeItem *FindItem( Tcl_SetErrorCode(interp, "TTK", "TREE", "ITEM", NULL); return 0; } - return Tcl_GetHashValue(entryPtr); + return (TreeItem *)Tcl_GetHashValue(entryPtr); } /* + GetItemListFromObj -- @@ -607,7 +607,7 @@ static TreeItem **GetItemListFromObj( return NULL; } - items = ckalloc((nElements + 1)*sizeof(TreeItem*)); + items = (TreeItem **)ckalloc((nElements + 1)*sizeof(TreeItem*)); for (i = 0; i < nElements; ++i) { items[i] = FindItem(interp, tv, elements[i]); if (!items[i]) { @@ -624,7 +624,7 @@ static TreeItem **GetItemListFromObj( */ static const char *ItemName(Treeview *tv, TreeItem *item) { - return Tcl_GetHashKey(&tv->tree.items, item->entryPtr); + return (const char *)Tcl_GetHashKey(&tv->tree.items, item->entryPtr); } /* + ItemID -- @@ -682,7 +682,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) * Initialize columns array and columnNames hash table: */ tv->tree.nColumns = ncols; - tv->tree.columns = ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); + tv->tree.columns = (TreeColumn *)ckalloc(tv->tree.nColumns * sizeof(TreeColumn)); for (i = 0; i < ncols; ++i) { int isNew; @@ -727,12 +727,12 @@ static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) if (!strcmp(Tcl_GetString(tv->tree.displayColumnsObj), "#all")) { ndcols = tv->tree.nColumns; - displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); + displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = tv->tree.columns + index; } } else { - displayColumns = ckalloc((ndcols+1) * sizeof(TreeColumn*)); + displayColumns = (TreeColumn **)ckalloc((ndcols+1) * sizeof(TreeColumn*)); for (index = 0; index < ndcols; ++index) { displayColumns[index+1] = GetColumn(interp, tv, dcolumns[index]); if (!displayColumns[index+1]) { @@ -930,7 +930,7 @@ static const unsigned long TreeviewBindEventMask = static void TreeviewBindEventProc(void *clientData, XEvent *event) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; TreeItem *item = NULL; Ttk_TagSet tagset; @@ -982,7 +982,7 @@ static void TreeviewBindEventProc(void *clientData, XEvent *event) static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int unused; tv->tree.itemOptionTable = @@ -1049,7 +1049,7 @@ static void TreeviewInitialize(Tcl_Interp *interp, void *recordPtr) static void TreeviewCleanup(void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tk_DeleteEventHandler(tv->core.tkwin, TreeviewBindEventMask, TreeviewBindEventProc, tv); @@ -1082,7 +1082,7 @@ static void TreeviewCleanup(void *recordPtr) static int TreeviewConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; unsigned showFlags = tv->tree.showFlags; if (mask & COLUMNS_CHANGED) { @@ -1561,7 +1561,7 @@ static Ttk_Layout GetSublayout( static Ttk_Layout TreeviewGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr); Tcl_Obj *objPtr; int unused; @@ -1610,7 +1610,7 @@ static Ttk_Layout TreeviewGetLayout( */ static void TreeviewDoLayout(void *clientData) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; int visibleRows; Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin)); @@ -1644,7 +1644,7 @@ static void TreeviewDoLayout(void *clientData) */ static int TreeviewSize(void *clientData, int *widthPtr, int *heightPtr) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; int nRows, padHeight, padWidth; Ttk_LayoutSize(tv->core.layout, tv->core.state, &padWidth, &padHeight); @@ -1832,7 +1832,7 @@ static int DrawForest( */ static void TreeviewDisplay(void *clientData, Drawable d) { - Treeview *tv = clientData; + Treeview *tv = (Treeview *)clientData; Ttk_DrawLayout(tv->core.layout, tv->core.state, d); if (tv->tree.showFlags & SHOW_HEADINGS) { @@ -1946,7 +1946,7 @@ static TreeItem *DeleteItems(TreeItem *item, TreeItem *delq) static int TreeviewChildrenCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; Tcl_Obj *result; @@ -2026,7 +2026,7 @@ static int TreeviewChildrenCommand( static int TreeviewParentCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2054,7 +2054,7 @@ static int TreeviewParentCommand( static int TreeviewNextCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2079,7 +2079,7 @@ static int TreeviewNextCommand( static int TreeviewPrevCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc != 3) { @@ -2104,7 +2104,7 @@ static int TreeviewPrevCommand( static int TreeviewIndexCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; int index = 0; @@ -2132,7 +2132,7 @@ static int TreeviewIndexCommand( static int TreeviewExistsCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tcl_HashEntry *entryPtr; if (objc != 3) { @@ -2151,7 +2151,7 @@ static int TreeviewExistsCommand( static int TreeviewBBoxCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item = 0; TreeColumn *column = 0; Ttk_Box bbox; @@ -2194,6 +2194,7 @@ static int TreeviewHorribleIdentify( int dColumnNumber; char dcolbuf[16]; int x, y, x1; + (void)objc; /* ASSERT: objc == 4 */ @@ -2267,7 +2268,7 @@ static int TreeviewIdentifyCommand( { "region", "item", "column", "row", "element", NULL }; enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT }; - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int submethod; int x, y; @@ -2369,7 +2370,7 @@ static int TreeviewIdentifyCommand( static int TreeviewItemCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; if (objc < 3) { @@ -2397,7 +2398,7 @@ static int TreeviewItemCommand( static int TreeviewColumnCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeColumn *column; if (objc < 3) { @@ -2425,7 +2426,7 @@ static int TreeviewColumnCommand( static int TreeviewHeadingCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Tk_OptionTable optionTable = tv->tree.headingOptionTable; Tk_Window tkwin = tv->core.tkwin; TreeColumn *column; @@ -2455,7 +2456,7 @@ static int TreeviewHeadingCommand( static int TreeviewSetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item; TreeColumn *column; int columnNumber; @@ -2549,7 +2550,7 @@ static int TreeviewSetCommand( static int TreeviewInsertCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *parent, *sibling, *newItem; Tcl_HashEntry *entryPtr; int isNew; @@ -2630,7 +2631,7 @@ static int TreeviewInsertCommand( static int TreeviewDetachCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem **items; int i; @@ -2677,7 +2678,7 @@ static int TreeviewDetachCommand( static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem **items, *delq; int i, selItemDeleted = 0; @@ -2738,7 +2739,7 @@ static int TreeviewDeleteCommand( static int TreeviewMoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; TreeItem *sibling; @@ -2801,14 +2802,14 @@ static int TreeviewMoveCommand( static int TreeviewXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.xscrollHandle); } static int TreeviewYViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; return TtkScrollviewCommand(interp, objc, objv, tv->tree.yscrollHandle); } @@ -2818,7 +2819,7 @@ static int TreeviewYViewCommand( static int TreeviewSeeCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; TreeItem *item, *parent; int rowNumber; @@ -2865,7 +2866,7 @@ static int TreeviewSeeCommand( static int TreeviewDragCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int left = tv->tree.treeArea.x - tv->tree.xscroll.first; int i = FirstColumn(tv); TreeColumn *column; @@ -2902,7 +2903,7 @@ static int TreeviewDragCommand( static int TreeviewDropCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "drop"); @@ -2922,7 +2923,7 @@ static int TreeviewDropCommand( static int TreeviewFocusCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc == 2) { if (tv->tree.focus) { @@ -2954,7 +2955,7 @@ static int TreeviewSelectionCommand( "set", "add", "remove", "toggle", NULL }; - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; int selop, i; TreeItem *item, **items; @@ -3023,7 +3024,7 @@ static int TreeviewSelectionCommand( static int TreeviewTagBindCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Tk_BindingTable bindingTable = tv->tree.bindingTable; Ttk_Tag tag; @@ -3076,7 +3077,7 @@ static int TreeviewTagBindCommand( static int TreeviewTagConfigureCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_TagTable tagTable = tv->tree.tagTable; Ttk_Tag tag; @@ -3107,7 +3108,7 @@ static int TreeviewTagConfigureCommand( static int TreeviewTagHasCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc == 4) { /* Return list of all items with tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); @@ -3143,7 +3144,7 @@ static int TreeviewTagHasCommand( static int TreeviewTagNamesCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, ""); @@ -3167,7 +3168,7 @@ static void AddTag(TreeItem *item, Ttk_Tag tag) static int TreeviewTagAddCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; TreeItem **items; int i; @@ -3207,7 +3208,7 @@ static void RemoveTag(TreeItem *item, Ttk_Tag tag) static int TreeviewTagRemoveCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - Treeview *tv = recordPtr; + Treeview *tv = (Treeview *)recordPtr; Ttk_Tag tag; if (objc < 4) { @@ -3355,16 +3356,18 @@ static const Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void TreeitemIndicatorSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; Ttk_Padding margins; int size = 0; + (void)dummy; + (void)paddingPtr; Ttk_GetPaddingFromObj(NULL, tkwin, indicator->marginsObj, &margins); Tk_GetPixelsFromObj(NULL, tkwin, indicator->sizeObj, &size); @@ -3374,15 +3377,16 @@ static void TreeitemIndicatorSize( } static void TreeitemIndicatorDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - TreeitemIndicator *indicator = elementRecord; + TreeitemIndicator *indicator = (TreeitemIndicator *)elementRecord; ArrowDirection direction = (state & TTK_STATE_OPEN) ? ARROW_DOWN : ARROW_RIGHT; Ttk_Padding margins; XColor *borderColor = Tk_GetColorFromObj(tkwin, indicator->colorObj); XGCValues gcvalues; GC gc; unsigned mask; + (void)dummy; if (state & TTK_STATE_LEAF) /* don't draw anything */ return; @@ -3422,16 +3426,19 @@ static const Ttk_ElementOptionSpec RowElementOptions[] = { offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, offsetof(RowElement,rowNumberObj), "0" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void RowElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - RowElement *row = elementRecord; + RowElement *row = (RowElement *)elementRecord; XColor *color = Tk_GetColorFromObj(tkwin, row->backgroundObj); GC gc = Tk_GCForColor(color, d); + (void)dummy; + (void)state; + XFillRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width, b.height); } diff --git a/generic/ttk/ttkWidget.c b/generic/ttk/ttkWidget.c index 7744a81..df6e6be 100644 --- a/generic/ttk/ttkWidget.c +++ b/generic/ttk/ttkWidget.c @@ -85,7 +85,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d) #else /* No double-buffering: draw directly into the window. */ static Drawable BeginDrawing(Tk_Window tkwin) { return Tk_WindowId(tkwin); } -static void EndDrawing(Tk_Window tkwin, Drawable d) { } +static void EndDrawing(Tk_Window tkwin, Drawable d) { (void)tkwin; (void)d;} #endif /* DrawWidget -- @@ -93,7 +93,7 @@ static void EndDrawing(Tk_Window tkwin, Drawable d) { } */ static void DrawWidget(ClientData recordPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; corePtr->flags &= ~REDISPLAY_PENDING; if (Tk_IsMapped(corePtr->tkwin)) { @@ -152,7 +152,7 @@ static int WidgetInstanceObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; const Ttk_Ensemble *commands = corePtr->widgetSpec->commands; int status; @@ -187,7 +187,7 @@ WidgetInstanceObjCmd( static void WidgetInstanceObjCmdDeleted(ClientData clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; corePtr->widgetCmd = NULL; if (corePtr->tkwin != NULL) Tk_DestroyWindow(corePtr->tkwin); @@ -332,7 +332,7 @@ static void CoreEventProc(ClientData clientData, XEvent *eventPtr) */ static void WidgetWorldChanged(ClientData clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } @@ -352,7 +352,7 @@ static const Tk_ClassProcs widgetClassProcs = { int TtkWidgetConstructorObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetSpec *widgetSpec = clientData; + WidgetSpec *widgetSpec = (WidgetSpec *)clientData; const char *className = widgetSpec->className; Tk_OptionTable optionTable = Tk_CreateOptionTable(interp, widgetSpec->optionSpecs); @@ -388,7 +388,7 @@ int TtkWidgetConstructorObjCmd( */ recordPtr = ckalloc(widgetSpec->recordSize); memset(recordPtr, 0, widgetSpec->recordSize); - corePtr = recordPtr; + corePtr = (WidgetCore *)recordPtr; corePtr->tkwin = tkwin; corePtr->interp = interp; @@ -463,7 +463,7 @@ error: Ttk_Layout TtkWidgetGetLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; const char *styleName = 0; if (corePtr->styleObj) @@ -485,17 +485,17 @@ Ttk_Layout TtkWidgetGetLayout( Ttk_Layout TtkWidgetGetOrientedLayout( Tcl_Interp *interp, Ttk_Theme themePtr, void *recordPtr, Tcl_Obj *orientObj) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; const char *baseStyleName = 0; Tcl_DString styleName; - int orient = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orient = TTK_ORIENT_HORIZONTAL; Ttk_Layout layout; Tcl_DStringInit(&styleName); /* Prefix: */ - Ttk_GetOrientFromObj(NULL, orientObj, &orient); + TtkGetOrientFromObj(NULL, orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) Tcl_DStringAppend(&styleName, "Horizontal.", -1); else @@ -525,6 +525,8 @@ Ttk_Layout TtkWidgetGetOrientedLayout( */ void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) { + (void)interp; + (void)recordPtr; } /* TtkNullPostConfigure -- @@ -532,6 +534,10 @@ void TtkNullInitialize(Tcl_Interp *interp, void *recordPtr) */ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) { + (void)interp; + (void)clientData; + (void)mask; + return TCL_OK; } @@ -541,7 +547,7 @@ int TtkNullPostConfigure(Tcl_Interp *interp, void *clientData, int mask) */ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; int status = TCL_OK; if (mask & STYLE_CHANGED) { @@ -556,6 +562,7 @@ int TtkCoreConfigure(Tcl_Interp *interp, void *clientData, int mask) */ void TtkNullCleanup(void *recordPtr) { + (void)recordPtr; return; } @@ -564,7 +571,7 @@ void TtkNullCleanup(void *recordPtr) */ void TtkWidgetDoLayout(void *clientData) { - WidgetCore *corePtr = clientData; + WidgetCore *corePtr = (WidgetCore *)clientData; Ttk_PlaceLayout(corePtr->layout,corePtr->state,Ttk_WinBox(corePtr->tkwin)); } @@ -573,7 +580,7 @@ void TtkWidgetDoLayout(void *clientData) */ void TtkWidgetDisplay(void *recordPtr, Drawable d) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_DrawLayout(corePtr->layout, corePtr->state, d); } @@ -582,7 +589,7 @@ void TtkWidgetDisplay(void *recordPtr, Drawable d) */ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_LayoutSize(corePtr->layout, corePtr->state, widthPtr, heightPtr); return 1; } @@ -596,7 +603,7 @@ int TtkWidgetSize(void *recordPtr, int *widthPtr, int *heightPtr) int TtkWidgetCgetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc != 3) { @@ -616,7 +623,7 @@ int TtkWidgetCgetCommand( int TtkWidgetConfigureCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Tcl_Obj *result; if (objc == 2) { @@ -686,7 +693,7 @@ int TtkWidgetConfigureCommand( int TtkWidgetStateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_StateSpec spec; int status; Ttk_State oldState, changed; @@ -726,7 +733,7 @@ int TtkWidgetStateCommand( int TtkWidgetInstateCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_State state = corePtr->state; Ttk_StateSpec spec; int status = TCL_OK; @@ -757,7 +764,7 @@ int TtkWidgetInstateCommand( int TtkWidgetIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - WidgetCore *corePtr = recordPtr; + WidgetCore *corePtr = (WidgetCore *)recordPtr; Ttk_Element element; static const char *const whatTable[] = { "element", NULL }; int x, y, what; diff --git a/library/scrlbar.tcl b/library/scrlbar.tcl index bce8391..8106b3d 100644 --- a/library/scrlbar.tcl +++ b/library/scrlbar.tcl @@ -131,16 +131,10 @@ bind Scrollbar <<LineEnd>> { if {[tk windowingsystem] eq "aqua"} { bind Scrollbar <MouseWheel> { - tk::ScrollByUnits %W v [expr {-(%D)}] + tk::ScrollByUnits %W hv [expr {-(%D)}] } bind Scrollbar <Option-MouseWheel> { - tk::ScrollByUnits %W v [expr {-10 * (%D)}] - } - bind Scrollbar <Shift-MouseWheel> { - tk::ScrollByUnits %W h [expr {-(%D)}] - } - bind Scrollbar <Shift-Option-MouseWheel> { - tk::ScrollByUnits %W h [expr {-10 * (%D)}] + tk::ScrollByUnits %W hv [expr {-10 * (%D)}] } } else { # We must make sure that positive and negative movements are rounded @@ -151,27 +145,18 @@ if {[tk windowingsystem] eq "aqua"} { # The following code ensure equal +/- behaviour. bind Scrollbar <MouseWheel> { if {%D >= 0} { - tk::ScrollByUnits %W v [expr {-%D/30}] - } else { - tk::ScrollByUnits %W v [expr {(29-%D)/30}] - } - } - bind Scrollbar <Shift-MouseWheel> { - if {%D >= 0} { - tk::ScrollByUnits %W h [expr {-%D/30}] + tk::ScrollByUnits %W hv [expr {-%D/30}] } else { - tk::ScrollByUnits %W h [expr {(29-%D)/30}] + tk::ScrollByUnits %W hv [expr {(29-%D)/30}] } } } if {[tk windowingsystem] eq "x11"} { - bind Scrollbar <Button-4> {tk::ScrollByUnits %W v -5} - bind Scrollbar <Button-5> {tk::ScrollByUnits %W v 5} - bind Scrollbar <Shift-Button-4> {tk::ScrollByUnits %W h -5} - bind Scrollbar <Shift-Button-5> {tk::ScrollByUnits %W h 5} - bind Scrollbar <Button-6> {tk::ScrollByUnits %W h -5} - bind Scrollbar <Button-7> {tk::ScrollByUnits %W h 5} + bind Scrollbar <Button-4> {tk::ScrollByUnits %W hv -5} + bind Scrollbar <Button-5> {tk::ScrollByUnits %W hv 5} + bind Scrollbar <Button-6> {tk::ScrollByUnits %W hv -5} + bind Scrollbar <Button-7> {tk::ScrollByUnits %W hv 5} } # tk::ScrollButtonDown -- diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index 15f9cde..7537491 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -21,14 +21,13 @@ bind TScrollbar <ButtonRelease-2> { ttk::scrollbar::Release %W %x %y } # # The shift-bindings scroll left/right (not up/down) # if a widget has both possibilities -set eventList [list <MouseWheel> <Shift-MouseWheel>] +set eventList [list <MouseWheel>] switch [tk windowingsystem] { aqua { - lappend eventList <Option-MouseWheel> <Shift-Option-MouseWheel> + lappend eventList <Option-MouseWheel> } x11 { - lappend eventList <Button-4> <Button-5> <Button-6> <Button-7>\ - <Shift-Button-4> <Shift-Button-5> + lappend eventList <Button-4> <Button-5> <Button-6> <Button-7> } } foreach event $eventList { diff --git a/macosx/tkMacOSXBitmap.c b/macosx/tkMacOSXBitmap.c index 615192b..d75a164 100644 --- a/macosx/tkMacOSXBitmap.c +++ b/macosx/tkMacOSXBitmap.c @@ -44,7 +44,7 @@ static BuiltInIcon builtInIcons[] = { {"stop", kAlertStopIcon}, {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, - {NULL} + {NULL, 0} }; #define builtInIconSize 32 @@ -344,7 +344,7 @@ TkpGetNativeAppBitmap( int TkMacOSXIconBitmapObjCmd( - ClientData clientData, /* Unused. */ + ClientData dummy, /* Unused. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -353,6 +353,7 @@ TkMacOSXIconBitmapObjCmd( int i = 1, len, isNew, result = TCL_ERROR; const char *name, *value; IconBitmap ib, *iconBitmap; + (void)dummy; if (objc != 6) { Tcl_WrongNumArgs(interp, 1, objv, "name width height " diff --git a/macosx/tkMacOSXButton.c b/macosx/tkMacOSXButton.c index 8a121ee..865234f 100644 --- a/macosx/tkMacOSXButton.c +++ b/macosx/tkMacOSXButton.c @@ -95,6 +95,8 @@ static void PulseDefaultButtonProc(ClientData clientData); const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ + NULL, + NULL }; static int bCount; @@ -737,6 +739,7 @@ TkMacOSXDrawButton( TkMacOSXDrawingContext dc; DrawParams *dpPtr = &mbPtr->drawParams; int useNewerHITools = 1; + (void)gc; TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); @@ -822,6 +825,9 @@ ButtonBackgroundDrawCB( Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int usehlborder = 0; + (void)btnbounds; + (void)depth; + (void)isColorDev; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; @@ -873,6 +879,11 @@ ButtonContentDrawCB ( { TkButton *butPtr = (TkButton *) ptr; Tk_Window tkwin = butPtr->tkwin; + (void)btnbounds; + (void)kind; + (void)drawinfo; + (void)depth; + (void)isColorDev; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c index 88a0d93..a5665c7 100644 --- a/macosx/tkMacOSXClipboard.c +++ b/macosx/tkMacOSXClipboard.c @@ -185,6 +185,7 @@ XSetSelectionOwner( Time time) /* The current time? */ { TkDisplay *dispPtr = TkGetDisplayList(); + (void)time; if (dispPtr && selection == dispPtr->clipboardAtom) { clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL; @@ -247,6 +248,8 @@ TkSelUpdateClipboard( /* Info about the content. */ { NSPasteboard *pb = [NSPasteboard generalPasteboard]; + (void)winPtr; + (void)targetPtr; changeCount = [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:NSApp]; @@ -301,6 +304,7 @@ void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { + (void)eventPtr; } /* diff --git a/macosx/tkMacOSXColor.c b/macosx/tkMacOSXColor.c index 9b72732..3c40cfb 100644 --- a/macosx/tkMacOSXColor.c +++ b/macosx/tkMacOSXColor.c @@ -827,6 +827,7 @@ TkpGetColorByValue( * desired color. */ { TkColor *tkColPtr = ckalloc(sizeof(TkColor)); + (void)tkwin; tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; @@ -858,6 +859,8 @@ XAllocColor( Colormap map, /* Not used. */ XColor *colorPtr) /* XColor struct to modify. */ { + (void)map; + display->request++; colorPtr->pixel = TkpGetPixel(colorPtr); return 1; @@ -871,6 +874,10 @@ XCreateColormap( int alloc) /* Not used. */ { static Colormap index = 1; + (void)display; + (void)window; + (void)visual; + (void)alloc; /* * Just return a new value each time. @@ -883,6 +890,9 @@ XFreeColormap( Display* display, /* Display. */ Colormap colormap) /* Colormap. */ { + (void)display; + (void)colormap; + return Success; } @@ -894,6 +904,12 @@ XFreeColors( int npixels, /* Number of pixels. */ unsigned long planes) /* Number of pixel planes. */ { + (void)display; + (void)colormap; + (void)pixels; + (void)npixels; + (void)planes; + /* * The Macintosh version of Tk uses TrueColor. Nothing * needs to be done to release colors as there really is diff --git a/macosx/tkMacOSXConfig.c b/macosx/tkMacOSXConfig.c index 841fc54..34a1fc9 100644 --- a/macosx/tkMacOSXConfig.c +++ b/macosx/tkMacOSXConfig.c @@ -39,6 +39,10 @@ TkpGetSystemDefault( const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { + (void)tkwin; + (void)dbName; + (void)className; + return NULL; } diff --git a/macosx/tkMacOSXCursor.c b/macosx/tkMacOSXCursor.c index 894a44d..d5faa37 100644 --- a/macosx/tkMacOSXCursor.c +++ b/macosx/tkMacOSXCursor.c @@ -382,6 +382,7 @@ TkGetCursorByName( TkMacOSXCursor *macCursorPtr = NULL; const char **argv = NULL; int argc; + (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -437,6 +438,16 @@ TkCreateCursorFromData( XColor fgColor, /* Foreground color for cursor. */ XColor bgColor) /* Background color for cursor. */ { + (void)tkwin; + (void)source; + (void)mask; + (void)width; + (void)height; + (void)xHot; + (void)yHot; + (void)fgColor; + (void)bgColor; + return NULL; } diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index c5681b3..c41f8fb 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -198,13 +198,17 @@ getFileURL( @implementation TKApplication(TKDialog) - (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url { + (void)sender; + (void)url; return YES; } - (void)panel:(id)sender didChangeToDirectoryURL:(NSURL *)url { + (void)sender; (void)url; } - (BOOL)panel:(id)sender validateURL:(NSURL *)url error:(NSError **)outError { + (void)sender; (void)url; *outError = nil; return YES; } @@ -1359,11 +1363,13 @@ TkAboutDlg(void) int TkMacOSXStandardAboutPanelObjCmd( - ClientData clientData, /* Unused. */ + ClientData dummy, /* Unused. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { + (void)dummy; + if (objc > 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -1630,6 +1636,7 @@ enum FontchooserOption { - (void) changeFont: (id) sender { NSFontManager *fm = [NSFontManager sharedFontManager]; + (void)sender; if ([fm currentFontAction] == NSViaPanelFontAction) { NSFont *font = [fm convertFont:fontPanelFont]; @@ -1655,6 +1662,8 @@ enum FontchooserOption { - (NSUInteger) validModesForFontPanel: (NSFontPanel *) fontPanel { + (void)fontPanel; + return (NSFontPanelStandardModesMask & ~NSFontPanelAllEffectsModeMask) | NSFontPanelUnderlineEffectModeMask | NSFontPanelStrikethroughEffectModeMask; @@ -1986,6 +1995,8 @@ FontchooserShowCmd( { FontchooserData *fcdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + (void)objc; + (void)objv; if (fcdPtr->parent == None) { fcdPtr->parent = (Tk_Window) clientData; @@ -2027,12 +2038,16 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ + ClientData dummy, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; + (void)dummy; + (void)interp; + (void)objc; + (void)objv; if ([fp isVisible]) { [fp orderOut:NSApp]; @@ -2129,9 +2144,10 @@ DeleteFontchooserData( MODULE_SCOPE int TkInitFontchooser( Tcl_Interp *interp, - ClientData clientData) + ClientData dummy) { - FontchooserData *fcdPtr = ckalloc(sizeof(FontchooserData)); + FontchooserData *fcdPtr = (FontchooserData *)ckalloc(sizeof(FontchooserData)); + (void)dummy; bzero(fcdPtr, sizeof(FontchooserData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteFontchooserData, diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 724f637..e6ccf20 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -73,6 +73,7 @@ TkMacOSXInitCGDrawing( int limit) { static Boolean initialized = FALSE; + (void)enable; if (!initialized) { initialized = TRUE; @@ -866,6 +867,7 @@ XFillPolygon( MacDrawable *macWin = (MacDrawable *) d; TkMacOSXDrawingContext dc; int i; + (void)shape; display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { @@ -1451,6 +1453,7 @@ TkScrollWindow( HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; + (void)gc; if (view) { /* @@ -1537,6 +1540,9 @@ TkMacOSXSetUpGraphicsPort( GC gc, /* GC to apply to current port. */ void *destPort) { + (void)gc; + (void)destPort; + Tcl_Panic("TkMacOSXSetUpGraphicsPort: Obsolete, no more QD!"); } @@ -1571,6 +1577,7 @@ TkMacOSXSetupDrawingContext( NSWindow *win = NULL; TkMacOSXDrawingContext dc = {}; CGRect clipBounds; + (void)useCG; /* * If the drawable is not a pixmap and it has an associated NSWindow then @@ -1872,6 +1879,7 @@ void TkMacOSXSetUpClippingRgn( Drawable drawable) /* Drawable to update. */ { + (void)drawable; } /* @@ -1899,6 +1907,7 @@ TkpClipDrawableToRect( int width, int height) { MacDrawable *macDraw = (MacDrawable *) d; + (void)display; if (macDraw->drawRgn) { CFRelease(macDraw->drawRgn); @@ -1987,6 +1996,9 @@ TkMacOSXMakeStippleMap( Drawable drawable, /* Window to apply stipple. */ Drawable stipple) /* The stipple pattern. */ { + (void)drawable; + (void)stipple; + return NULL; } diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index ccd107a..b69fb48 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -121,6 +121,7 @@ TkpMakeWindow( Window parent) { MacDrawable *macWin; + (void)parent; /* * If this window is marked as embedded then the window structure should @@ -559,7 +560,7 @@ TkpClaimFocus( int TkpTestembedCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -569,6 +570,7 @@ TkpTestembedCmd( Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; + (void)dummy; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; @@ -667,6 +669,9 @@ TkpRedirectKeyEvent( XEvent *eventPtr) /* X event to redirect (should be KeyPress or * KeyRelease). */ { + (void)winPtr; + (void)eventPtr; + /* TODO: Implement this or decide it definitely needs no implementation */ } @@ -1084,6 +1089,7 @@ static void EmbedSendConfigure( Container *containerPtr) /* Information about the embedding. */ { + (void)containerPtr; } /* @@ -1191,12 +1197,14 @@ void TkpShowBusyWindow( TkBusy busy) { + (void)busy; } void TkpHideBusyWindow( TkBusy busy) { + (void)busy; } void @@ -1204,6 +1212,8 @@ TkpMakeTransparentWindowExist( Tk_Window tkwin, /* Token for window. */ Window parent) /* Parent window. */ { + (void)tkwin; + (void)parent; } void @@ -1214,6 +1224,11 @@ TkpCreateBusy( Tk_Window tkParent, TkBusy busy) { + (void)winPtr; + (void)tkRef; + (void)parentPtr; + (void)tkParent; + (void)busy; } /* diff --git a/macosx/tkMacOSXEvent.c b/macosx/tkMacOSXEvent.c index 1b9e077..af68eb6 100644 --- a/macosx/tkMacOSXEvent.c +++ b/macosx/tkMacOSXEvent.c @@ -133,6 +133,8 @@ XSync( Display *display, Bool discard) { + (void)discard; + if (display) { display->request++; } diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index 6cc5da2..295f4de 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -56,25 +56,25 @@ struct SystemFontMapEntry { #define ThemeFont(n, ...) { kTheme##n##Font, "system" #n "Font", ##__VA_ARGS__ } static const struct SystemFontMapEntry systemFontMap[] = { ThemeFont(System, "TkDefaultFont", "TkIconFont"), - ThemeFont(EmphasizedSystem, "TkCaptionFont"), + ThemeFont(EmphasizedSystem, "TkCaptionFont", NULL), ThemeFont(SmallSystem, "TkHeadingFont", "TkTooltipFont"), - ThemeFont(SmallEmphasizedSystem), - ThemeFont(Application, "TkTextFont"), - ThemeFont(Label, "TkSmallCaptionFont"), - ThemeFont(Views), - ThemeFont(MenuTitle), - ThemeFont(MenuItem, "TkMenuFont"), - ThemeFont(MenuItemMark), - ThemeFont(MenuItemCmdKey), - ThemeFont(WindowTitle), - ThemeFont(PushButton), - ThemeFont(UtilityWindowTitle), - ThemeFont(AlertHeader), - ThemeFont(Toolbar), - ThemeFont(MiniSystem), - { kThemeSystemFontDetail, "systemDetailSystemFont" }, - { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont" }, - { -1, NULL } + ThemeFont(SmallEmphasizedSystem, NULL, NULL), + ThemeFont(Application, "TkTextFont", NULL), + ThemeFont(Label, "TkSmallCaptionFont", NULL), + ThemeFont(Views, NULL, NULL), + ThemeFont(MenuTitle, NULL, NULL), + ThemeFont(MenuItem, "TkMenuFont", NULL), + ThemeFont(MenuItemMark, NULL, NULL), + ThemeFont(MenuItemCmdKey, NULL, NULL), + ThemeFont(WindowTitle, NULL, NULL), + ThemeFont(PushButton, NULL, NULL), + ThemeFont(UtilityWindowTitle, NULL, NULL), + ThemeFont(AlertHeader, NULL, NULL), + ThemeFont(Toolbar, NULL, NULL), + ThemeFont(MiniSystem, NULL, NULL), + { kThemeSystemFontDetail, "systemDetailSystemFont", NULL, NULL }, + { kThemeSystemFontDetailEmphasized, "systemDetailEmphasizedSystemFont", NULL, NULL }, + { -1, NULL, NULL, NULL } }; #undef ThemeFont @@ -612,6 +612,7 @@ TkpGetNativeFont( MacFont *fontPtr = NULL; ThemeFontID themeFontId; CTFontRef ctFont; + (void)tkwin; if (strcmp(name, SYSTEMFONT_NAME) == 0) { themeFontId = kThemeSystemFont; @@ -759,6 +760,7 @@ TkpGetFontFamilies( { Tcl_Obj *resultPtr = Tcl_NewListObj(0, NULL); NSArray *list = [[NSFontManager sharedFontManager] availableFontFamilies]; + (void)tkwin; for (NSString *family in list) { Tcl_ListObjAppendElement(NULL, resultPtr, @@ -838,6 +840,7 @@ TkpGetFontAttrsForChar( *faPtr = fontPtr->font.fa; if (nsFont && ![[nsFont coveredCharacterSet] characterIsMember:c]) { UTF16Char ch = (UTF16Char) c; + (void)tkwin; nsFont = [nsFont bestMatchingFontForCharacters:&ch length:1 attributes:nil actualCoveredLength:NULL]; @@ -1212,6 +1215,7 @@ TkpDrawCharsInContext( * whole (not just the range) string when * drawing. */ { + (void)display; DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes, rangeStart, rangeLength, x, y, 0.0); } @@ -1252,6 +1256,7 @@ DrawCharsInContext( NSFont *nsFont; CGAffineTransform t; int h; + (void)display; if (rangeStart < 0 || rangeLength <= 0 || rangeStart + rangeLength > numBytes || @@ -1379,6 +1384,9 @@ TkMacOSXIsCharacterMissing( Tk_Font tkfont, /* The font we are looking in. */ unsigned int searchChar) /* The character we are looking for. */ { + (void)tkfont; + (void)searchChar; + return 0; } diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index f9c26c6..49516cf 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -64,11 +64,13 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender { + (void)sender; [self handleQuitApplicationEvent:Nil withReplyEvent:Nil]; } - (void) preferences: (id) sender { + (void)sender; [self handleShowPreferencesEvent:Nil withReplyEvent:Nil]; } @@ -76,6 +78,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; withReplyEvent: (NSAppleEventDescriptor *)replyEvent { KillEvent *eventPtr; + (void)event; + (void)replyEvent; if (_eventInterp) { /* @@ -97,6 +101,9 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleOpenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::OpenApplication", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::OpenApplication", @@ -110,6 +117,9 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + [NSApp activateIgnoringOtherApps: YES]; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ReopenApplication", NULL, 0)) { @@ -124,6 +134,9 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; - (void) handleShowPreferencesEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { + (void)event; + (void)replyEvent; + if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)){ int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ShowPreferences", @@ -147,6 +160,7 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; long count, index; AEKeyword keyword; Tcl_DString pathName; + (void)replyEvent; /* * Do nothing if we don't have an interpreter. @@ -226,6 +240,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; const char *printFile = [file UTF8String]; AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); Tcl_DString *printCommand = &AEInfo->command; + (void)replyEvent; + Tcl_DStringInit(printCommand); Tcl_DStringAppend(printCommand, printDocProc, -1); Tcl_DStringAppendElement(printCommand, printFile); @@ -336,6 +352,8 @@ static const char* scriptTextProc = "::tk::mac::DoScriptText"; const char *cURL=[url UTF8String]; AppleEventInfo *AEInfo = ckalloc(sizeof(AppleEventInfo)); Tcl_DString *launchCommand = &AEInfo->command; + (void)replyEvent; + Tcl_DStringInit(launchCommand); Tcl_DStringAppend(launchCommand, launchURLProc, -1); Tcl_DStringAppendElement(launchCommand, cURL); @@ -424,10 +442,11 @@ static void ProcessAppleEvent( void TkMacOSXInitAppleEvents( - Tcl_Interp *interp) /* not used */ + Tcl_Interp *dummy) /* not used */ { NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager]; static Boolean initialized = FALSE; + (void)dummy; if (!initialized) { initialized = TRUE; @@ -539,6 +558,7 @@ ReallyKillMe( Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL; int code = Tcl_EvalEx(interp, quit ? "::tk::mac::Quit" : "exit", -1, TCL_EVAL_GLOBAL); + (void)flags; if (code != TCL_OK) { /* diff --git a/macosx/tkMacOSXImage.c b/macosx/tkMacOSXImage.c index 0d8be32..a8c7922 100644 --- a/macosx/tkMacOSXImage.c +++ b/macosx/tkMacOSXImage.c @@ -21,6 +21,8 @@ int _XInitImageFuncPtrs( XImage *image) { + (void)image; + return 0; } @@ -42,6 +44,9 @@ _XInitImageFuncPtrs( */ static void ReleaseData(void *info, const void *data, size_t size) { + (void)data; + (void)size; + ckfree(info); } @@ -176,6 +181,7 @@ XGetImage( unsigned int scalefactor=1, scaled_height=height, scaled_width=width; NSWindow *win = TkMacOSXDrawableWindow(drawable); static enum {unknown, no, yes} has_retina = unknown; + (void)plane_mask; if (win && has_retina == unknown) { #ifdef __clang__ @@ -451,6 +457,7 @@ XCreateImage( int bytes_per_line) { XImage *ximage; + (void)visual; display->request++; ximage = ckalloc(sizeof(XImage)); diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index aae315a..4d94952 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -92,6 +92,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, -(void)applicationWillFinishLaunching:(NSNotification *)aNotification { + (void)aNotification; /* * Initialize notifications. @@ -123,6 +124,8 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, -(void)applicationDidFinishLaunching:(NSNotification *)notification { + (void)notification; + /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. @@ -484,11 +487,13 @@ TkpGetAppName( static int TkMacOSXGetAppPathCmd( - ClientData ignored, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)dummy; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; @@ -621,6 +626,8 @@ TkMacOSXGetNamedSymbol( const char* symbol) { void *addr = dlsym(RTLD_NEXT, symbol); + (void)module; + if (!addr) { (void) dlerror(); /* Clear dlfcn error state */ } diff --git a/macosx/tkMacOSXKeyEvent.c b/macosx/tkMacOSXKeyEvent.c index d3704d2..dd6a447 100644 --- a/macosx/tkMacOSXKeyEvent.c +++ b/macosx/tkMacOSXKeyEvent.c @@ -365,6 +365,9 @@ static unsigned isFunctionKey(unsigned int code); - (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)theRange actualRange:(NSRangePointer)thePointer { + (void)theRange; + (void)thePointer; + return nil; } @@ -382,6 +385,7 @@ static unsigned isFunctionKey(unsigned int code); Tk_Window focusWin = (Tk_Window) winPtr->dispPtr->focusPtr; NSString *temp; NSString *str; + (void)selRange; str = ([aString isKindOfClass: [NSAttributedString class]]) ? [aString string] : aString; @@ -470,6 +474,9 @@ static unsigned isFunctionKey(unsigned int code); { NSRect rect; NSPoint pt; + (void)theRange; + (void)thePointer; + pt.x = caret_x; pt.y = caret_y; @@ -524,6 +531,7 @@ static unsigned isFunctionKey(unsigned int code); - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint { + (void)thePoint; if (NS_KEYLOG) { TKLog(@"characterIndexForPoint request"); } @@ -533,6 +541,8 @@ static unsigned isFunctionKey(unsigned int code); - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange { static NSAttributedString *str = nil; + (void)theRange; + if (str == nil) { str = [NSAttributedString new]; } @@ -631,6 +641,10 @@ XGrabKeyboard( { keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window); TkWindow *captureWinPtr = (TkWindow *) TkpGetCapture(); + (void)owner_events; + (void)pointer_mode; + (void)keyboard_mode; + (void)time; if (keyboardGrabWinPtr && captureWinPtr) { NSWindow *w = TkMacOSXDrawableWindow(grab_window); @@ -669,6 +683,9 @@ XUngrabKeyboard( Display* display, Time time) { + (void)display; + (void)time; + if (modalSession) { [NSApp endModalSession:modalSession]; modalSession = nil; diff --git a/macosx/tkMacOSXKeyboard.c b/macosx/tkMacOSXKeyboard.c index e91dfe2..c7e5842 100644 --- a/macosx/tkMacOSXKeyboard.c +++ b/macosx/tkMacOSXKeyboard.c @@ -140,6 +140,7 @@ static int KeycodeToUnicode(UniChar * uniChars, int maxChars, @implementation TKApplication(TKKeyboard) - (void) keyboardChanged: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -244,7 +245,7 @@ InitLatin1Table( } for (keycode = 0; keycode <= MAC_KEYCODE_MAX; keycode++) { - keysym = XKeycodeToKeysym(display,keycode<<16,state); + keysym = XkbKeycodeToKeysym(display,keycode<<16,0,state); if (keysym <= LATIN1_MAX) { latin1Table[keysym] = keycode | modifiers; } @@ -263,7 +264,7 @@ InitLatin1Table( * The parameter deadKeyStatePtr can be NULL, if no deadkey handling is * needed. * - * This function is called from XKeycodeToKeysym() in tkMacOSKeyboard.c. + * This function is called from XkbKeycodeToKeysym() in tkMacOSKeyboard.c. * * Results: * The number of characters generated if any, 0 if we are waiting for @@ -356,17 +357,16 @@ KeycodeToUnicode( */ KeySym -XKeycodeToKeysym( - Display* display, +XkbKeycodeToKeysym( + TCL_UNUSED(Display *), unsigned int keycode, + TCL_UNUSED(int), int index) { Tcl_HashEntry *hPtr; int newKeycode; UniChar newChar; - (void) display; /*unused*/ - if (!initialized) { InitKeyMaps(); } @@ -417,6 +417,15 @@ XKeycodeToKeysym( return NoSymbol; } + +KeySym +XKeycodeToKeysym( + TCL_UNUSED(Display *), + unsigned int keycode, + int index) +{ + return XkbKeycodeToKeysym(NULL, keycode, 0, index); +} /* *---------------------------------------------------------------------- @@ -534,6 +543,8 @@ char * XKeysymToString( KeySym keysym) { + (void)keysym; + return NULL; } @@ -541,6 +552,8 @@ KeySym XStringToKeysym( const char* string) { + (void)string; + return NoSymbol; } @@ -839,7 +852,7 @@ TkpGetKeySym( * First try of the actual translation. */ - sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, index); + sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0, index); /* * Special handling: If the key was shifted because of Lock, but lock is @@ -858,7 +871,7 @@ TkpGetKeySym( if ((sym == NoSymbol) || (sym > LATIN1_MAX) || !Tcl_UniCharIsUpper(sym)) { index &= ~1; - sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, + sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0, index); } } @@ -869,7 +882,7 @@ TkpGetKeySym( */ if ((index & 1) && (sym == NoSymbol)) { - sym = XKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, + sym = XkbKeycodeToKeysym(dispPtr->display, eventPtr->xkey.keycode, 0, index & ~1); } return sym; diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c index 735f7d2..7ffc054 100644 --- a/macosx/tkMacOSXMenu.c +++ b/macosx/tkMacOSXMenu.c @@ -41,7 +41,7 @@ static const struct { SPECIALMENU(help, HELP), SPECIALMENU(apple, APPLE), SPECIALMENU(window, WINDOWS), - {NULL} + {NULL, 0, 0} }; #undef SPECIALMENU @@ -58,7 +58,7 @@ static const struct { MODIFIER(Command, NSCommandKeyMask), MODIFIER(Cmd, NSCommandKeyMask), MODIFIER(Meta, NSCommandKeyMask), - {NULL} + {NULL, 0, 0} }; #undef MODIFIER @@ -86,7 +86,7 @@ static const struct { ACCEL(Help, NSHelpFunctionKey), ACCEL(Power, 0x233d), ACCEL(Eject, 0xf804), - {NULL} + {NULL, 0, 0} }; #undef ACCEL #undef sl @@ -287,6 +287,8 @@ static int ModifierCharWidth(Tk_Font tkfont); - (BOOL) menuHasKeyEquivalent: (NSMenu *) menu forEvent: (NSEvent *) event target: (id *) target action: (SEL *) action { + (void)menu; + /* * Use lowercaseString when comparing keyEquivalents since the notion of * a shifted upper case letter does not make much sense. @@ -343,6 +345,8 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menuWillOpen: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { //RecursivelyClearActiveMenu(_tkMenu); GenerateMenuSelectEvent((TKMenu *)[self supermenu], @@ -352,6 +356,8 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menuDidClose: (NSMenu *) menu { + (void)menu; + if (_tkMenu) { RecursivelyClearActiveMenu(_tkMenu); } @@ -359,6 +365,8 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menu: (NSMenu *) menu willHighlightItem: (NSMenuItem *) item { + (void)menu; + if (_tkMenu) { GenerateMenuSelectEvent(self, item); } @@ -367,6 +375,7 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menuNeedsUpdate: (NSMenu *) menu { TkMenu *menuPtr = (TkMenu *) _tkMenu; + (void)menu; if (menuPtr) { Tcl_Interp *interp = menuPtr->interp; @@ -392,6 +401,7 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menuBeginTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -401,6 +411,7 @@ static int ModifierCharWidth(Tk_Font tkfont); - (void) menuEndTracking: (NSNotification *) notification { + (void)notification; #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -785,7 +796,7 @@ TkpDestroyMenuEntry( int TkpPostMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -882,7 +893,7 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter this menu lives in */ + TCL_UNUSED(Tcl_Interp *), /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified @@ -1691,8 +1702,8 @@ TkpMenuThreadInit(void) void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ - const char *menuName) /* The name of the menu to reconfigure. */ + TCL_UNUSED(Tcl_Interp *), /* The interp the menu lives in. */ + TCL_UNUSED(const char *)) /* The name of the menu to reconfigure. */ { /* * Nothing to do. @@ -1720,8 +1731,8 @@ TkpMenuNotifyToplevelCreate( void TkpInitializeMenuBindings( - Tcl_Interp *interp, /* The interpreter to set. */ - Tk_BindingTable bindingTable) + TCL_UNUSED(Tcl_Interp *), /* The interpreter to set. */ + TCL_UNUSED(Tk_BindingTable)) /* The table to add to. */ { /* @@ -1774,17 +1785,17 @@ TkpComputeMenubarGeometry( void TkpDrawMenuEntry( - TkMenuEntry *mePtr, /* The entry to draw */ - Drawable d, /* What to draw into */ - Tk_Font tkfont, /* Precalculated font for menu */ - const Tk_FontMetrics *menuMetricsPtr, + TCL_UNUSED(TkMenuEntry *), /* The entry to draw */ + TCL_UNUSED(Drawable), /* What to draw into */ + TCL_UNUSED(Tk_Font), /* Precalculated font for menu */ + TCL_UNUSED(const Tk_FontMetrics *), /* Precalculated metrics for menu */ - int x, /* X-coordinate of topleft of entry */ - int y, /* Y-coordinate of topleft of entry */ - int width, /* Width of the entry rectangle */ - int height, /* Height of the current rectangle */ - int strictMotif, /* Boolean flag */ - int drawArrow) /* Whether or not to draw the cascade arrow + TCL_UNUSED(int), /* X-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Y-coordinate of topleft of entry */ + TCL_UNUSED(int), /* Width of the entry rectangle */ + TCL_UNUSED(int), /* Height of the current rectangle */ + TCL_UNUSED(int), /* Boolean flag */ + TCL_UNUSED(int)) /* Whether or not to draw the cascade arrow * for cascade items. */ { } @@ -1833,7 +1844,7 @@ TkMacOSXPreprocessMenu(void) int TkMacOSXUseMenuID( - short macID) /* The id to take out of the table */ + TCL_UNUSED(short)) /* The id to take out of the table */ { return TCL_OK; } @@ -1856,8 +1867,8 @@ TkMacOSXUseMenuID( int TkMacOSXDispatchMenuEvent( - int menuID, /* The menu id of the menu we are invoking */ - int index) /* The one-based index of the item that was + TCL_UNUSED(int), /* The menu id of the menu we are invoking */ + TCL_UNUSED(int)) /* The one-based index of the item that was * selected. */ { return TCL_ERROR; diff --git a/macosx/tkMacOSXMenus.c b/macosx/tkMacOSXMenus.c index 82bcda7..d6d3185 100644 --- a/macosx/tkMacOSXMenus.c +++ b/macosx/tkMacOSXMenus.c @@ -199,6 +199,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); - (void) orderFrontStandardAboutPanel: (id) sender { + (void)sender; + if (!_eventInterp || !Tcl_FindCommand(_eventInterp, "tkAboutDialog", NULL, 0) || (GetCurrentEventKeyModifiers() & optionKey)) { TkAboutDlg(); @@ -231,6 +233,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); - (void) tkSource: (id) sender { + (void)sender; + if (_eventInterp) { if (Tcl_EvalEx(_eventInterp, "tk_getOpenFile -filetypes {" "{{TCL Scripts} {.tcl} TEXT} {{Text Files} {} TEXT}}", @@ -256,6 +260,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); - (void) tkDemo: (id) sender { + (void)sender; + if (_eventInterp) { Tcl_Obj *path = GetWidgetDemoPath(_eventInterp); @@ -281,6 +287,8 @@ static Tcl_Obj * GetWidgetDemoPath(Tcl_Interp *interp); - (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>) anItem { + (void)anItem; + return YES; } @@ -355,9 +363,9 @@ GetWidgetDemoPath( void TkMacOSXHandleMenuSelect( - short theMenu, - unsigned short theItem, - int optionKeyPressed) + TCL_UNUSED(short), + TCL_UNUSED(unsigned short), + TCL_UNUSED(int)) { Tcl_Panic("TkMacOSXHandleMenuSelect: Obsolete, no more Carbon!"); } @@ -380,7 +388,7 @@ TkMacOSXHandleMenuSelect( void TkMacOSXInitMenus( - Tcl_Interp *interp) + TCL_UNUSED(Tcl_Interp *)) { [NSApp _setupMenus]; } diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c index b18b4ef..476056f 100644 --- a/macosx/tkMacOSXMouseEvent.c +++ b/macosx/tkMacOSXMouseEvent.c @@ -463,6 +463,9 @@ XQueryPointer( { int getGlobal = (root_x_return && root_y_return); int getLocal = (win_x_return && win_y_return && w != None); + (void)display; + (void)root_return; + (void)child_return; if (getGlobal || getLocal) { NSPoint global = [NSEvent mouseLocation]; diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 098fe4c..cac7fce 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -252,8 +252,9 @@ Tk_MacOSXSetupTkNotifier(void) static void TkMacOSXNotifyExitHandler( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { + (void)dummy; TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, @@ -285,11 +286,12 @@ TkMacOSXNotifyExitHandler( static void TkMacOSXEventsSetupProc( - ClientData clientData, + ClientData dummy, int flags) { static Bool havePeriodicEvents = NO; NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; + (void)dummy; /* * runloopMode will be nil if we are in a Tcl event loop. @@ -348,10 +350,11 @@ TkMacOSXEventsSetupProc( */ static void TkMacOSXEventsCheckProc( - ClientData clientData, + ClientData dummy, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; + (void)dummy; /* * runloopMode will be nil if we are in a Tcl event loop. diff --git a/macosx/tkMacOSXPort.h b/macosx/tkMacOSXPort.h index 96b06da..cddeede 100644 --- a/macosx/tkMacOSXPort.h +++ b/macosx/tkMacOSXPort.h @@ -1,7 +1,7 @@ /* * tkMacOSXPort.h -- * - * This file is included by all of the Tk C files. It contains + * This file is included by all of the Tk C files. It contains * information that may be configuration-dependent, such as * #includes for system include files and a few other things. * @@ -17,14 +17,15 @@ #define _TKMACPORT #include <stdio.h> -#include <ctype.h> -#include <fcntl.h> -#include <limits.h> -#include <math.h> #include <pwd.h> -#include <stdlib.h> #include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <ctype.h> +#include <math.h> #include <string.h> +#include <limits.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H @@ -48,6 +49,9 @@ # include <inttypes.h> #endif #include <unistd.h> +#if defined(__GNUC__) && !defined(__cplusplus) +# pragma GCC diagnostic ignored "-Wc++-compat" +#endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> diff --git a/macosx/tkMacOSXScrlbr.c b/macosx/tkMacOSXScrlbr.c index dff6cc9..bf09a3f 100644 --- a/macosx/tkMacOSXScrlbr.c +++ b/macosx/tkMacOSXScrlbr.c @@ -486,6 +486,7 @@ void TkpConfigureScrollbar( TkScrollbar *scrollPtr) { + (void)scrollPtr; /* empty */ } diff --git a/macosx/tkMacOSXSend.c b/macosx/tkMacOSXSend.c index 8b65532..e96570e 100644 --- a/macosx/tkMacOSXSend.c +++ b/macosx/tkMacOSXSend.c @@ -320,7 +320,7 @@ Tk_SetAppName( int Tk_SendObjCmd( - ClientData clientData, /* Used only for deletion */ + ClientData dummy, /* Not used */ Tcl_Interp *interp, /* The interp we are sending from */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* The arguments */ @@ -332,6 +332,7 @@ Tk_SendObjCmd( RegisteredInterp *riPtr; Tcl_Obj *listObjPtr; int result = TCL_OK; + (void)dummy; for (i = 1; i < (objc - 1); ) { stringRep = Tcl_GetString(objv[i]); @@ -466,6 +467,7 @@ TkGetInterpNames( { Tcl_Obj *listObjPtr; RegisteredInterp *riPtr; + (void)tkwin; listObjPtr = Tcl_NewListObj(0, NULL); riPtr = interpListPtr; @@ -498,10 +500,9 @@ TkGetInterpNames( static int SendInit( - Tcl_Interp *interp) /* Interpreter to use for error reporting (no - * errors are ever returned, but the - * interpreter is needed anyway). */ + Tcl_Interp *dummy) /* Not used */ { + (void)dummy; return TCL_OK; } diff --git a/macosx/tkMacOSXServices.c b/macosx/tkMacOSXServices.c index e92158f..ac56279 100644 --- a/macosx/tkMacOSXServices.c +++ b/macosx/tkMacOSXServices.c @@ -24,6 +24,9 @@ ServicesEventProc( int flags) { TkMainInfo *info = TkGetMainInfoList(); + (void)event; + (void)flags; + Tcl_GlobalEval(info->interp, "::tk::mac::PerformService"); return 1; } @@ -104,6 +107,8 @@ ServicesEventProc( NSString *pboardString = nil, *pboardType = nil; NSArray *types = [pboard types]; Tcl_Event *event; + (void)data; + (void)error; /* * Get a string from the private pasteboard and copy it to the general @@ -138,8 +143,9 @@ ServicesEventProc( int TkMacOSXServices_Init( - Tcl_Interp *interp) + Tcl_Interp *dummy) { + (void)dummy; /* * Initialize an instance of TkService and register it with the NSApp. */ diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c index 5cbbbf1..b814fbc 100644 --- a/macosx/tkMacOSXSubwindows.c +++ b/macosx/tkMacOSXSubwindows.c @@ -55,6 +55,7 @@ XDestroyWindow( Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; + (void)display; /* * Remove any dangling pointers that may exist if the window we are @@ -676,6 +677,7 @@ XConfigureWindow( { MacDrawable *macWin = (MacDrawable *) w; TkWindow *winPtr = macWin->winPtr; + (void)values; display->request++; @@ -992,6 +994,7 @@ InvalViewRect( { static CGAffineTransform t; NSView *view = ref; + (void)rgn; if (!view) { return paramErr; @@ -1122,6 +1125,8 @@ void * TkMacOSXGetDrawablePort( Drawable drawable) { + (void)drawable; + return NULL; } @@ -1422,6 +1427,7 @@ Tk_GetPixmap( int depth) /* Bits per pixel for pixmap. */ { MacDrawable *macPix; + (void)d; if (display != NULL) { display->request++; diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c index c353efe..59320a0 100644 --- a/macosx/tkMacOSXTest.c +++ b/macosx/tkMacOSXTest.c @@ -145,7 +145,7 @@ TkTestLogDisplay(void) { /* ARGSUSED */ static int PressButtonObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -157,6 +157,7 @@ PressButtonObjCmd( NSArray *screens = [NSScreen screens]; CGFloat ScreenHeight = 0; enum {X=1, Y}; + (void)dummy; if (screens && [screens count]) { ScreenHeight = [[screens objectAtIndex:0] frame].size.height; diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index fe6981d..5ecadb9 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -139,6 +139,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame { + (void)window; + /* * This method needs to be implemented in order for [NSWindow isZoomed] to * give the correct answer. But it suffices to always validate every @@ -151,6 +153,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize { + (void)window; /* * We don't need to change the proposed size, but we do need to implement * this method. Otherwise the full screen window will be sized to the @@ -288,6 +291,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) applicationActivate: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -312,6 +317,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) applicationDeactivate: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -320,6 +327,9 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { + (void)sender; + (void)flag; + /* * Allowing the default response means that withdrawn windows will get * displayed on the screen with unresponsive title buttons. We don't @@ -352,6 +362,8 @@ extern NSString *NSWindowDidOrderOffScreenNotification; - (void) displayChanged: (NSNotification *) notification { + (void)notification; + #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif @@ -887,7 +899,7 @@ ExposeRestrictProc( static Tk_RestrictAction ConfigureRestrictProc( - ClientData arg, + TCL_UNUSED(void *), XEvent *eventPtr) { return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT); @@ -903,13 +915,14 @@ RedisplayView( ClientData clientdata) { NSView *view = (NSView *) clientdata; - + /* * Make sure that we are not trying to displaying a view that no longer - * exists. + * exists. Must call [NSApp windows] because [NSApp orderedWindows] excludes + * floating/utility windows and other window panels. */ - for (NSWindow *w in [NSApp orderedWindows]) { + for (NSWindow *w in [NSApp windows]) { if ([w contentView] == view) { [view setNeedsDisplay:YES]; break; @@ -923,6 +936,7 @@ RedisplayView( { const NSRect *rectsBeingDrawn; NSInteger rectsBeingDrawnCount; + (void)rect; #ifdef TK_MAC_DEBUG_DRAWING TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); @@ -1149,6 +1163,8 @@ RedisplayView( int x, y; TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); Tk_Window tkwin = (Tk_Window) winPtr; + (void)sender; + if (!winPtr){ return; } @@ -1193,6 +1209,7 @@ RedisplayView( - (void) keyDown: (NSEvent *) theEvent { + (void)theEvent; #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 4e53282..fac8e0c 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1048,7 +1048,7 @@ TkWmDeadWindow( void TkWmSetClass( - TkWindow *winPtr) /* Newly-created top-level window. */ + TCL_UNUSED(TkWindow *)) /* Newly-created top-level window. */ { return; } @@ -1235,7 +1235,7 @@ 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. */ @@ -1503,7 +1503,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. */ @@ -1575,7 +1575,7 @@ 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. */ @@ -1720,7 +1720,7 @@ 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. */ diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 77d05c3..abbfb38 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -167,7 +167,7 @@ TkMacOSXZeroScreenTop() /* *---------------------------------------------------------------------- * - * TkpOpenDisplay -- + * TkpOpenDisplay/XkbOpenDisplay -- * * Create the Display structure and fill it with device specific * information. @@ -186,11 +186,6 @@ TkpOpenDisplay( const char *display_name) { Display *display; - Screen *screen; - int fd = 0; - static NSRect maxBounds = {{0, 0}, {0, 0}}; - static char vendor[25] = ""; - NSArray *cgVers; NSAutoreleasePool *pool = [NSAutoreleasePool new]; if (gMacDisplay != NULL) { @@ -201,8 +196,49 @@ TkpOpenDisplay( } } - display = ckalloc(sizeof(Display)); - screen = ckalloc(sizeof(Screen)); + display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL); + + /* + * Initialize screen bits that may change + */ + + TkMacOSXDisplayChanged(display); + + gMacDisplay = ckalloc(sizeof(TkDisplay)); + + /* + * This is the quickest way to make sure that all the *Init flags get + * properly initialized + */ + + bzero(gMacDisplay, sizeof(TkDisplay)); + gMacDisplay->display = display; + [pool drain]; + + /* + * Key map info must be available immediately, because of "send event". + */ + TkpInitKeymapInfo(gMacDisplay); + + return gMacDisplay; +} + +Display * +XkbOpenDisplay( + TCL_UNUSED(char *), + int *ev_rtrn, + int *err_rtrn, + int *major_rtrn, + int *minor_rtrn, + int *reason) +{ + Display *display = ckalloc(sizeof(Display)); + Screen *screen = ckalloc(sizeof(Screen)); + int fd = 0; + NSArray *cgVers; + static char vendor[25] = ""; + static NSRect maxBounds = {{0, 0}, {0, 0}}; + bzero(display, sizeof(Display)); bzero(screen, sizeof(Screen)); @@ -215,6 +251,24 @@ TkpOpenDisplay( display->default_screen = 0; display->display_name = (char *) macScreenName; + /* + * These screen bits never change + */ + screen->root = ROOT_ID; + screen->display = display; + screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24; + screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; + screen->ext_data = (XExtData *) &maxBounds; + + screen->root_visual = ckalloc(sizeof(Visual)); + screen->root_visual->visualid = 0; + screen->root_visual->c_class = TrueColor; + screen->root_visual->red_mask = 0x00FF0000; + screen->root_visual->green_mask = 0x0000FF00; + screen->root_visual->blue_mask = 0x000000FF; + screen->root_visual->bits_per_rgb = 24; + screen->root_visual->map_entries = 256; + cgVers = [[[NSBundle bundleWithIdentifier:@"com.apple.CoreGraphics"] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] componentsSeparatedByString:@"."]; @@ -245,48 +299,16 @@ TkpOpenDisplay( display->release = major << 16 | minor << 8 | patch; } - /* - * These screen bits never change - */ - screen->root = ROOT_ID; - screen->display = display; - screen->black_pixel = 0x00000000 | PIXEL_MAGIC << 24; - screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; - screen->ext_data = (XExtData *) &maxBounds; - screen->root_visual = ckalloc(sizeof(Visual)); - screen->root_visual->visualid = 0; - screen->root_visual->c_class = TrueColor; - screen->root_visual->red_mask = 0x00FF0000; - screen->root_visual->green_mask = 0x0000FF00; - screen->root_visual->blue_mask = 0x000000FF; - screen->root_visual->bits_per_rgb = 24; - screen->root_visual->map_entries = 256; - - /* - * Initialize screen bits that may change - */ + if (ev_rtrn) *ev_rtrn = 0; + if (err_rtrn) *err_rtrn = 0; + if (major_rtrn) *major_rtrn = 0; + if (minor_rtrn) *minor_rtrn = 0; + if (reason) *reason = 0; - TkMacOSXDisplayChanged(display); - - gMacDisplay = ckalloc(sizeof(TkDisplay)); - - /* - * This is the quickest way to make sure that all the *Init flags get - * properly initialized - */ - - bzero(gMacDisplay, sizeof(TkDisplay)); - gMacDisplay->display = display; - [pool drain]; - - /* - * Key map info must be available immediately, because of "send event". - */ - TkpInitKeymapInfo(gMacDisplay); - - return gMacDisplay; + return display; } + /* *---------------------------------------------------------------------- @@ -387,7 +409,7 @@ TkClipCleanup( static XID MacXIdAlloc( - Display *display) /* Display for which to allocate. */ + TCL_UNUSED(Display *)) /* Display for which to allocate. */ { static long int cur_id = 100; /* @@ -417,8 +439,8 @@ MacXIdAlloc( static int DefaultErrorHandler( - Display* display, - XErrorEvent* err_evt) + TCL_UNUSED(Display *), + TCL_UNUSED(XErrorEvent *)) { /* * This call should never be called. Tk replaces it with its own error @@ -431,8 +453,8 @@ DefaultErrorHandler( char * XGetAtomName( - Display * display, - Atom atom) + Display *display, + TCL_UNUSED(Atom)) { display->request++; return NULL; @@ -440,7 +462,7 @@ XGetAtomName( XErrorHandler XSetErrorHandler( - XErrorHandler handler) + TCL_UNUSED(XErrorHandler)) { return DefaultErrorHandler; } @@ -448,7 +470,7 @@ XSetErrorHandler( Window XRootWindow( Display *display, - int screen_number) + TCL_UNUSED(int)) { display->request++; return ROOT_ID; @@ -491,14 +513,14 @@ XGetGeometry( int XChangeProperty( - Display* display, - Window w, - Atom property, - Atom type, - int format, - int mode, - _Xconst unsigned char* data, - int nelements) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Atom), + TCL_UNUSED(Atom), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(_Xconst unsigned char *), + TCL_UNUSED(int)) { Debugger(); return Success; @@ -506,9 +528,9 @@ XChangeProperty( int XSelectInput( - Display* display, - Window w, - long event_mask) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(long)) { Debugger(); return Success; @@ -516,8 +538,8 @@ XSelectInput( int XBell( - Display* display, - int percent) + TCL_UNUSED(Display *), + TCL_UNUSED(int)) { NSBeep(); return Success; @@ -526,9 +548,9 @@ XBell( #if 0 void XSetWMNormalHints( - Display* display, - Window w, - XSizeHints* hints) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(XSizeHints *)) { /* * Do nothing. Shouldn't even be called. @@ -549,7 +571,7 @@ XAllocSizeHints(void) GContext XGContextFromGC( - GC gc) + TCL_UNUSED(GC)) { /* * TODO: currently a no-op @@ -560,11 +582,11 @@ XGContextFromGC( Status XSendEvent( - Display* display, - Window w, - Bool propagate, - long event_mask, - XEvent* event_send) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Bool), + TCL_UNUSED(long), + TCL_UNUSED(XEvent *)) { Debugger(); return 0; @@ -572,8 +594,8 @@ XSendEvent( int XClearWindow( - Display* display, - Window w) + TCL_UNUSED(Display *), + TCL_UNUSED(Window)) { return Success; } @@ -605,23 +627,23 @@ XDrawPoints( int XWarpPointer( - Display* display, - Window src_w, - Window dest_w, - int src_x, - int src_y, - unsigned int src_width, - unsigned int src_height, - int dest_x, - int dest_y) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(unsigned int), + TCL_UNUSED(unsigned int), + TCL_UNUSED(int), + TCL_UNUSED(int)) { return Success; } int XQueryColor( - Display* display, - Colormap colormap, + TCL_UNUSED(Display *), + TCL_UNUSED(Colormap), XColor* def_in_out) { unsigned long p; @@ -642,96 +664,96 @@ XQueryColor( Bool XTranslateCoordinates( - Display *display, - Window src_w, - Window dest_w, - int src_x, - int src_y, - int *dest_x_return, - int *dest_y_return, - Window *child_return) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window), + TCL_UNUSED(int), + TCL_UNUSED(int), + TCL_UNUSED(int *), + TCL_UNUSED(int *), + TCL_UNUSED(Window *)) { return 0; } int XSetCommand( - Display *display, - Window w, - char **argv, - int argc) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(char **), + TCL_UNUSED(int)) { return Success; } int XGetWindowAttributes( - Display *display, - Window w, - XWindowAttributes *window_attributes_return) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(XWindowAttributes *)) { return Success; } Status XGetWMColormapWindows( - Display *display, - Window w, - Window **windows_return, - int *count_return) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window **), + TCL_UNUSED(int *)) { return Success; } int XIconifyWindow( - Display *display, - Window w, - int screen_number) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(int)) { return Success; } XHostAddress * XListHosts( - Display *display, - int *nhosts_return, - Bool *state_return) + TCL_UNUSED(Display *), + TCL_UNUSED(int *), + TCL_UNUSED(Bool *)) { return NULL; } int XLookupColor( - Display *display, - Colormap colormap, - _Xconst char *color_name, - XColor *exact_def_return, - XColor *screen_def_return) + TCL_UNUSED(Display *), + TCL_UNUSED(Colormap), + TCL_UNUSED(_Xconst char *), + TCL_UNUSED(XColor *), + TCL_UNUSED(XColor *)) { return Success; } int XNextEvent( - Display *display, - XEvent *event_return) + TCL_UNUSED(Display *), + TCL_UNUSED(XEvent *)) { return Success; } int XPutBackEvent( - Display *display, - XEvent *event) + TCL_UNUSED(Display *), + TCL_UNUSED(XEvent *)) { return Success; } int XQueryColors( - Display* display, - Colormap colormap, + TCL_UNUSED(Display *), + TCL_UNUSED(Colormap), XColor* defs_in_out, int ncolors) { @@ -755,14 +777,13 @@ XQueryColors( } int -XQueryTree(display, w, root_return, parent_return, children_return, - nchildren_return) - Display* display; - Window w; - Window* root_return; - Window* parent_return; - Window** children_return; - unsigned int* nchildren_return; +XQueryTree( + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Window *), + TCL_UNUSED(Window *), + TCL_UNUSED(Window **), + TCL_UNUSED(unsigned int *)) { return 0; } @@ -771,17 +792,17 @@ XQueryTree(display, w, root_return, parent_return, children_return, int XGetWindowProperty( Display *display, - Window w, - Atom property, - long long_offset, - long long_length, - Bool delete, - Atom req_type, + TCL_UNUSED(Window), + TCL_UNUSED(Atom), + TCL_UNUSED(long), + TCL_UNUSED(long), + TCL_UNUSED(Bool), + TCL_UNUSED(Atom), Atom *actual_type_return, int *actual_format_return, unsigned long *nitems_return, unsigned long *bytes_after_return, - unsigned char ** prop_return) + TCL_UNUSED(unsigned char **)) { display->request++; *actual_type_return = None; @@ -792,38 +813,38 @@ XGetWindowProperty( int XWindowEvent( - Display *display, - Window w, - long event_mask, - XEvent *event_return) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(long), + TCL_UNUSED(XEvent *)) { return Success; } int XWithdrawWindow( - Display *display, - Window w, - int screen_number) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(int)) { return Success; } int XmbLookupString( - XIC ic, - XKeyPressedEvent *event, - char *buffer_return, - int bytes_buffer, - KeySym *keysym_return, - Status *status_return) + TCL_UNUSED(XIC), + TCL_UNUSED(XKeyPressedEvent *), + TCL_UNUSED(char *), + TCL_UNUSED(int), + TCL_UNUSED(KeySym *), + TCL_UNUSED(Status *)) { return Success; } int XRefreshKeyboardMapping( - XMappingEvent *x) + TCL_UNUSED(XMappingEvent *)) { /* used by tkXEvent.c */ Debugger(); @@ -833,8 +854,8 @@ XRefreshKeyboardMapping( int XSetIconName( Display* display, - Window w, - const char *icon_name) + TCL_UNUSED(Window), + TCL_UNUSED(const char *)) { /* * This is a no-op, no icon name for Macs. @@ -846,7 +867,7 @@ XSetIconName( int XForceScreenSaver( Display* display, - int mode) + TCL_UNUSED(int)) { /* * This function is just a no-op. It is defined to reset the screen saver. @@ -943,64 +964,64 @@ TkGetServerInfo( int XChangeWindowAttributes( - Display *display, - Window w, - unsigned long value_mask, - XSetWindowAttributes *attributes) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long), + TCL_UNUSED(XSetWindowAttributes *)) { return Success; } int XSetWindowBackground( - Display *display, - Window window, - unsigned long value) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBackgroundPixmap( - Display *display, - Window w, - Pixmap background_pixmap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorder( - Display *display, - Window w, - unsigned long border_pixel) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned long)) { return Success; } int XSetWindowBorderPixmap( - Display *display, - Window w, - Pixmap border_pixmap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Pixmap)) { return Success; } int XSetWindowBorderWidth( - Display *display, - Window w, - unsigned int width) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(unsigned int)) { return Success; } int XSetWindowColormap( - Display *display, - Window w, - Colormap colormap) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Colormap)) { Debugger(); return Success; @@ -1008,9 +1029,9 @@ XSetWindowColormap( Status XStringListToTextProperty( - char **list, - int count, - XTextProperty *text_prop_return) + TCL_UNUSED(char **), + TCL_UNUSED(int), + TCL_UNUSED(XTextProperty *)) { Debugger(); return Success; @@ -1018,15 +1039,15 @@ XStringListToTextProperty( void XSetWMClientMachine( - Display *display, - Window w, - XTextProperty *text_prop) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(XTextProperty *)) { Debugger(); } XIC -XCreateIC(XIM xim, ...) +XCreateIC(TCL_UNUSED(XIM), ...) { Debugger(); return (XIC) 0; @@ -1034,9 +1055,9 @@ XCreateIC(XIM xim, ...) int XDeleteProperty( - Display *display, - Window w, - Atom property) + TCL_UNUSED(Display *), + TCL_UNUSED(Window), + TCL_UNUSED(Atom)) { return Success; } @@ -1044,8 +1065,8 @@ XDeleteProperty( int XGetInputFocus( Display *display, - Window *focus_return, - int *revert_to_return) + TCL_UNUSED(Window *), + TCL_UNUSED(int *)) { display->request++; return Success; @@ -1061,7 +1082,7 @@ XVisualIDFromVisual( XAfterFunction XSynchronize( Display *display, - Bool onoff) + TCL_UNUSED(Bool)) { display->request++; return NULL; @@ -1069,15 +1090,15 @@ XSynchronize( int XUngrabServer( - Display *display) + TCL_UNUSED(Display *)) { return 0; } int XFreeCursor( - Display *display, - Cursor cursor) + TCL_UNUSED(Display *), + TCL_UNUSED(Cursor)) { return Success; } @@ -1092,7 +1113,7 @@ XNoOp( int XGrabServer( - Display *display) + TCL_UNUSED(Display *)) { return 0; } @@ -1109,7 +1130,7 @@ XFree( int XFlush( - Display *display) + TCL_UNUSED(Display *)) { return 0; } @@ -1133,7 +1154,7 @@ XFlush( const char * TkGetDefaultScreenName( - Tcl_Interp *interp, /* Not used. */ + TCL_UNUSED(Tcl_Interp *), const char *screenName) /* If NULL, use default string. */ { if ((screenName == NULL) || (screenName[0] == '\0')) { @@ -1160,7 +1181,7 @@ TkGetDefaultScreenName( long Tk_GetUserInactiveTime( - Display *dpy) + TCL_UNUSED(Display *)) { io_registry_entry_t regEntry; CFMutableDictionaryRef props = NULL; @@ -1226,7 +1247,7 @@ Tk_GetUserInactiveTime( void Tk_ResetUserInactiveTime( - Display *dpy) + TCL_UNUSED(Display *)) { lastInactivityReset = TkpGetMS(); } diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 52534ce..83f48db 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -169,7 +169,7 @@ static inline CGRect BoxToRect( */ static Ttk_StateTable ThemeStateTable[] = { - {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeStateActive, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, @@ -257,6 +257,7 @@ static void GetBackgroundColor( { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *masterPtr = (TkWindow *) TkGetGeomMaster(tkwin); + (void)context; while (masterPtr && masterPtr->privatePtr) { if (masterPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { @@ -1046,6 +1047,7 @@ static void DrawDarkSeparator( NSColor *fillColor = [NSColor colorWithColorSpace: deviceRGB components: fill count:4]; + (void)tkwin; CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGContextFillRect(context, bounds); @@ -1170,6 +1172,7 @@ static void DrawDarkListHeader( { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; + (void)tkwin; CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; @@ -1231,7 +1234,7 @@ static ThemeButtonParams ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight}; static Ttk_StateTable ButtonValueTable[] = { - {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND}, + {kThemeButtonOff, TTK_STATE_ALTERNATE | TTK_STATE_BACKGROUND, 0}, {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} @@ -2089,10 +2092,10 @@ static void TrackElementDraw( { TrackElementData *data = clientData; TrackElement *elem = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; - Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); + TtkGetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); @@ -2227,10 +2230,10 @@ static void PbarElementDraw( Ttk_State state) { PbarElement *pbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL, phase = 0; double value = 0, maximum = 100, factor; - Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); + TtkGetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); @@ -2302,10 +2305,10 @@ static void TroughElementSize( Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; - Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness); if (orientation == TTK_ORIENT_HORIZONTAL) { *minHeight = thickness; @@ -2343,13 +2346,13 @@ static void TroughElementDraw( Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *troughColor; CGFloat *rgba = TkMacOSXInDarkMode(tkwin) ? darkTrough : lightTrough; - Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 0, 1); } else { @@ -2385,9 +2388,9 @@ static void ThumbElementSize( Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; - Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_VERTICAL) { *minHeight = 18; *minWidth = 8; @@ -2406,9 +2409,9 @@ static void ThumbElementDraw( Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; - int orientation = TTK_ORIENT_HORIZONTAL; + Ttk_Orient orientation = TTK_ORIENT_HORIZONTAL; - Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); + TtkGetOrientFromObj(NULL, scrollbar->orientObj, &orientation); /* * In order to make ttk scrollbars work correctly it is necessary to be diff --git a/tests/canvPs.test b/tests/canvPs.test index c7ba958..5e8a4e5 100644 --- a/tests/canvPs.test +++ b/tests/canvPs.test @@ -19,7 +19,7 @@ pack .c update test canvPs-1.1 {test writing to a file} -constraints { - unixOrPc + unixOrWin } -setup { set foo [makeFile {} foo.ps] } -body { @@ -29,7 +29,7 @@ test canvPs-1.1 {test writing to a file} -constraints { removeFile foo.ps } -result 1 test canvPs-1.2 {test writing to a file, idempotency} -constraints { - unixOrPc + unixOrWin } -setup { set foo [makeFile {} foo.ps] set bar [makeFile {} bar.ps] @@ -48,7 +48,7 @@ test canvPs-1.2 {test writing to a file, idempotency} -constraints { test canvPs-2.1 {test writing to a channel} -constraints { - unixOrPc + unixOrWin } -setup { set foo [makeFile {} foo.ps] file delete $foo @@ -62,7 +62,7 @@ test canvPs-2.1 {test writing to a channel} -constraints { removeFile foo.ps } -result 1 test canvPs-2.2 {test writing to channel, idempotency} -constraints { - unixOrPc + unixOrWin } -setup { set foo [makeFile {} foo.ps] set bar [makeFile {} bar.ps] diff --git a/tests/font.test b/tests/font.test index c918673..9f279dd 100644 --- a/tests/font.test +++ b/tests/font.test @@ -2256,7 +2256,7 @@ test font-38.10 {ParseFontNameObj procedure: arguments} -body { font actual {times xyz xyz} } -returnCodes error -result {expected integer but got "xyz"} test font-38.11 {ParseFontNameObj procedure: stylelist loop} -constraints { - unixOrPc + unixOrWin } -body { lrange [font actual {times 12 bold italic overstrike underline}] 4 end } -result {-weight bold -slant italic -underline 1 -overstrike 1} diff --git a/tests/scrollbar.test b/tests/scrollbar.test index 8a9d2c4..e02e3a8 100644 --- a/tests/scrollbar.test +++ b/tests/scrollbar.test @@ -714,7 +714,7 @@ test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -set destroy .t .s } -result {5.0} -test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup { +test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top @@ -728,7 +728,7 @@ test scrollbar-10.2.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} - } -cleanup { destroy .t .s } -result {1.4} -test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup { +test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup { destroy .t .s } -body { pack [text .t -xscrollcommand {.s set} -wrap none] -side top @@ -742,6 +742,34 @@ test scrollbar-10.2.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -set } -cleanup { destroy .t .s } -result {1.4} +test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} +test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <MouseWheel> -delta -4 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body { proc destroy_scrollbar {} { diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index 0743def..443687a 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -70,6 +70,92 @@ test scrollbar-1.3 "Change orientation" -body { expr {$h < $w} } -result 1 +test scrollbar-10.1.1 {<MouseWheel> event on scrollbar} -constraints {notAqua} -setup { + destroy .t .s +} -body { + pack [text .t -yscrollcommand {.s set}] -side left + for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} + pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left + update + focus -force .s + event generate .s <MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {5.0} +test scrollbar-10.1.2 {<MouseWheel> event on scrollbar} -constraints {aqua} -setup { + destroy .t .s +} -body { + pack [text .t -yscrollcommand {.s set}] -side left + for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} + pack [ttk::scrollbar .s -command {.t yview}] -fill y -expand 1 -side left + update + focus -force .s + event generate .s <MouseWheel> -delta -4 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {5.0} + +test scrollbar-10.2.1 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <Shift-MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} +test scrollbar-10.2.2 {<Shift-MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <Shift-MouseWheel> -delta -4 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} +test scrollbar-10.2.3 {<MouseWheel> event on horizontal scrollbar} -constraints {notAqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <MouseWheel> -delta -120 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} +test scrollbar-10.2.4 {<MouseWheel> event on horizontal scrollbar} -constraints {aqua} -setup { + destroy .t .s +} -body { + pack [text .t -xscrollcommand {.s set} -wrap none] -side top + for {set i 1} {$i < 100} {incr i} {.t insert end "Char $i "} + pack [ttk::scrollbar .s -command {.t xview} -orient horizontal] -fill x -expand 1 -side top + update + focus -force .s + event generate .s <MouseWheel> -delta -4 + after 200 {set eventprocessed 1} ; vwait eventprocessed + .t index @0,0 +} -cleanup { + destroy .t .s +} -result {1.4} + # # Scale tests: # diff --git a/unix/configure b/unix/configure index f05e8f8..839f170 100755 --- a/unix/configure +++ b/unix/configure @@ -4239,7 +4239,15 @@ fi if test "$GCC" = yes; then : CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith" + case "${CC}" in + *++) + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement" + ;; + esac + else @@ -7808,130 +7816,6 @@ $as_echo "#define HAVE_XFT 1" >>confdefs.h fi #-------------------------------------------------------------------- -# Check for XkbKeycodeToKeysym. -#-------------------------------------------------------------------- - -if test $tk_aqua = no; then - tk_oldCFlags=$CFLAGS - tk_oldLibs=$LIBS - CFLAGS="$CFLAGS $XINCLUDES" - LIBS="$LIBS $XLIBSW" - ac_fn_c_check_header_compile "$LINENO" "X11/XKBlib.h" "ac_cv_header_X11_XKBlib_h" "#include <X11/Xlib.h> -" -if test "x$ac_cv_header_X11_XKBlib_h" = xyes; then : - - xkblib_header_found=yes - -else - - xkblib_header_found=no - -fi - - - if test $xkblib_header_found = "yes" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XkbKeycodeToKeysym in -lX11" >&5 -$as_echo_n "checking for XkbKeycodeToKeysym in -lX11... " >&6; } -if ${ac_cv_lib_X11_XkbKeycodeToKeysym+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lX11 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char XkbKeycodeToKeysym (); -int -main () -{ -return XkbKeycodeToKeysym (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_X11_XkbKeycodeToKeysym=yes -else - ac_cv_lib_X11_XkbKeycodeToKeysym=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_XkbKeycodeToKeysym" >&5 -$as_echo "$ac_cv_lib_X11_XkbKeycodeToKeysym" >&6; } -if test "x$ac_cv_lib_X11_XkbKeycodeToKeysym" = xyes; then : - - xkbkeycodetokeysym_found=yes - -else - - xkbkeycodetokeysym_found=no - -fi - - else - xkbkeycodetokeysym_found=no - fi - if test $xkbkeycodetokeysym_found = "yes" ; then - -$as_echo "#define HAVE_XKBKEYCODETOKEYSYM 1" >>confdefs.h - - fi - CFLAGS=$tk_oldCFlags - LIBS=$tk_oldLibs -fi - -#-------------------------------------------------------------------- -# Check whether XKeycodeToKeysym is deprecated in X11 headers. -#-------------------------------------------------------------------- - -if test $tk_aqua = no && test "$GCC" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether XKeycodeToKeysym is deprecated" >&5 -$as_echo_n "checking whether XKeycodeToKeysym is deprecated... " >&6; } - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS -Werror" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include <X11/Xlib.h> - -int -main () -{ - - XKeycodeToKeysym(0,0,0); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define XKEYCODETOKEYSYM_IS_DEPRECATED 1" >>confdefs.h - - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CFLAGS=$tk_oldCFlags -fi - -#-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # diff --git a/unix/configure.ac b/unix/configure.ac index d7e1c2c..b765f13 100644 --- a/unix/configure.ac +++ b/unix/configure.ac @@ -520,57 +520,6 @@ if test $tk_aqua = no; then fi #-------------------------------------------------------------------- -# Check for XkbKeycodeToKeysym. -#-------------------------------------------------------------------- - -if test $tk_aqua = no; then - tk_oldCFlags=$CFLAGS - tk_oldLibs=$LIBS - CFLAGS="$CFLAGS $XINCLUDES" - LIBS="$LIBS $XLIBSW" - AC_CHECK_HEADER(X11/XKBlib.h, [ - xkblib_header_found=yes - ], [ - xkblib_header_found=no - ], [#include <X11/Xlib.h>]) - if test $xkblib_header_found = "yes" ; then - AC_CHECK_LIB(X11, XkbKeycodeToKeysym, [ - xkbkeycodetokeysym_found=yes - ], [ - xkbkeycodetokeysym_found=no - ]) - else - xkbkeycodetokeysym_found=no - fi - if test $xkbkeycodetokeysym_found = "yes" ; then - AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?]) - fi - CFLAGS=$tk_oldCFlags - LIBS=$tk_oldLibs -fi - -#-------------------------------------------------------------------- -# Check whether XKeycodeToKeysym is deprecated in X11 headers. -#-------------------------------------------------------------------- - -if test $tk_aqua = no && test "$GCC" = yes; then - AC_MSG_CHECKING([whether XKeycodeToKeysym is deprecated]) - tk_oldCFlags=$CFLAGS - CFLAGS="$CFLAGS -Werror" - AC_TRY_LINK([ - #include <X11/Xlib.h> - ], [ - XKeycodeToKeysym(0,0,0); - ], [ - AC_MSG_RESULT([no]) - ], [ - AC_MSG_RESULT([yes]) - AC_DEFINE(XKEYCODETOKEYSYM_IS_DEPRECATED, 1, [Is XKeycodeToKeysym deprecated?]) - ]) - CFLAGS=$tk_oldCFlags -fi - -#-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 2547d1e..271bd03 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -966,7 +966,15 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith" + case "${CC}" in + *++) + ;; + *) + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement" + ;; + esac + ], [ CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" diff --git a/unix/tkAppInit.c b/unix/tkAppInit.c index 91dcba7..9e6c112 100644 --- a/unix/tkAppInit.c +++ b/unix/tkAppInit.c @@ -17,7 +17,13 @@ #include "tk.h" #ifdef TK_TEST +#ifdef __cplusplus +extern "C" { +#endif extern Tcl_PackageInitProc Tktest_Init; +#ifdef __cplusplus +} +#endif #endif /* TK_TEST */ /* diff --git a/unix/tkConfig.h.in b/unix/tkConfig.h.in index c435f7c..6753fb5 100644 --- a/unix/tkConfig.h.in +++ b/unix/tkConfig.h.in @@ -91,9 +91,6 @@ /* Have we turned on XFT (antialiased fonts)? */ #undef HAVE_XFT -/* Do we have XkbKeycodeToKeysym? */ -#undef HAVE_XKBKEYCODETOKEYSYM - /* Is XScreenSaver available? */ #undef HAVE_XSS @@ -182,9 +179,6 @@ first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN -/* Is XKeycodeToKeysym deprecated? */ -#undef XKEYCODETOKEYSYM_IS_DEPRECATED - /* Are Darwin SUSv3 extensions available? */ #undef _DARWIN_C_SOURCE diff --git a/unix/tkUnix.c b/unix/tkUnix.c index c6fff82..df70cb0 100644 --- a/unix/tkUnix.c +++ b/unix/tkUnix.c @@ -108,6 +108,11 @@ Tk_UpdatePointer( int x, int y, /* Pointer location in root coords. */ int state) /* Modifier state mask. */ { + (void)tkwin; + (void)x; + (void)y; + (void)state; + /* * This function intentionally left blank */ diff --git a/unix/tkUnix3d.c b/unix/tkUnix3d.c index 7ea67a1..dfa08fb 100644 --- a/unix/tkUnix3d.c +++ b/unix/tkUnix3d.c @@ -46,7 +46,7 @@ typedef struct { TkBorder * TkpGetBorder(void) { - UnixBorder *borderPtr = ckalloc(sizeof(UnixBorder)); + UnixBorder *borderPtr = (UnixBorder *)ckalloc(sizeof(UnixBorder)); borderPtr->solidGC = NULL; return (TkBorder *) borderPtr; diff --git a/unix/tkUnixButton.c b/unix/tkUnixButton.c index 24ac8cc..8d13db7 100644 --- a/unix/tkUnixButton.c +++ b/unix/tkUnixButton.c @@ -173,7 +173,7 @@ TkpDrawCheckIndicator( * Sanity check. */ - if (tkwin == NULL || display == None || d == None || bgBorder == NULL + if (tkwin == NULL || display == NULL || d == None || bgBorder == NULL || indicatorColor == NULL) { return; } @@ -328,9 +328,9 @@ TkButton * TkpCreateButton( Tk_Window tkwin) { - UnixButton *butPtr = ckalloc(sizeof(UnixButton)); + (void)tkwin; - return (TkButton *) butPtr; + return (TkButton *)ckalloc(sizeof(UnixButton)); } /* @@ -396,7 +396,7 @@ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/unix/tkUnixColor.c b/unix/tkUnixColor.c index 96e8937..a909fb3 100644 --- a/unix/tkUnixColor.c +++ b/unix/tkUnixColor.c @@ -185,7 +185,7 @@ TkpGetColor( } } - tkColPtr = ckalloc(sizeof(TkColor)); + tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->color = color; return tkColPtr; @@ -220,7 +220,7 @@ TkpGetColorByValue( { Display *display = Tk_Display(tkwin); Colormap colormap = Tk_Colormap(tkwin); - TkColor *tkColPtr = ckalloc(sizeof(TkColor)); + TkColor *tkColPtr = (TkColor *)ckalloc(sizeof(TkColor)); tkColPtr->color.red = colorPtr->red; tkColPtr->color.green = colorPtr->green; @@ -269,7 +269,7 @@ FindClosestColor( XColor *colorPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; Colormap colormap = Tk_Colormap(tkwin); - XVisualInfo template, *visInfoPtr; + XVisualInfo templ, *visInfoPtr; /* * Find the TkStressedCmap structure for this colormap, or create a new @@ -278,19 +278,19 @@ FindClosestColor( for (stressPtr = dispPtr->stressPtr; ; stressPtr = stressPtr->nextPtr) { if (stressPtr == NULL) { - stressPtr = ckalloc(sizeof(TkStressedCmap)); + stressPtr = (TkStressedCmap *)ckalloc(sizeof(TkStressedCmap)); stressPtr->colormap = colormap; - template.visualid = XVisualIDFromVisual(Tk_Visual(tkwin)); + templ.visualid = XVisualIDFromVisual(Tk_Visual(tkwin)); visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), - VisualIDMask, &template, &numFound); + VisualIDMask, &templ, &numFound); if (numFound < 1) { Tcl_Panic("FindClosestColor couldn't lookup visual"); } stressPtr->numColors = visInfoPtr->colormap_size; XFree((char *) visInfoPtr); - stressPtr->colorPtr = + stressPtr->colorPtr = (XColor *) ckalloc(stressPtr->numColors * sizeof(XColor)); for (i = 0; i < stressPtr->numColors; i++) { stressPtr->colorPtr[i].pixel = (unsigned long) i; diff --git a/unix/tkUnixConfig.c b/unix/tkUnixConfig.c index 3584494..acd8bb5 100644 --- a/unix/tkUnixConfig.c +++ b/unix/tkUnixConfig.c @@ -38,6 +38,10 @@ TkpGetSystemDefault( const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { + (void)tkwin; + (void)dbName; + (void)className; + return NULL; } diff --git a/unix/tkUnixCursor.c b/unix/tkUnixCursor.c index 4c58adf..bcd7cc3 100644 --- a/unix/tkUnixCursor.c +++ b/unix/tkUnixCursor.c @@ -338,7 +338,7 @@ TkGetCursorByName( } if (cursor != None) { - cursorPtr = ckalloc(sizeof(TkUnixCursor)); + cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursor; cursorPtr->display = display; } @@ -608,7 +608,7 @@ TkCreateCursorFromData( Tk_FreePixmap(display, maskPixmap); if (cursor != None) { - cursorPtr = ckalloc(sizeof(TkUnixCursor)); + cursorPtr = (TkUnixCursor *)ckalloc(sizeof(TkUnixCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursor; cursorPtr->display = display; } diff --git a/unix/tkUnixDraw.c b/unix/tkUnixDraw.c index e6886e8..fec05ee 100644 --- a/unix/tkUnixDraw.c +++ b/unix/tkUnixDraw.c @@ -202,6 +202,8 @@ TkpDrawHighlightBorder( int highlightWidth, Drawable drawable) { + (void)bgGC; + TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index 5653b75..d4654a8 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -106,7 +106,7 @@ TkpUseWindow( Tk_ErrorHandler handler; Container *containerPtr; XWindowAttributes parentAtts; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window != None) { @@ -178,7 +178,7 @@ TkpUseWindow( } } if (containerPtr == NULL) { - containerPtr = ckalloc(sizeof(Container)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->parent = parent; containerPtr->parentRoot = parentAtts.root; containerPtr->parentPtr = NULL; @@ -216,7 +216,7 @@ TkpMakeWindow( * the window is to be created. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->flags & TK_EMBEDDED) { @@ -272,7 +272,7 @@ TkpMakeContainer( { TkWindow *winPtr = (TkWindow *) tkwin; Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -281,7 +281,7 @@ TkpMakeContainer( */ Tk_MakeWindowExist(tkwin); - containerPtr = ckalloc(sizeof(Container)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->parent = Tk_WindowId(tkwin); containerPtr->parentRoot = RootWindowOfScreen(Tk_Screen(tkwin)); containerPtr->parentPtr = winPtr; @@ -332,7 +332,8 @@ EmbedErrorProc( XErrorEvent *errEventPtr) /* Points to information about error (not * used). */ { - int *iPtr = clientData; + int *iPtr = (int *)clientData; + (void)errEventPtr; *iPtr = 1; return 0; @@ -362,7 +363,7 @@ EmbeddedEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { EmbedWindowDeleted(winPtr); @@ -394,10 +395,10 @@ ContainerEventProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; Container *containerPtr; Tk_ErrorHandler errHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -499,7 +500,7 @@ EmbedStructureProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { @@ -507,7 +508,7 @@ EmbedStructureProc( * Send a ConfigureNotify to the embedded application. */ - if (containerPtr->embeddedPtr != None) { + if (containerPtr->embeddedPtr != NULL) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->wrapper != None) { @@ -554,7 +555,7 @@ EmbedFocusProc( ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { - Container *containerPtr = clientData; + Container *containerPtr = (Container *)clientData; Tk_ErrorHandler errHandler; Display *display; @@ -712,7 +713,7 @@ TkpGetOtherWindow( * window. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; @@ -758,7 +759,7 @@ TkpRedirectKeyEvent( { Container *containerPtr; Window saved; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -830,7 +831,7 @@ TkpClaimFocus( { XEvent event; Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!(topLevelPtr->flags & TK_EMBEDDED)) { @@ -872,7 +873,7 @@ TkpClaimFocus( int TkpTestembedCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -882,8 +883,9 @@ TkpTestembedCmd( Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; @@ -967,7 +969,7 @@ EmbedWindowDeleted( * deleted. */ { Container *containerPtr, *prevPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1025,7 +1027,7 @@ TkUnixContainerId( TkWindow *winPtr) /* Tk's structure for an embedded window. */ { Container *containerPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (containerPtr = tsdPtr->firstContainerPtr; @@ -1178,6 +1180,7 @@ TkpCreateBusy( { Window root, parent, *dummy; unsigned int count; + (void)busy; if (winPtr->flags & TK_REPARENTED) { /* diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 2e2b41b..5b33308 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -12,11 +12,7 @@ #include "tkUnixInt.h" #include <signal.h> -#ifdef HAVE_XKBKEYCODETOKEYSYM -# include <X11/XKBlib.h> -#else -# define XkbOpenDisplay(D,V,E,M,m,R) ((V),(E),(M),(m),(R),(NULL)) -#endif +#include <X11/XKBlib.h> /* * The following static indicates whether this module has been initialized in @@ -92,10 +88,11 @@ TkCreateXEventSource(void) static void DisplayExitHandler( - ClientData clientData) /* Not used. */ + ClientData dummy) /* Not used. */ { ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; Tcl_DeleteEventSource(DisplaySetupProc, DisplayCheckProc, NULL); tsdPtr->initialized = 0; @@ -130,7 +127,7 @@ TkpOpenDisplay( int minor = 0; int reason = 0; /* Disabled, until we have a better test. See [Bug 3613668] */ -#if 0 && defined(XKEYCODETOKEYSYM_IS_DEPRECATED) +#if 0 static int xinited = 0; static Tcl_Mutex xinitMutex = NULL; @@ -163,17 +160,9 @@ TkpOpenDisplay( &minor, &reason); if (display == NULL) { - /*fprintf(stderr,"event=%d error=%d major=%d minor=%d reason=%d\nDisabling xkb\n", - event, error, major, minor, reason);*/ - display = XOpenDisplay(displayNameStr); - } else { - /*fprintf(stderr, "Using xkb %d.%d\n", major, minor);*/ - } - - if (display == NULL) { return NULL; } - dispPtr = ckalloc(sizeof(TkDisplay)); + dispPtr = (TkDisplay *)ckalloc(sizeof(TkDisplay)); memset(dispPtr, 0, sizeof(TkDisplay)); dispPtr->display = display; #ifdef TK_USE_INPUT_METHODS @@ -308,11 +297,12 @@ TkClipCleanup( static void DisplaySetupProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; static Tcl_Time blockTime = { 0, 0 }; + (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { return; @@ -440,10 +430,11 @@ TransferXEventsToTcl( static void DisplayCheckProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ int flags) { TkDisplay *dispPtr; + (void)dummy; if (!(flags & TCL_WINDOW_EVENTS)) { return; @@ -478,9 +469,10 @@ DisplayFileProc( ClientData clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { - TkDisplay *dispPtr = clientData; + TkDisplay *dispPtr = (TkDisplay *)clientData; Display *display = dispPtr->display; int numFound; + (void)flags; XFlush(display); numFound = XEventsQueued(display, QueuedAfterReading); @@ -505,9 +497,9 @@ DisplayFileProc( * nice (?!) message. */ - void (*oldHandler)(); + void (*oldHandler)(int); - oldHandler = (void (*)()) signal(SIGPIPE, SIG_IGN); + oldHandler = (void (*)(int)) signal(SIGPIPE, SIG_IGN); XNoOp(display); XFlush(display); (void) signal(SIGPIPE, oldHandler); @@ -691,6 +683,8 @@ InstantiateIMCallback( XPointer call_data) { TkDisplay *dispPtr; + (void)display; + (void)call_data; dispPtr = (TkDisplay *) client_data; OpenIM(dispPtr); @@ -705,6 +699,8 @@ DestroyIMCallback( XPointer call_data) { TkDisplay *dispPtr; + (void)im; + (void)call_data; dispPtr = (TkDisplay *) client_data; dispPtr->inputMethod = NULL; diff --git a/unix/tkUnixFont.c b/unix/tkUnixFont.c index 610342e..c1e9264 100644 --- a/unix/tkUnixFont.c +++ b/unix/tkUnixFont.c @@ -266,10 +266,11 @@ static int UtfToUcs2beProc(ClientData clientData, const char*src, static void FontPkgCleanup( - ClientData clientData) + ClientData dummy) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; if (tsdPtr->controlFamily.encoding != NULL) { FontFamily *familyPtr = &tsdPtr->controlFamily; @@ -307,11 +308,12 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; Tcl_Encoding ucs2; + (void)mainPtr; if (tsdPtr->controlFamily.encoding == NULL) { @@ -361,7 +363,7 @@ TkpFontPkgInit( static int ControlUtfProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -394,6 +396,9 @@ ControlUtfProc( 0, 0, 0, 0, 0, 0, 0, 'a', 'b', 't', 'n', 'v', 'f', 'r' }; + (void)dummy; + (void)flags; + (void)statePtr; result = TCL_OK; @@ -459,7 +464,7 @@ ControlUtfProc( static int Ucs2beToUtfProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ const char *src, /* Source string in Unicode. */ int srcLen, /* Source string length in bytes. */ int flags, /* Conversion control flags. */ @@ -488,6 +493,8 @@ Ucs2beToUtfProc( const char *dstEnd, *dstStart; int result, numChars, charLimit = INT_MAX; unsigned short ch; + (void)dummy; + (void)statePtr; if (flags & TCL_ENCODING_CHAR_LIMIT) { charLimit = *dstCharsPtr; @@ -555,7 +562,7 @@ Ucs2beToUtfProc( static int UtfToUcs2beProc( - ClientData clientData, /* TableEncodingData that specifies + ClientData dummy, /* TableEncodingData that specifies * encoding. */ const char *src, /* Source string in UTF-8. */ int srcLen, /* Source string length in bytes. */ @@ -584,6 +591,8 @@ UtfToUcs2beProc( const char *srcStart, *srcEnd, *srcClose, *dstStart, *dstEnd; int result, numChars; int ch; + (void)dummy; + (void)statePtr; srcStart = src; srcEnd = src + srcLen; @@ -719,7 +728,7 @@ TkpGetNativeFont( } fontStructPtr = CreateClosestFont(tkwin, &fa.fa, &fa.xa); } - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); InitFont(tkwin, fontStructPtr, fontPtr); return (TkFont *) fontPtr; @@ -775,7 +784,7 @@ TkpGetFontFromAttributes( fontPtr = (UnixFont *) tkFontPtr; if (fontPtr == NULL) { - fontPtr = ckalloc(sizeof(UnixFont)); + fontPtr = (UnixFont *)ckalloc(sizeof(UnixFont)); } else { ReleaseFont(fontPtr); } @@ -838,8 +847,8 @@ TkpGetFontFamilies( Tcl_Interp *interp, /* Interp to hold result. */ Tk_Window tkwin) /* For display to query. */ { - int i, new, numNames; - const char *family, **nameList; + int i, isNew, numNames; + char *family, **nameList; Tcl_HashTable familyTable; Tcl_HashEntry *hPtr; Tcl_HashSearch search; @@ -848,7 +857,7 @@ TkpGetFontFamilies( Tcl_InitHashTable(&familyTable, TCL_STRING_KEYS); nameList = ListFonts(Tk_Display(tkwin), "*", &numNames); for (i = 0; i < numNames; i++) { - const char *familyEnd; + char *familyEnd; family = strchr(nameList[i] + 1, '-'); if (family == NULL) { @@ -867,14 +876,14 @@ TkpGetFontFamilies( continue; /* See comment above. */ } *familyEnd = '\0'; - Tcl_CreateHashEntry(&familyTable, family, &new); + Tcl_CreateHashEntry(&familyTable, family, &isNew); } XFreeFontNames(nameList); hPtr = Tcl_FirstHashEntry(&familyTable, &search); resultPtr = Tcl_NewObj(); while (hPtr != NULL) { - strPtr = Tcl_NewStringObj(Tcl_GetHashKey(&familyTable, hPtr), -1); + strPtr = Tcl_NewStringObj((const char *)Tcl_GetHashKey(&familyTable, hPtr), -1); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); hPtr = Tcl_NextHashEntry(&search); } @@ -1574,7 +1583,7 @@ InitFont( UnixFont *fontPtr) /* Filled with information constructed from * the above arguments. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); unsigned long value; int minHi, maxHi, minLo, maxLo, fixed, width, limit, i, n; @@ -1827,8 +1836,9 @@ AllocFontFamily( FontFamily *familyPtr; FontAttributes fa; Tcl_Encoding encoding; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)base; GetFontAttributes(display, fontStructPtr, &fa); encoding = Tcl_GetEncoding(NULL, GetEncodingAlias(fa.xa.charset)); @@ -1846,7 +1856,7 @@ AllocFontFamily( } } - familyPtr = ckalloc(sizeof(FontFamily)); + familyPtr = (FontFamily *)ckalloc(sizeof(FontFamily)); memset(familyPtr, 0, sizeof(FontFamily)); familyPtr->nextPtr = tsdPtr->fontFamilyList; tsdPtr->fontFamilyList = familyPtr; @@ -1903,7 +1913,7 @@ FreeFontFamily( FontFamily *familyPtr) /* The FontFamily to delete. */ { FontFamily **familyPtrPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; @@ -2216,10 +2226,10 @@ FontMapLoadPage( Tcl_Encoding encoding; XFontStruct *fontStructPtr; XCharStruct *widths; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8); + subFontPtr->fontMap[row] = (char *)ckalloc(FONTMAP_BITSPERPAGE / 8); memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8); if (subFontPtr->familyPtr == &tsdPtr->controlFamily) { @@ -2551,7 +2561,7 @@ CanUseFallback( * make a copy. */ - nameList = ckalloc(numNames * sizeof(char *)); + nameList = (char **)ckalloc(numNames * sizeof(char *)); memcpy(nameList, nameListOrig, numNames * sizeof(char *)); } nameList[nameIdx] = NULL; @@ -2596,7 +2606,7 @@ CanUseFallback( if (fontPtr->numSubFonts >= SUBFONT_SPACE) { SubFont *newPtr; - newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); + newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fixSubFontPtrPtr != NULL) { diff --git a/unix/tkUnixInit.c b/unix/tkUnixInit.c index b0aa2fa..0965c01 100644 --- a/unix/tkUnixInit.c +++ b/unix/tkUnixInit.c @@ -14,7 +14,7 @@ #ifdef HAVE_COREFOUNDATION static int GetLibraryPath(Tcl_Interp *interp); #else -#define GetLibraryPath(dummy) (void)0 +#define GetLibraryPath(dummy) (void)dummy #endif /* HAVE_COREFOUNDATION */ /* diff --git a/unix/tkUnixKey.c b/unix/tkUnixKey.c index 77db78e..1ae8dc5 100644 --- a/unix/tkUnixKey.c +++ b/unix/tkUnixKey.c @@ -12,11 +12,7 @@ #include "tkInt.h" -#ifdef HAVE_XKBKEYCODETOKEYSYM -# include <X11/XKBlib.h> -#else -# define XkbKeycodeToKeysym(D,K,G,L) XKeycodeToKeysym(D,K,L) -#endif +#include <X11/XKBlib.h> /* * Prototypes for local functions defined in this file: @@ -129,8 +125,7 @@ TkpGetString( #ifdef TK_USE_INPUT_METHODS if ((winPtr->dispPtr->flags & TK_DISPLAY_USE_IM) - && (winPtr->inputContext != NULL) - && (eventPtr->type == KeyPress)) { + && (winPtr->inputContext != NULL)) { Status status; #if X_HAVE_UTF8_STRING @@ -185,8 +180,7 @@ TkpGetString( { /* * Fall back to convert a keyboard event to a UTF-8 string using - * XLookupString. This is used when input methods are turned off and - * for KeyRelease events. + * XLookupString. This is used when input methods are turned off. * * Note: XLookupString() normally returns a single ISO Latin 1 or * ASCII control character. @@ -220,7 +214,7 @@ TkpGetString( */ done: - kePtr->charValuePtr = ckalloc(len + 1); + kePtr->charValuePtr = (char *)ckalloc(len + 1); kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), len + 1); return Tcl_DStringValue(dsPtr); @@ -477,7 +471,7 @@ TkpInitKeymapInfo( } dispPtr->numModKeyCodes = 0; arraySize = KEYCODE_ARRAY_SIZE; - dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); + dispPtr->modKeyCodes = (KeyCode *)ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; @@ -504,7 +498,7 @@ TkpInitKeymapInfo( */ arraySize *= 2; - newCodes = ckalloc(arraySize * sizeof(KeyCode)); + newCodes = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode)); memcpy(newCodes, dispPtr->modKeyCodes, dispPtr->numModKeyCodes * sizeof(KeyCode)); ckfree(dispPtr->modKeyCodes); diff --git a/unix/tkUnixMenu.c b/unix/tkUnixMenu.c index 6abb2fd..095af3b 100644 --- a/unix/tkUnixMenu.c +++ b/unix/tkUnixMenu.c @@ -147,6 +147,8 @@ void TkpDestroyMenu( TkMenu *menuPtr) { + (void)menuPtr; + /* * Nothing to do. */ @@ -173,6 +175,8 @@ void TkpDestroyMenuEntry( TkMenuEntry *mEntryPtr) { + (void)mEntryPtr; + /* * Nothing to do. */ @@ -241,6 +245,8 @@ int TkpMenuNewEntry( TkMenuEntry *mePtr) { + (void)mePtr; + return TCL_OK; } @@ -296,6 +302,10 @@ TkpSetMainMenubar( Tk_Window tkwin, const char *menuName) { + (void)interp; + (void)tkwin; + (void)menuName; + /* * Nothing to do. */ @@ -329,6 +339,8 @@ GetMenuIndicatorGeometry( int *heightPtr) /* The resulting height */ { int borderWidth; + (void)tkfont; + (void)fmPtr; if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { @@ -560,6 +572,10 @@ DrawMenuEntryIndicator( int width, /* Width of menu entry */ int height) /* Height of menu entry */ { + (void)tkfont; + (void)fmPtr; + (void)width; + /* * Draw check-button indicator. */ @@ -632,6 +648,10 @@ DrawMenuSeparator( { XPoint points[2]; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType == MENUBAR) { return; @@ -789,7 +809,7 @@ DrawMenuEntryLabel( imageHeight, d, leftEdge + imageXOffset, (int) (y + (mePtr->height-imageHeight)/2 + imageYOffset)); } - } else if (mePtr->bitmapPtr != None) { + } else if (mePtr->bitmapPtr != NULL) { Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr); XCopyPlane(menuPtr->display, bitmap, d, gc, 0, 0, @@ -817,7 +837,7 @@ DrawMenuEntryLabel( XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) - && (menuPtr->disabledImageGC != None)) { + && (menuPtr->disabledImageGC != NULL)) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), @@ -853,6 +873,8 @@ DrawMenuUnderline( int x, int y, int width, int height) { + (void)width; + if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -930,13 +952,14 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + Tcl_Interp *dummy, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; + (void)dummy; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; @@ -1027,6 +1050,10 @@ GetMenuSeparatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)mePtr; + (void)tkfont; + *widthPtr = 0; *heightPtr = fmPtr->linespace; } @@ -1056,6 +1083,8 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)mePtr; + if (menuPtr->menuType != MASTER_MENU) { *heightPtr = 0; *widthPtr = 0; @@ -1279,6 +1308,10 @@ DrawTearoffEntry( XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType != MASTER_MENU) { return; @@ -1327,6 +1360,9 @@ TkpInitializeMenuBindings( Tk_BindingTable bindingTable) /* The table to add to. */ { + (void)interp; + (void)bindingTable; + /* * Nothing to do. */ @@ -1375,7 +1411,7 @@ SetHelpMenu( && (cascadeEntryPtr->menuPtr->masterMenuPtr->tkwin != NULL) && (menuPtr->masterMenuPtr->tkwin != NULL)) { TkMenu *masterMenuPtr = cascadeEntryPtr->menuPtr->masterMenuPtr; - char *helpMenuName = ckalloc(strlen(Tk_PathName( + char *helpMenuName = (char *)ckalloc(strlen(Tk_PathName( masterMenuPtr->tkwin)) + strlen(".help") + 1); strcpy(helpMenuName, Tk_PathName(masterMenuPtr->tkwin)); @@ -1851,9 +1887,12 @@ TkpComputeStandardMenuGeometry( void TkpMenuNotifyToplevelCreate( - Tcl_Interp *interp, /* The interp the menu lives in. */ + Tcl_Interp *dummy, /* The interp the menu lives in. */ const char *menuName) /* The name of the menu to reconfigure. */ { + (void)dummy; + (void)menuName; + /* * Nothing to do. */ diff --git a/unix/tkUnixMenubu.c b/unix/tkUnixMenubu.c index eb0af47..407dc30 100644 --- a/unix/tkUnixMenubu.c +++ b/unix/tkUnixMenubu.c @@ -34,7 +34,9 @@ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { - return ckalloc(sizeof(TkMenuButton)); + (void)tkwin; + + return (TkMenuButton *)ckalloc(sizeof(TkMenuButton)); } /* @@ -58,7 +60,7 @@ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { - TkMenuButton *mbPtr = clientData; + TkMenuButton *mbPtr = (TkMenuButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; @@ -321,6 +323,7 @@ void TkpDestroyMenuButton( TkMenuButton *mbPtr) { + (void)mbPtr; } /* diff --git a/unix/tkUnixPort.h b/unix/tkUnixPort.h index f51f1e7..fae2f16 100644 --- a/unix/tkUnixPort.h +++ b/unix/tkUnixPort.h @@ -18,14 +18,15 @@ #define __UNIX__ 1 #include <stdio.h> -#include <ctype.h> -#include <fcntl.h> -#include <limits.h> -#include <math.h> #include <pwd.h> -#include <stdlib.h> #include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <ctype.h> +#include <math.h> #include <string.h> +#include <limits.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H @@ -40,15 +41,18 @@ # include <time.h> #else # if HAVE_SYS_TIME_H -# include <sys/time.h> +# include <sys/time.h> # else -# include <time.h> +# include <time.h> # endif #endif #if HAVE_INTTYPES_H # include <inttypes.h> #endif #include <unistd.h> +#if defined(__GNUC__) && !defined(__cplusplus) +# pragma GCC diagnostic ignored "-Wc++-compat" +#endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c index b27e3f2..e86d959 100644 --- a/unix/tkUnixRFont.c +++ b/unix/tkUnixRFont.c @@ -87,6 +87,7 @@ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { + (void)mainPtr; } static XftFont * @@ -272,7 +273,7 @@ InitFont( int i, iWidth; if (!fontPtr) { - fontPtr = ckalloc(sizeof(UnixFtFont)); + fontPtr = (UnixFtFont *)ckalloc(sizeof(UnixFtFont)); } FcConfigSubstitute(0, pattern, FcMatchPattern); @@ -290,7 +291,7 @@ InitFont( fontPtr->fontset = set; fontPtr->pattern = pattern; - fontPtr->faces = ckalloc(set->nfont * sizeof(UnixFtFace)); + fontPtr->faces = (UnixFtFace *)ckalloc(set->nfont * sizeof(UnixFtFace)); fontPtr->nfaces = set->nfont; /* @@ -639,6 +640,7 @@ TkpGetFontAttrsForChar( /* UCS-4 character to map */ XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); /* Actual font used to render the character */ + (void)tkwin; GetTkFontAttributes(ftFont, faPtr); faPtr->underline = fontPtr->font.fa.underline; @@ -898,7 +900,7 @@ Tk_DrawChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -948,7 +950,7 @@ Tk_DrawChars( } doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline != 0) { @@ -1142,7 +1144,7 @@ TkDrawAngledChars( } XGetGCValues(display, gc, GCForeground, &values); xftcolor = LookUpColor(display, fontPtr, values.foreground); - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, tsdPtr->clipRegion); } nspec = 0; @@ -1194,7 +1196,7 @@ TkDrawAngledChars( #endif /* XFT_HAS_FIXED_ROTATED_PLACEMENT */ doUnderlineStrikeout: - if (tsdPtr->clipRegion != None) { + if (tsdPtr->clipRegion != NULL) { XftDrawSetClip(fontPtr->ftDraw, NULL); } if (fontPtr->font.fa.underline || fontPtr->font.fa.overstrike) { diff --git a/unix/tkUnixScale.c b/unix/tkUnixScale.c index ca5183d..b090c4f 100644 --- a/unix/tkUnixScale.c +++ b/unix/tkUnixScale.c @@ -52,7 +52,9 @@ TkScale * TkpCreateScale( Tk_Window tkwin) { - return ckalloc(sizeof(TkScale)); + (void)tkwin; + + return (TkScale *)ckalloc(sizeof(TkScale)); } /* @@ -546,7 +548,7 @@ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { - TkScale *scalePtr = 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 c51aa18..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,7 +97,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - TkScrollbar *scrollPtr = clientData; + TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; @@ -399,17 +399,17 @@ TkpConfigureScrollbar( * 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, diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c index 11161b7..58c3abc 100644 --- a/unix/tkUnixSelect.c +++ b/unix/tkUnixSelect.c @@ -250,7 +250,7 @@ TkSelPropProc( long buffer[TK_SEL_WORDS_AT_ONCE]; TkDisplay *dispPtr = TkGetDisplay(eventPtr->xany.display); Tk_ErrorHandler errorHandler; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -356,7 +356,7 @@ TkSelPropProc( ((char *) buffer)[numItems] = 0; errorHandler = Tk_CreateErrorHandler(eventPtr->xproperty.display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); /* * Encode the data using the proper format for each type. @@ -649,7 +649,7 @@ TkSelEventProc( } if (propInfo[numItems] != '\0') { - propData = ckalloc(numItems + 1); + propData = (char *)ckalloc(numItems + 1); strcpy(propData, propInfo); propData[numItems] = '\0'; } @@ -742,7 +742,7 @@ static void SelTimeoutProc( ClientData clientData) /* Information about retrieval in progress. */ { - TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; /* * Make sure that the retrieval is still in progress. Then see how long @@ -813,11 +813,11 @@ ConvertSelection( Tk_ErrorHandler errorHandler; TkSelectionInfo *infoPtr; TkSelInProgress ip; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); - errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1,-1, - (int (*)()) NULL, NULL); + errorHandler = Tk_CreateErrorHandler(eventPtr->display, -1, -1, + -1, NULL, NULL); /* * Initialize the reply event. @@ -893,7 +893,7 @@ ConvertSelection( * below). */ - incr.converts = ckalloc(incr.numConversions * sizeof(ConvertInfo)); + incr.converts = (ConvertInfo *)ckalloc(incr.numConversions * sizeof(ConvertInfo)); incr.numIncrs = 0; for (i = 0; i < incr.numConversions; i++) { Atom target, property, type; @@ -1064,7 +1064,7 @@ ConvertSelection( } Tcl_DeleteTimerHandler(incr.timeout); errorHandler = Tk_CreateErrorHandler(winPtr->display, - -1, -1, -1, (int (*)()) NULL, NULL); + -1, -1, -1, NULL, NULL); XSelectInput(reply.xsel.display, reply.xsel.requestor, 0L); Tk_DeleteErrorHandler(errorHandler); if (tsdPtr->pendingIncrs == &incr) { @@ -1126,7 +1126,7 @@ SelRcvIncrProc( ClientData clientData, /* Information about retrieval. */ XEvent *eventPtr) /* X PropertyChange event. */ { - TkSelRetrievalInfo *retrPtr = clientData; + TkSelRetrievalInfo *retrPtr = (TkSelRetrievalInfo *)clientData; char *propInfo, **propInfoPtr = &propInfo; Atom type; int format, result; @@ -1374,7 +1374,7 @@ IncrTimeoutProc( * retrieval for which we are selection * owner. */ { - IncrInfo *incrPtr = clientData; + IncrInfo *incrPtr = (IncrInfo *)clientData; incrPtr->idleTime++; if (incrPtr->idleTime >= 5) { @@ -1435,7 +1435,7 @@ SelCvtToX( if (Tcl_SplitList(NULL, string, &numFields, &field) != TCL_OK) { return NULL; } - propPtr = ckalloc(numFields * sizeof(long)); + propPtr = (long *)ckalloc(numFields * sizeof(long)); /* * Convert the fields one-by-one. @@ -1528,6 +1528,9 @@ SelCvtFromX8( Tk_Window tkwin, /* Window to use for atom conversion. */ Tcl_DString *dsPtr) /* Where to store the converted string. */ { + (void)type; + (void)tkwin; + /* * Convert each long in the property to a string value, which is a * hexadecimal string. We build the list in a Tcl_DString because this is diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index 4a24a89..ca588df 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 + ClientData dummy, /* Information about sender (only dispPtr * field is used). */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ @@ -967,10 +967,11 @@ 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. */ + (void)dummy; /* * Process options, if any. @@ -1175,7 +1176,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,12 +1357,13 @@ TkSendCleanup( static int SendInit( - Tcl_Interp *interp, /* Interpreter to use for error reporting (no + Tcl_Interp *dummy, /* Interpreter to use for error reporting (no * errors are ever returned, but the * interpreter is needed anyway). */ TkDisplay *dispPtr) /* Display to initialize. */ { XSetWindowAttributes atts; + (void)dummy; /* * Create the window used for communication, and set up an event handler @@ -1419,14 +1421,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 +1700,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); } } @@ -1780,10 +1782,11 @@ AppendErrorProc( ClientData clientData, /* Command to mark complete, or NULL. */ XErrorEvent *errorPtr) /* Information about error. */ { - PendingCommand *pendingPtr = clientData; + PendingCommand *pendingPtr = (PendingCommand *)clientData; PendingCommand *pcPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)errorPtr; if (pendingPtr == NULL) { return 0; @@ -1796,7 +1799,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 +1832,10 @@ DeleteProc( ClientData clientData) /* Info about registration, passed as * ClientData. */ { - RegisteredInterp *riPtr = clientData; + 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); @@ -1877,10 +1880,11 @@ DeleteProc( /* ARGSUSED */ static Tk_RestrictAction SendRestrictProc( - ClientData clientData, /* Not used. */ + ClientData dummy, /* Not used. */ XEvent *eventPtr) /* Event that just arrived. */ { TkDisplay *dispPtr; + (void)dummy; if (eventPtr->type != PropertyNotify) { return TK_DEFER_EVENT; @@ -1921,7 +1925,7 @@ UpdateCommWindow( { Tcl_DString names; RegisteredInterp *riPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DStringInit(&names); @@ -1968,7 +1972,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 490a1ea..65cfceb 100644 --- a/unix/tkUnixWm.c +++ b/unix/tkUnixWm.c @@ -567,7 +567,7 @@ TkWmNewWindow( 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; @@ -1013,7 +1013,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", @@ -1190,6 +1190,7 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -1392,6 +1393,7 @@ WmAttributesCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { int attribute = 0; + (void)tkwin; if (objc == 3) { /* wm attributes $win */ Tcl_Obj *result = Tcl_NewListObj(0,0); @@ -1400,7 +1402,7 @@ WmAttributesCmd( Tcl_ListObjAppendElement(interp, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(interp, result, - WmGetAttribute(winPtr, attribute)); + WmGetAttribute(winPtr, (WmAttribute)attribute)); } Tcl_SetObjResult(interp, result); return TCL_OK; @@ -1409,7 +1411,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, WmGetAttribute(winPtr, attribute)); + Tcl_SetObjResult(interp, WmGetAttribute(winPtr, (WmAttribute)attribute)); return TCL_OK; } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ int i; @@ -1419,7 +1421,7 @@ WmAttributesCmd( sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } - if (WmSetAttribute(winPtr,interp,attribute,objv[i+1]) != TCL_OK) { + if (WmSetAttribute(winPtr,interp,(WmAttribute)attribute,objv[i+1]) != TCL_OK) { return TCL_ERROR; } } @@ -1457,6 +1459,7 @@ WmClientCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -1485,7 +1488,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(objv[3]->length + 1); + wmPtr->clientMachine = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -1583,7 +1586,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; @@ -1645,6 +1648,7 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -1711,6 +1715,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1766,6 +1771,7 @@ WmFocusmodelCmd( enum options { OPT_ACTIVE, OPT_PASSIVE }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -1816,6 +1822,10 @@ WmForgetCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; + (void)tkwin; + (void)interp; + (void)objc; + (void)objv; if (Tk_IsTopLevel(frameWin)) { TkFocusJoin(winPtr); @@ -1871,6 +1881,7 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; Window window; char buf[TCL_INTEGER_SPACE]; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1914,6 +1925,7 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -1972,6 +1984,7 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -2112,7 +2125,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(objv[3]->length + 1); + wmPtr->leaderName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); @@ -2147,6 +2160,7 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; Pixmap pixmap; const char *argv3; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?bitmap?"); @@ -2205,6 +2219,7 @@ WmIconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -2334,6 +2349,7 @@ WmIconnameCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -2349,7 +2365,7 @@ WmIconnameCmd( ckfree(wmPtr->iconName); } argv3 = Tcl_GetString(objv[3]); - wmPtr->iconName = ckalloc(objv[3]->length + 1); + wmPtr->iconName = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->iconName, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { UpdateTitle(winPtr); @@ -2388,6 +2404,7 @@ WmIconphotoCmd( Tk_PhotoImageBlock block; int i, size = 0, width, height, index = 0, x, y, isDefault = 0; unsigned long *iconPropertyData; + (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -2434,7 +2451,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; } @@ -2535,6 +2552,7 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -2712,6 +2730,9 @@ WmManageCmd( { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + (void)objc; + (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -2774,6 +2795,7 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2833,6 +2855,7 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -2884,6 +2907,7 @@ WmOverrideredirectCmd( { int boolean, curValue; XSetWindowAttributes atts; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2946,6 +2970,7 @@ WmPositionfromCmd( enum options { OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -3012,6 +3037,7 @@ WmProtocolCmd( Atom protocol; const char *cmd; TkSizeT cmdLength; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -3079,7 +3105,7 @@ WmProtocolCmd( } cmd = TkGetStringFromObj(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; @@ -3119,6 +3145,7 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -3182,6 +3209,7 @@ WmSizefromCmd( enum options { OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -3374,6 +3402,7 @@ WmStateCmd( enum options { OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN }; int index; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -3476,6 +3505,7 @@ WmTitleCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -3492,7 +3522,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = Tcl_GetString(objv[3]); - wmPtr->title = ckalloc(objv[3]->length + 1); + wmPtr->title = (char *)ckalloc(objv[3]->length + 1); strcpy(wmPtr->title, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { @@ -3677,6 +3707,7 @@ WmWithdrawCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3725,7 +3756,7 @@ WmWaitMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; if (masterPtr == NULL) { @@ -4414,7 +4445,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; @@ -4502,6 +4533,7 @@ TopLevelReqProc( { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)dummy; if (wmPtr == NULL) { return; @@ -4564,7 +4596,7 @@ static void UpdateGeometryInfo( ClientData clientData) /* Pointer to the window's record. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y, width, height, min, max; unsigned long serial; @@ -5303,7 +5335,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; @@ -5459,7 +5491,7 @@ SetNetWmType( } if (objc > 0) { - atoms = ckalloc(sizeof(Atom) * objc); + atoms = (Atom *)ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { @@ -6242,7 +6274,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"); @@ -6433,7 +6465,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; } @@ -6449,7 +6481,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; } @@ -6467,7 +6499,7 @@ TkWmStackorderToplevel( for (i = 0; i < numChildren; i++) { hPtr = Tcl_FindHashEntry(&table, children[i]); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; } } @@ -6640,7 +6672,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]; } @@ -6875,7 +6907,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); @@ -6993,7 +7025,7 @@ CreateWrapper( TkWindow *winPtr, *wrapperPtr; Window parent; Tcl_HashEntry *hPtr; - int new; + int isNew; winPtr = wmPtr->winPtr; if (winPtr->window == None) { @@ -7037,7 +7069,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++; @@ -7256,7 +7288,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) { @@ -7338,8 +7370,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); diff --git a/win/configure b/win/configure index 89f5563..0b4ea50 100755 --- a/win/configure +++ b/win/configure @@ -4267,7 +4267,7 @@ $as_echo "using shared flags" >&6; } CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= @@ -4276,7 +4276,7 @@ $as_echo "using shared flags" >&6; } CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement" ;; esac diff --git a/win/stubs.c b/win/stubs.c index 1796e17..faeac08 100644 --- a/win/stubs.c +++ b/win/stubs.c @@ -8,6 +8,8 @@ int _XInitImageFuncPtrs( XImage *image) { + (void)image; + return Success; } @@ -21,6 +23,9 @@ XSetWMClientMachine( Window w, XTextProperty *text_prop) { + (void)display; + (void)w; + (void)text_prop; } Status @@ -29,6 +34,10 @@ XStringListToTextProperty( int count, XTextProperty *text_prop_return) { + (void)list; + (void)count; + (void)text_prop_return; + return Success; } @@ -47,12 +56,22 @@ XChangeProperty( _Xconst unsigned char *data, int nelements) { + (void)display; + (void)w; + (void)property; + (void)type; + (void)format; + (void)mode; + (void)data; + (void)nelements; + return Success; } XIC XCreateIC(XIM xim, ...) { + (void)xim; return NULL; } @@ -62,6 +81,10 @@ XDeleteProperty( Window w, Atom property) { + (void)display; + (void)w; + (void)property; + return Success; } @@ -70,6 +93,9 @@ XFilterEvent( XEvent *event, Window window) { + (void)event; + (void)window; + return 0; } @@ -78,6 +104,9 @@ XForceScreenSaver( Display *display, int mode) { + (void)display; + (void)mode; + return Success; } @@ -86,6 +115,9 @@ XFreeCursor( Display *display, Cursor cursor) { + (void)display; + (void)cursor; + return Success; } @@ -93,6 +125,8 @@ GContext XGContextFromGC( GC gc) { + (void)gc; + return (GContext) NULL; } @@ -101,6 +135,9 @@ XGetAtomName( Display *display, Atom atom) { + (void)display; + (void)atom; + return NULL; } @@ -110,6 +147,10 @@ XGetWindowAttributes( Window w, XWindowAttributes *window_attributes_return) { + (void)display; + (void)w; + (void)window_attributes_return; + return Success; } @@ -120,6 +161,11 @@ XGetWMColormapWindows( Window **windows_return, int *count_return) { + (void)display; + (void)w; + (void)windows_return; + (void)count_return; + return Success; } @@ -129,6 +175,10 @@ XIconifyWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -138,6 +188,10 @@ XListHosts( int *nhosts_return, Bool *state_return) { + (void)display; + (void)nhosts_return; + (void)state_return; + return NULL; } @@ -149,6 +203,12 @@ XLookupColor( XColor *exact_def_return, XColor *screen_def_return) { + (void)display; + (void)colormap; + (void)color_name; + (void)exact_def_return; + (void)screen_def_return; + return Success; } @@ -157,6 +217,9 @@ XNextEvent( Display *display, XEvent *event_return) { + (void)display; + (void)event_return; + return Success; } @@ -165,6 +228,9 @@ XPutBackEvent( Display *display, XEvent *event) { + (void)display; + (void)event; + return Success; } @@ -175,6 +241,11 @@ XQueryColors( XColor *defs_in_out, int ncolors) { + (void)display; + (void)colormap; + (void)defs_in_out; + (void)ncolors; + return Success; } @@ -187,6 +258,13 @@ XQueryTree( Window **children_return, unsigned int *nchildren_return) { + (void)display; + (void)w; + (void)root_return; + (void)parent_return; + (void)children_return; + (void)nchildren_return; + return Success; } @@ -194,6 +272,8 @@ int XRefreshKeyboardMapping( XMappingEvent *event_map) { + (void)event_map; + return Success; } @@ -202,6 +282,9 @@ XRootWindow( Display *display, int screen_number) { + (void)display; + (void)screen_number; + return (Window) NULL; } @@ -211,6 +294,10 @@ XSelectInput( Window w, long event_mask) { + (void)display; + (void)w; + (void)event_mask; + return Success; } @@ -222,6 +309,12 @@ XSendEvent( long event_mask, XEvent *event_send) { + (void)display; + (void)w; + (void)propagate; + (void)event_mask; + (void)event_send; + return Success; } @@ -232,6 +325,11 @@ XSetCommand( char **argv, int argc) { + (void)display; + (void)w; + (void)argv; + (void)argc; + return Success; } @@ -239,6 +337,8 @@ XErrorHandler XSetErrorHandler( XErrorHandler handler) { + (void)handler; + return NULL; } @@ -248,6 +348,10 @@ XSetIconName( Window w, _Xconst char *icon_name) { + (void)display; + (void)w; + (void)icon_name; + return Success; } @@ -257,6 +361,10 @@ XSetWindowBackground( Window w, unsigned long background_pixel) { + (void)display; + (void)w; + (void)background_pixel; + return Success; } @@ -266,6 +374,10 @@ XSetWindowBackgroundPixmap( Window w, Pixmap background_pixmap) { + (void)display; + (void)w; + (void)background_pixmap; + return Success; } @@ -275,6 +387,10 @@ XSetWindowBorder( Window w, unsigned long border_pixel) { + (void)display; + (void)w; + (void)border_pixel; + return Success; } @@ -284,6 +400,10 @@ XSetWindowBorderPixmap( Window w, Pixmap border_pixmap) { + (void)display; + (void)w; + (void)border_pixmap; + return Success; } @@ -293,6 +413,10 @@ XSetWindowBorderWidth( Window w, unsigned int width) { + (void)display; + (void)w; + (void)width; + return Success; } @@ -302,6 +426,10 @@ XSetWindowColormap( Window w, Colormap colormap) { + (void)display; + (void)w; + (void)colormap; + return Success; } @@ -316,6 +444,15 @@ XTranslateCoordinates( int *dest_y_return, Window *child_return) { + (void)display; + (void)src_w; + (void)dest_w; + (void)src_x; + (void)src_y; + (void)dest_x_return; + (void)dest_y_return; + (void)child_return; + return 0; } @@ -326,6 +463,11 @@ XWindowEvent( long event_mask, XEvent *event_return) { + (void)display; + (void)w; + (void)event_mask; + (void)event_return; + return Success; } @@ -335,6 +477,10 @@ XWithdrawWindow( Window w, int screen_number) { + (void)display; + (void)w; + (void)screen_number; + return Success; } @@ -347,6 +493,13 @@ XmbLookupString( KeySym *keysym_return, Status *status_return) { + (void)ic; + (void)event; + (void)buffer_return; + (void)bytes_buffer; + (void)keysym_return; + (void)status_return; + return Success; } @@ -357,7 +510,7 @@ XGetWindowProperty( Atom property, long long_offset, long long_length, - Bool delete, + Bool del, Atom req_type, Atom *actual_type_return, int *actual_format_return, @@ -365,6 +518,14 @@ XGetWindowProperty( unsigned long *bytes_after_return, unsigned char **prop_return) { + (void)display; + (void)w; + (void)property; + (void)long_offset; + (void)long_length; + (void)del; + (void)req_type; + *actual_type_return = None; *actual_format_return = 0; *nitems_return = 0; @@ -381,6 +542,8 @@ int XFlush( Display *display) { + (void)display; + return 0; } @@ -388,6 +551,8 @@ int XGrabServer( Display *display) { + (void)display; + return 0; } @@ -395,6 +560,8 @@ int XUngrabServer( Display *display) { + (void)display; + return 0; } @@ -421,6 +588,8 @@ XSynchronize( Display *display, Bool onoff) { + (void)onoff; + display->request++; return NULL; } @@ -430,6 +599,8 @@ XSync( Display *display, Bool discard) { + (void)discard; + display->request++; return 0; } @@ -447,5 +618,9 @@ XOffsetRegion( int dx, int dy) { + (void)rgn; + (void)dx; + (void)dy; + return 0; } @@ -685,7 +685,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" - CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wpointer-arith" + CFLAGS_WARNING="-Wall -Wextra -Wwrite-strings -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= @@ -694,7 +694,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ CFLAGS_WARNING="${CFLAGS_WARNING} -Wno-format" ;; *) - CFLAGS_WARNING="${CFLAGS_WARNING} -Wdeclaration-after-statement" + CFLAGS_WARNING="${CFLAGS_WARNING} -Wc++-compat -Wdeclaration-after-statement" ;; esac diff --git a/win/tkWin32Dll.c b/win/tkWin32Dll.c index 88b0507..49ffd83 100644 --- a/win/tkWin32Dll.c +++ b/win/tkWin32Dll.c @@ -104,6 +104,7 @@ DllMain( #ifdef HAVE_NO_SEH TCLEXCEPTION_REGISTRATION registration; #endif + (void)reserved; /* * If we are attaching to the DLL from a new process, tell Tk about the diff --git a/win/tkWin3d.c b/win/tkWin3d.c index 9f7ca22..3684400 100644 --- a/win/tkWin3d.c +++ b/win/tkWin3d.c @@ -43,7 +43,7 @@ typedef struct { TkBorder * TkpGetBorder(void) { - WinBorder *borderPtr = ckalloc(sizeof(WinBorder)); + WinBorder *borderPtr = (WinBorder *)ckalloc(sizeof(WinBorder)); borderPtr->light2ColorPtr = NULL; borderPtr->dark2ColorPtr = NULL; diff --git a/win/tkWinButton.c b/win/tkWinButton.c index 3ba3be5..bc2f16a 100644 --- a/win/tkWinButton.c +++ b/win/tkWinButton.c @@ -149,7 +149,7 @@ InitBoxes(void) size = tsdPtr->boxesPtr->biSize + (sizeof(RGBQUAD) << tsdPtr->boxesPtr->biBitCount) + tsdPtr->boxesPtr->biSizeImage; - newBitmap = ckalloc(size); + newBitmap = (LPBITMAPINFOHEADER)ckalloc(size); memcpy(newBitmap, tsdPtr->boxesPtr, size); tsdPtr->boxesPtr = newBitmap; tsdPtr->boxWidth = tsdPtr->boxesPtr->biWidth / 4; @@ -182,7 +182,7 @@ InitBoxes(void) */ void -TkpButtonSetDefaults() +TkpButtonSetDefaults(void) { int width = GetSystemMetrics(SM_CXEDGE); if (width > 0) { @@ -211,8 +211,9 @@ TkpCreateButton( Tk_Window tkwin) { WinButton *butPtr; + (void)tkwin; - butPtr = ckalloc(sizeof(WinButton)); + butPtr = (WinButton *)ckalloc(sizeof(WinButton)); butPtr->hwnd = NULL; return (TkButton *) butPtr; } @@ -316,7 +317,7 @@ TkpDisplayButton( { TkWinDCState state; HDC dc; - TkButton *butPtr = clientData; + TkButton *butPtr = (TkButton *)clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; diff --git a/win/tkWinClipboard.c b/win/tkWinClipboard.c index 06eebbd..2b009af 100644 --- a/win/tkWinClipboard.c +++ b/win/tkWinClipboard.c @@ -78,7 +78,7 @@ TkSelGetSelection( CloseClipboard(); goto error; } - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString((WCHAR *)data, wcslen((WCHAR *)data), &ds); GlobalUnlock(handle); @@ -101,7 +101,7 @@ TkSelGetSelection( Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "cp######", -1); - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); /* * Even though the documentation claims that GetLocaleInfo expects @@ -131,7 +131,7 @@ TkSelGetSelection( CloseClipboard(); goto error; } - data = GlobalLock(handle); + data = (char *)GlobalLock(handle); Tcl_ExternalToUtfDString(encoding, data, -1, &ds); GlobalUnlock(handle); if (encoding) { @@ -234,6 +234,8 @@ XSetSelectionOwner( { HWND hwnd = owner ? TkWinGetHWND(owner) : NULL; Tk_Window tkwin; + (void)display; + (void)time; /* * This is a gross hack because the Tk_InternAtom interface is broken. It @@ -283,6 +285,7 @@ TkWinClipboardRender( char *buffer, *p, *rawText, *endPtr; int length; Tcl_DString ds; + (void)format; for (targetPtr = dispPtr->clipTargetPtr; targetPtr != NULL; targetPtr = targetPtr->nextPtr) { @@ -314,7 +317,7 @@ TkWinClipboardRender( * Copy the data and change EOL characters. */ - buffer = rawText = ckalloc(length + 1); + buffer = rawText = (char *)ckalloc(length + 1); if (targetPtr != NULL) { for (cbPtr = targetPtr->firstBufferPtr; cbPtr != NULL; cbPtr = cbPtr->nextPtr) { @@ -338,7 +341,7 @@ TkWinClipboardRender( Tcl_DStringFree(&ds); return; } - buffer = GlobalLock(handle); + buffer = (char *)GlobalLock(handle); memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) Tcl_DStringLength(&ds) + 2); GlobalUnlock(handle); @@ -369,6 +372,8 @@ TkSelUpdateClipboard( TkClipboardTarget *targetPtr) { HWND hwnd = TkWinGetHWND(winPtr->window); + (void)targetPtr; + UpdateClipboard(hwnd); } @@ -450,6 +455,7 @@ void TkSelPropProc( XEvent *eventPtr) /* X PropertyChange event. */ { + (void)eventPtr; } /* diff --git a/win/tkWinColor.c b/win/tkWinColor.c index 8a1273a..78e3b6c 100644 --- a/win/tkWinColor.c +++ b/win/tkWinColor.c @@ -173,7 +173,7 @@ TkpGetColor( && FindSystemColor(name+6, &color, &index)) || TkParseColor(Tk_Display(tkwin), Tk_Colormap(tkwin), name, &color)) { - winColPtr = ckalloc(sizeof(WinColor)); + winColPtr = (WinColor *)ckalloc(sizeof(WinColor)); winColPtr->info.color = color; winColPtr->index = index; @@ -211,7 +211,7 @@ TkpGetColorByValue( XColor *colorPtr) /* Red, green, and blue fields indicate * desired color. */ { - WinColor *tkColPtr = ckalloc(sizeof(WinColor)); + WinColor *tkColPtr = (WinColor *)ckalloc(sizeof(WinColor)); tkColPtr->info.color.red = colorPtr->red; tkColPtr->info.color.green = colorPtr->green; @@ -307,6 +307,7 @@ XAllocColor( TkWinColormap *cmap = (TkWinColormap *) colormap; PALETTEENTRY entry, closeEntry; HDC dc = GetDC(NULL); + (void)display; entry.peRed = (color->red) >> 8; entry.peGreen = (color->green) >> 8; @@ -316,7 +317,7 @@ XAllocColor( if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { unsigned long sizePalette = GetDeviceCaps(dc, SIZEPALETTE); UINT newPixel, closePixel; - int new; + int isNew; size_t refCount; Tcl_HashEntry *entryPtr; UINT index; @@ -358,8 +359,8 @@ XAllocColor( color->pixel = PALETTERGB(entry.peRed, entry.peGreen, entry.peBlue); entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, - INT2PTR(color->pixel), &new); - if (new) { + INT2PTR(color->pixel), &isNew); + if (isNew) { refCount = 1; } else { refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1; @@ -414,6 +415,8 @@ XFreeColors( PALETTEENTRY entry, *entries; Tcl_HashEntry *entryPtr; HDC dc = GetDC(NULL); + (void)display; + (void)planes; /* * We don't have to do anything for non-palette devices. @@ -436,7 +439,7 @@ XFreeColors( GetPaletteEntries(cmap->palette, index, 1, &entry); if (cref == RGB(entry.peRed, entry.peGreen, entry.peBlue)) { count = cmap->size - index; - entries = ckalloc(sizeof(PALETTEENTRY) * count); + entries = (PALETTEENTRY *)ckalloc(sizeof(PALETTEENTRY) * count); GetPaletteEntries(cmap->palette, index+1, count, entries); SetPaletteEntries(cmap->palette, index, count, entries); ckfree(entries); @@ -482,9 +485,13 @@ XCreateColormap( PALETTEENTRY *entryPtr; TkWinColormap *cmap; Tcl_HashEntry *hashPtr; - int new; + int isNew; UINT i; HPALETTE sysPal; + (void)display; + (void)w; + (void)visual; + (void)alloc; /* * Allocate a starting palette with all of the reserved colors. @@ -496,7 +503,7 @@ XCreateColormap( logPalettePtr->palNumEntries = GetPaletteEntries(sysPal, 0, 256, logPalettePtr->palPalEntry); - cmap = ckalloc(sizeof(TkWinColormap)); + cmap = (TkWinColormap *)ckalloc(sizeof(TkWinColormap)); cmap->size = logPalettePtr->palNumEntries; cmap->stale = 0; cmap->palette = CreatePalette(logPalettePtr); @@ -509,7 +516,7 @@ XCreateColormap( for (i = 0; i < logPalettePtr->palNumEntries; i++) { entryPtr = logPalettePtr->palPalEntry + i; hashPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(PALETTERGB( - entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &new); + entryPtr->peRed, entryPtr->peGreen, entryPtr->peBlue)), &isNew); Tcl_SetHashValue(hashPtr, INT2PTR(1)); } @@ -539,6 +546,7 @@ XFreeColormap( Colormap colormap) { TkWinColormap *cmap = (TkWinColormap *) colormap; + (void)display; if (!DeleteObject(cmap->palette)) { Tcl_Panic("Unable to free colormap, palette is still selected"); diff --git a/win/tkWinCursor.c b/win/tkWinCursor.c index 3cf33e8..63f3add 100644 --- a/win/tkWinCursor.c +++ b/win/tkWinCursor.c @@ -100,6 +100,7 @@ TkGetCursorByName( TkWinCursor *cursorPtr; int argc; const char **argv = NULL; + (void)tkwin; /* * All cursor names are valid lists of one element (for @@ -113,7 +114,7 @@ TkGetCursorByName( goto badCursorSpec; } - cursorPtr = ckalloc(sizeof(TkWinCursor)); + cursorPtr = (TkWinCursor *)ckalloc(sizeof(TkWinCursor)); cursorPtr->info.cursor = (Tk_Cursor) cursorPtr; cursorPtr->winCursor = NULL; cursorPtr->system = 0; @@ -201,6 +202,16 @@ TkCreateCursorFromData( XColor fgColor, /* Foreground color for cursor. */ XColor bgColor) /* Background color for cursor. */ { + (void)tkwin; + (void)source; + (void)mask; + (void)width; + (void)height; + (void)xHot; + (void)yHot; + (void)fgColor; + (void)bgColor; + return NULL; } @@ -225,6 +236,8 @@ void TkpFreeCursor( TkCursor *cursorPtr) { + (void)cursorPtr; + /* TkWinCursor *winCursorPtr = (TkWinCursor *) cursorPtr; */ } diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index b145476..9f53396 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -423,7 +423,7 @@ typedef struct IFileSaveDialogVtbl { ULONG ( STDMETHODCALLTYPE *Release )( IFileSaveDialog *); HRESULT ( STDMETHODCALLTYPE *Show )( IFileSaveDialog *, HWND); - HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog * this, + HRESULT ( STDMETHODCALLTYPE *SetFileTypes )( IFileSaveDialog *, UINT, const TCLCOMDLG_FILTERSPEC *); HRESULT ( STDMETHODCALLTYPE *SetFileTypeIndex )( IFileSaveDialog *, UINT); @@ -629,20 +629,21 @@ struct ShellProcPointers { * ShellProcs is populated. *------------------------------------------------------------------------- */ -static void LoadShellProcs() +static void LoadShellProcs(void) { static HMODULE shell32_handle = NULL; - if (shell32_handle != NULL) - return; /* We have already been through here. */ + if (shell32_handle != NULL) { + return; /* We have already been through here. */ + } shell32_handle = GetModuleHandleW(L"shell32.dll"); - if (shell32_handle == NULL) /* Should never happen but check anyways. */ - return; + if (shell32_handle == NULL) { /* Should never happen but check anyways. */ + return; + } - ShellProcs.SHCreateItemFromParsingName = - (SHCreateItemFromParsingNameProc*) GetProcAddress(shell32_handle, - "SHCreateItemFromParsingName"); + ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*) + (void *)GetProcAddress(shell32_handle, "SHCreateItemFromParsingName"); } @@ -718,7 +719,7 @@ void TkWinDialogDebug( int debug) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->debugFlag = debug; @@ -750,7 +751,7 @@ Tk_ChooseColorObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData, parent; + Tk_Window tkwin = (Tk_Window)clientData, parent; HWND hWnd; int i, oldMode, winCode, result; CHOOSECOLORW chooseColor; @@ -788,7 +789,7 @@ Tk_ChooseColorObjCmd( chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; - chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc; + chooseColor.lpfnHook = (LPOFNHOOKPROC)(void *)ColorDlgHookProc; chooseColor.lpTemplateName = (LPWSTR) interp; for (i = 1; i < objc; i += 2) { @@ -904,10 +905,11 @@ ColorDlgHookProc( WPARAM wParam, /* First message parameter. */ LPARAM lParam) /* Second message parameter. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *title; CHOOSECOLOR *ccPtr; + (void)wParam; if (WM_INITDIALOG == uMsg) { @@ -1085,7 +1087,7 @@ ParseOFNOptions( ZeroMemory(optsPtr, sizeof(*optsPtr)); // optsPtr->forceXPStyle = 1; - optsPtr->tkwin = clientData; + optsPtr->tkwin = (Tk_Window)clientData; optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */ Tcl_DStringInit(&optsPtr->utfDirString); optsPtr->file[0] = 0; @@ -1146,7 +1148,7 @@ ParseOFNOptions( Tcl_DStringFree(&ds); break; case FILE_PARENT: - optsPtr->tkwin = Tk_NameToWindow(interp, string, clientData); + optsPtr->tkwin = Tk_NameToWindow(interp, string, (Tk_Window)clientData); if (optsPtr->tkwin == NULL) goto error_return; break; @@ -1201,11 +1203,11 @@ error_return: /* interp should already hold error */ * If new dialogs are available, COM is also initialized. *---------------------------------------------------------------------- */ -static int VistaFileDialogsAvailable() +static int VistaFileDialogsAvailable(void) { HRESULT hr; IFileDialog *fdlgPtr = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->newFileDialogsState == FDLG_STATE_INIT) { @@ -1267,7 +1269,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr, IShellItem *dirIf = NULL; LPWSTR wstr; Tcl_Obj *resultObj = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int oldMode; @@ -1409,7 +1411,7 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr, if (normPath) { LPCWSTR nativePath; Tcl_IncrRefCount(normPath); - nativePath = Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/ + nativePath = (LPCWSTR)Tcl_FSGetNativePath(normPath); /* Points INTO normPath*/ if (nativePath) { hr = ShellProcs.SHCreateItemFromParsingName( nativePath, NULL, @@ -1576,7 +1578,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper Tcl_DString utfFilterString, ds; Tcl_DString extString, filterString, dirString, titleString; const char *str; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); ZeroMemory(&ofnData, sizeof(OFNData)); @@ -1601,7 +1603,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper ofn.nMaxFile = TK_MULTI_MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_EXPLORER| OFN_ENABLEHOOK| OFN_ENABLESIZING; - ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc; + ofn.lpfnHook = (LPOFNHOOKPROC)(void *)OFNHookProc; ofn.lCustData = (LPARAM) &ofnData; if (oper != OFN_FILE_SAVE) { @@ -1621,7 +1623,7 @@ static int GetFileNameXP(Tcl_Interp *interp, OFNOpts *optsPtr, enum OFNOper oper */ ofnData.dynFileBufferSize = 512; - ofnData.dynFileBuffer = ckalloc(512 * sizeof(WCHAR)); + ofnData.dynFileBuffer = (WCHAR *)ckalloc(512 * sizeof(WCHAR)); } if (optsPtr->extObj != NULL) { @@ -1919,10 +1921,11 @@ OFNHookProc( WPARAM wParam, /* Message parameter */ LPARAM lParam) /* Message parameter */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); OPENFILENAME *ofnPtr; OFNData *ofnData; + (void)wParam; if (uMsg == WM_INITDIALOG) { TkWinSetUserData(hdlg, lParam); @@ -1967,7 +1970,7 @@ OFNHookProc( if ((selsize > 1) && (dirsize > 0)) { if (ofnData->dynFileBufferSize < buffersize) { - buffer = ckrealloc(buffer, buffersize * sizeof(WCHAR)); + buffer = (WCHAR *)ckrealloc(buffer, buffersize * sizeof(WCHAR)); ofnData->dynFileBufferSize = buffersize; ofnData->dynFileBuffer = buffer; } @@ -2099,7 +2102,7 @@ MakeFilter( */ const char *defaultFilter = "All Files (*.*)"; - p = filterStr = ckalloc(30); + p = filterStr = (char *)ckalloc(30); strcpy(p, defaultFilter); p+= strlen(defaultFilter); @@ -2135,7 +2138,7 @@ MakeFilter( * twice the size of the string to format the filter */ - filterStr = ckalloc(len * 3); + filterStr = (char *)ckalloc(len * 3); for (filterPtr = flist.filters, p = filterStr; filterPtr; filterPtr = filterPtr->next) { @@ -2288,7 +2291,7 @@ static int MakeFilterVista( Tcl_DStringInit(&ds); Tcl_DStringInit(&patterns); - dlgFilterPtr = ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); + dlgFilterPtr = (TCLCOMDLG_FILTERSPEC *)ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); for (i = 0, filterPtr = flist.filters; filterPtr; @@ -2306,7 +2309,7 @@ static int MakeFilterVista( Tcl_UtfToWCharDString(filterPtr->name, -1, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ - dlgFilterPtr[i].pszName = ckalloc(nbytes); + dlgFilterPtr[i].pszName = (LPCWSTR)ckalloc(nbytes); memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); @@ -2335,7 +2338,7 @@ static int MakeFilterVista( Tcl_UtfToWCharDString(Tcl_DStringValue(&patterns), -1, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ - dlgFilterPtr[i].pszSpec = ckalloc(nbytes); + dlgFilterPtr[i].pszSpec = (LPCWSTR)ckalloc(nbytes); memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); Tcl_DStringSetLength(&patterns, 0); @@ -2626,7 +2629,7 @@ ChooseDirectoryValidateProc( Tcl_DString tempString; Tcl_DString initDirString; WCHAR string[MAX_PATH]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->debugFlag) { @@ -2789,7 +2792,7 @@ Tk_MessageBoxObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - Tk_Window tkwin = clientData, parent; + Tk_Window tkwin = (Tk_Window)clientData, parent; HWND hWnd; Tcl_Obj *messageObj, *titleObj, *detailObj, *tmpObj; int defaultBtn, icon, type; @@ -2803,7 +2806,7 @@ Tk_MessageBoxObjCmd( MSG_DEFAULT, MSG_DETAIL, MSG_ICON, MSG_MESSAGE, MSG_PARENT, MSG_TITLE, MSG_TYPE }; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); Tcl_DString titleBuf, tmpBuf; LPCWSTR titlePtr, tmpPtr; @@ -2973,7 +2976,7 @@ MsgBoxCBTProc( WPARAM wParam, LPARAM lParam) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (nCode == HCBT_CREATEWND) { @@ -3020,7 +3023,7 @@ static void SetTkDialog( ClientData clientData) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); char buf[32]; @@ -3113,7 +3116,7 @@ ApplyLogfont( Tcl_Obj **objv, **tmpv; Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv); - tmpv = ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); + tmpv = (Tcl_Obj **)ckalloc(sizeof(Tcl_Obj *) * (objc + 2)); memcpy(tmpv, objv, sizeof(Tcl_Obj *) * objc); tmpv[objc] = GetFontObj(hdc, logfontPtr); TkBackgroundEvalObjv(interp, objc+1, tmpv, TCL_EVAL_GLOBAL); @@ -3151,7 +3154,7 @@ HookProc( CHOOSEFONT *pcf = (CHOOSEFONT *) lParam; HWND hwndCtrl; static HookData *phd = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (WM_INITDIALOG == msg && lParam != 0) { @@ -3294,14 +3297,14 @@ FontchooserConfigureCmd( int objc, Tcl_Obj *const objv[]) { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; HookData *hdPtr = NULL; int i, r = TCL_OK; static const char *const optionStrings[] = { "-parent", "-title", "-font", "-command", "-visible", NULL }; - hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); /* * With no arguments we return all the options in a dict. @@ -3438,14 +3441,16 @@ FontchooserShowCmd( Tcl_Obj *const objv[]) { Tcl_DString ds; - Tk_Window tkwin = clientData, parent; + Tk_Window tkwin = (Tk_Window)clientData, parent; CHOOSEFONTW cf; LOGFONTW lf; HDC hdc; HookData *hdPtr; int r = TCL_OK, oldMode = 0; + (void)objc; + (void)objv; - hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); parent = tkwin; if (hdPtr->parentObj) { @@ -3546,12 +3551,15 @@ FontchooserShowCmd( static int FontchooserHideCmd( - ClientData clientData, /* Main window */ + ClientData dummy, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { - HookData *hdPtr = Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + HookData *hdPtr = (HookData *)Tcl_GetAssocData(interp, "::tk::fontchooser", NULL); + (void)dummy; + (void)objc; + (void)objv; if (hdPtr->hwnd && IsWindow(hdPtr->hwnd)) { EndDialog(hdPtr->hwnd, 0); @@ -3571,9 +3579,10 @@ FontchooserHideCmd( */ static void -DeleteHookData(ClientData clientData, Tcl_Interp *interp) +DeleteHookData(ClientData clientData, Tcl_Interp *dummy) { - HookData *hdPtr = clientData; + HookData *hdPtr = (HookData *)clientData; + (void)dummy; if (hdPtr->parentObj) { Tcl_DecrRefCount(hdPtr->parentObj); @@ -3610,9 +3619,10 @@ const TkEnsemble tkFontchooserEnsemble[] = { }; int -TkInitFontchooser(Tcl_Interp *interp, ClientData clientData) +TkInitFontchooser(Tcl_Interp *interp, ClientData dummy) { - HookData *hdPtr = ckalloc(sizeof(HookData)); + HookData *hdPtr = (HookData *)ckalloc(sizeof(HookData)); + (void)dummy; memset(hdPtr, 0, sizeof(HookData)); Tcl_SetAssocData(interp, "::tk::fontchooser", DeleteHookData, hdPtr); diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c index 1257d46..b21376a 100644 --- a/win/tkWinDraw.c +++ b/win/tkWinDraw.c @@ -244,7 +244,7 @@ ConvertPoints( if (tsdPtr->winPoints != NULL) { ckfree(tsdPtr->winPoints); } - tsdPtr->winPoints = ckalloc(sizeof(POINT) * npoints); + tsdPtr->winPoints = (POINT *)ckalloc(sizeof(POINT) * npoints); if (tsdPtr->winPoints == NULL) { tsdPtr->nWinPoints = -1; return NULL; @@ -987,6 +987,7 @@ XFillPolygon( HPEN pen; TkWinDCState state; HDC dc; + (void)shape; if (d == None) { return BadDrawable; @@ -1407,6 +1408,7 @@ TkScrollWindow( { HWND hwnd = TkWinGetHWND(Tk_WindowId(tkwin)); RECT scrollRect; + (void)gc; scrollRect.left = x; scrollRect.top = y; @@ -1483,6 +1485,8 @@ TkpDrawHighlightBorder( int highlightWidth, Drawable drawable) { + (void)bgGC; + TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 716d456..c6a8b94 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -69,7 +69,7 @@ void TkWinCleanupContainerList(void) { Container *nextPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (; tsdPtr->firstContainerPtr != NULL; @@ -99,11 +99,16 @@ TkWinCleanupContainerList(void) /* ARGSUSED */ int TkpTestembedCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { + (void)dummy; + (void)interp; + (void)objc; + (void)objv; + return TCL_OK; } @@ -371,7 +376,7 @@ TkpMakeContainer( */ Tk_MakeWindowExist(tkwin); - containerPtr = ckalloc(sizeof(Container)); + containerPtr = (Container *)ckalloc(sizeof(Container)); containerPtr->parentPtr = winPtr; containerPtr->parentHWnd = Tk_GetHWND(Tk_WindowId(tkwin)); containerPtr->embeddedHWnd = NULL; @@ -1050,6 +1055,8 @@ TkpRedirectKeyEvent( XEvent *eventPtr) /* X event to redirect (should be KeyPress or * KeyRelease). */ { + (void)winPtr; + (void)eventPtr; /* not implemented */ } diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 451dc68..b0013a0 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -299,8 +299,8 @@ TkpGetNativeFont( } tkwin = (Tk_Window) ((TkWindow *) tkwin)->mainPtr->winPtr; - fontPtr = ckalloc(sizeof(WinFont)); - InitFont(tkwin, GetStockObject(object), 0, fontPtr); + fontPtr = (WinFont *)ckalloc(sizeof(WinFont)); + InitFont(tkwin, (HFONT)GetStockObject(object), 0, fontPtr); return (TkFont *) fontPtr; } @@ -557,7 +557,7 @@ TkpGetFontFromAttributes( hFont = GetScreenFont(faPtr, faceName, (int)(TkFontGetPixels(tkwin, faPtr->size) + 0.5), 0.0); if (tkFontPtr == NULL) { - fontPtr = ckalloc(sizeof(WinFont)); + fontPtr = (WinFont *)ckalloc(sizeof(WinFont)); } else { fontPtr = (WinFont *) tkFontPtr; ReleaseFont(fontPtr); @@ -660,6 +660,8 @@ WinFontFamilyEnumProc( WCHAR *faceName = lfPtr->elfLogFont.lfFaceName; Tcl_Obj *resultObj = (Tcl_Obj *) lParam; Tcl_DString faceString; + (void)tmPtr; + (void)fontType; Tcl_DStringInit(&faceString); Tcl_WCharToUtfDString(faceName, wcslen(faceName), &faceString); @@ -1079,6 +1081,7 @@ Tk_DrawChars( HDC dc; WinFont *fontPtr; TkWinDCState state; + (void)tkfont; fontPtr = (WinFont *) gc->font; display->request++; @@ -1227,6 +1230,7 @@ TkDrawAngledChars( HDC dc; WinFont *fontPtr; TkWinDCState state; + (void)tkfont; fontPtr = (WinFont *) gc->font; display->request++; @@ -1742,8 +1746,9 @@ AllocFontFamily( Tcl_DString faceString; Tcl_Encoding encoding; WCHAR buf[LF_FACESIZE]; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)base; hFont = SelectObject(hdc, hFont); GetTextFaceW(hdc, LF_FACESIZE, buf); @@ -1761,7 +1766,7 @@ AllocFontFamily( } } - familyPtr = ckalloc(sizeof(FontFamily)); + familyPtr = (FontFamily *)ckalloc(sizeof(FontFamily)); memset(familyPtr, 0, sizeof(FontFamily)); familyPtr->nextPtr = tsdPtr->fontFamilyList; tsdPtr->fontFamilyList = familyPtr; @@ -2044,6 +2049,8 @@ WinFontCanUseProc( SubFont *subFontPtr; Tcl_DString faceString; Tcl_DString *nameTriedPtr; + (void)tmPtr; + (void)fontType; canUsePtr = (CanUse *) lParam; ch = canUsePtr->ch; @@ -2183,7 +2190,7 @@ FontMapLoadPage( USHORT *startCount, *endCount; char buf[16], src[4]; - subFontPtr->fontMap[row] = ckalloc(FONTMAP_BITSPERPAGE / 8); + subFontPtr->fontMap[row] = (char *)ckalloc(FONTMAP_BITSPERPAGE / 8); memset(subFontPtr->fontMap[row], 0, FONTMAP_BITSPERPAGE / 8); familyPtr = subFontPtr->familyPtr; @@ -2414,7 +2421,7 @@ CanUseFallback( if (fontPtr->numSubFonts >= SUBFONT_SPACE) { SubFont *newPtr; - newPtr = ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); + newPtr = (SubFont *)ckalloc(sizeof(SubFont) * (fontPtr->numSubFonts + 1)); memcpy(newPtr, fontPtr->subFontArray, fontPtr->numSubFonts * sizeof(SubFont)); if (fontPtr->subFontArray != fontPtr->staticSubFonts) { @@ -2558,6 +2565,11 @@ WinFontExistProc( int fontType, /* Type of font (not used). */ LPARAM lParam) /* EnumFontData to hold result. */ { + (void)lfPtr; + (void)tmPtr; + (void)fontType; + (void)lParam; + return 0; } @@ -2766,8 +2778,8 @@ LoadFontRanges( segCount = subTable.segment.segCountX2 / 2; cbData = segCount * sizeof(USHORT); - startCount = ckalloc(cbData); - endCount = ckalloc(cbData); + startCount = (USHORT *)ckalloc(cbData); + endCount = (USHORT *)ckalloc(cbData); offset = encTable.offset + sizeof(subTable.segment); GetFontData(hdc, cmapKey, (DWORD) offset, endCount, cbData); @@ -2810,8 +2822,8 @@ LoadFontRanges( segCount = 1; cbData = segCount * sizeof(USHORT); - startCount = ckalloc(cbData); - endCount = ckalloc(cbData); + startCount = (USHORT *)ckalloc(cbData); + endCount = (USHORT *)ckalloc(cbData); startCount[0] = 0x0000; endCount[0] = 0x00ff; } diff --git a/win/tkWinImage.c b/win/tkWinImage.c index e1660a9..dfb72a8 100644 --- a/win/tkWinImage.c +++ b/win/tkWinImage.c @@ -212,7 +212,10 @@ XCreateImage( int bitmap_pad, int bytes_per_line) { - XImage* imagePtr = ckalloc(sizeof(XImage)); + XImage* imagePtr = (XImage*)ckalloc(sizeof(XImage)); + (void)display; + (void)visual; + imagePtr->width = width; imagePtr->height = height; imagePtr->xoffset = offset; @@ -300,6 +303,7 @@ XGetImageZPixmap( unsigned char *data; TkWinDCState state; BOOL ret; + (void)plane_mask; if (format != ZPixmap) { TkpDisplayWarning("Only ZPixmap types are implemented", @@ -350,7 +354,7 @@ XGetImageZPixmap( if (depth <= 8) { size += sizeof(unsigned short) << depth; } - bmInfo = ckalloc(size); + bmInfo = (BITMAPINFO *)ckalloc(size); bmInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmInfo->bmiHeader.biWidth = width; @@ -368,7 +372,7 @@ XGetImageZPixmap( unsigned char *p, *pend; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; @@ -404,7 +408,7 @@ XGetImageZPixmap( unsigned char *p; GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_PAL_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; @@ -435,7 +439,7 @@ XGetImageZPixmap( } } else if (depth == 16) { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(bmInfo->bmiHeader.biSizeImage); + data = (unsigned char *)ckalloc(bmInfo->bmiHeader.biSizeImage); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; @@ -461,7 +465,7 @@ XGetImageZPixmap( } } else { GetDIBits(hdcMem, hbmp, 0, height, NULL, bmInfo, DIB_RGB_COLORS); - data = ckalloc(width * height * 4); + data = (unsigned char *)ckalloc(width * height * 4); if (!data) { /* printf("Failed to allocate data area for XImage.\n"); */ ret_image = NULL; @@ -484,7 +488,7 @@ XGetImageZPixmap( unsigned int byte_width, h, w; byte_width = ((width * 3 + 3) & ~(unsigned)3); - smallBitBase = ckalloc(byte_width * height); + smallBitBase = (unsigned char *)ckalloc(byte_width * height); if (!smallBitBase) { ckfree(ret_image->data); ckfree(ret_image); @@ -614,7 +618,7 @@ XGetImage( imagePtr = XCreateImage(display, NULL, 32, format, 0, NULL, width, height, 32, 0); size = imagePtr->bytes_per_line * imagePtr->height; - imagePtr->data = ckalloc(size); + imagePtr->data = (char *)ckalloc(size); ZeroMemory(imagePtr->data, size); for (yy = 0; yy < height; yy++) { @@ -661,7 +665,7 @@ XGetImage( imagePtr = XCreateImage(display, NULL, 1, XYBitmap, 0, NULL, width, height, 32, 0); - imagePtr->data = ckalloc(imagePtr->bytes_per_line * imagePtr->height); + imagePtr->data = (char *)ckalloc(imagePtr->bytes_per_line * imagePtr->height); dc = GetDC(NULL); diff --git a/win/tkWinInit.c b/win/tkWinInit.c index 8f4ac5d..854d62f 100644 --- a/win/tkWinInit.c +++ b/win/tkWinInit.c @@ -35,6 +35,7 @@ int TkpInit( Tcl_Interp *interp) { + (void)interp; /* * This is necessary for static initialization, and is ok otherwise * because TkWinXInit flips a static bit to do its work just once. diff --git a/win/tkWinKey.c b/win/tkWinKey.c index 29f2ff0..f4eba89 100644 --- a/win/tkWinKey.c +++ b/win/tkWinKey.c @@ -99,6 +99,7 @@ TkpGetString( XKeyEvent *keyEv = &eventPtr->xkey; int len; char buf[4]; + (void)winPtr; Tcl_DStringInit(dsPtr); if (keyEv->send_event == -1) { @@ -155,6 +156,24 @@ XKeycodeToKeysym( int index) { int state = 0; + (void)display; + + if (index & 0x01) { + state |= ShiftMask; + } + return KeycodeToKeysym(keycode, state, 0); +} + +KeySym +XkbKeycodeToKeysym( + Display *display, + unsigned int keycode, + int group, + int index) +{ + int state = 0; + (void)display; + (void)group; if (index & 0x01) { state |= ShiftMask; @@ -504,7 +523,7 @@ TkpInitKeymapInfo( } dispPtr->numModKeyCodes = 0; arraySize = KEYCODE_ARRAY_SIZE; - dispPtr->modKeyCodes = ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); + dispPtr->modKeyCodes = (KeyCode *)ckalloc(KEYCODE_ARRAY_SIZE * sizeof(KeyCode)); for (i = 0, codePtr = modMapPtr->modifiermap; i < max; i++, codePtr++) { if (*codePtr == 0) { continue; @@ -520,18 +539,18 @@ TkpInitKeymapInfo( } } if (dispPtr->numModKeyCodes >= arraySize) { - KeyCode *new; + KeyCode *newKey; /* * Ran out of space in the array; grow it. */ arraySize *= 2; - new = ckalloc(arraySize * sizeof(KeyCode)); - memcpy(new, dispPtr->modKeyCodes, + newKey = (KeyCode *)ckalloc(arraySize * sizeof(KeyCode)); + memcpy(newKey, dispPtr->modKeyCodes, dispPtr->numModKeyCodes * sizeof(KeyCode)); ckfree(dispPtr->modKeyCodes); - dispPtr->modKeyCodes = new; + dispPtr->modKeyCodes = newKey; } dispPtr->modKeyCodes[dispPtr->numModKeyCodes] = *codePtr; dispPtr->numModKeyCodes++; @@ -542,7 +561,7 @@ TkpInitKeymapInfo( /* * When mapping from a keysym to a keycode, need information about the - * modifier state that should be used so that when they call XKeycodeToKeysym + * modifier state that should be used so that when they call XkbKeycodeToKeysym * taking into account the xkey.state, they will get back the original keysym. */ @@ -555,6 +574,7 @@ TkpSetKeycodeAndState( int i; SHORT result; int shift; + (void)tkwin; eventPtr->xkey.keycode = 0; if (keySym == NoSymbol) { @@ -611,6 +631,7 @@ XKeysymToKeycode( { int i; SHORT result; + (void)display; /* * We check our private map first for a virtual keycode, as VkKeyScan will @@ -656,10 +677,11 @@ XModifierKeymap * XGetModifierMapping( Display *display) { - XModifierKeymap *map = ckalloc(sizeof(XModifierKeymap)); + XModifierKeymap *map = (XModifierKeymap *)ckalloc(sizeof(XModifierKeymap)); + (void)display; map->max_keypermod = 1; - map->modifiermap = ckalloc(sizeof(KeyCode) * 8); + map->modifiermap = (KeyCode *)ckalloc(sizeof(KeyCode) * 8); map->modifiermap[ShiftMapIndex] = VK_SHIFT; map->modifiermap[LockMapIndex] = VK_CAPITAL; map->modifiermap[ControlMapIndex] = VK_CONTROL; @@ -717,6 +739,8 @@ KeySym XStringToKeysym( _Xconst char *string) { + (void)string; + return NoSymbol; } @@ -740,6 +764,8 @@ char * XKeysymToString( KeySym keysym) { + (void)keysym; + return NULL; } diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index a2fcb6b..eb236cd 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -233,13 +233,13 @@ GetNewID( TkMenuEntry *mePtr, /* The menu we are working with. */ WORD *menuIDPtr) /* The resulting id. */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); WORD curID = tsdPtr->lastCommandID; while (1) { Tcl_HashEntry *commandEntryPtr; - int new; + int isNew; /* * Try the next ID number, taking care to wrap rather than stray @@ -255,8 +255,8 @@ GetNewID( } commandEntryPtr = Tcl_CreateHashEntry(&tsdPtr->commandTable, - INT2PTR(curID), &new); - if (new) { + INT2PTR(curID), &isNew); + if (isNew) { Tcl_SetHashValue(commandEntryPtr, mePtr); *menuIDPtr = curID; tsdPtr->lastCommandID = curID; @@ -285,7 +285,7 @@ static void FreeID( WORD commandID) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -328,7 +328,7 @@ TkpNewMenu( HMENU winMenuHdl; Tcl_HashEntry *hashEntryPtr; int newEntry; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); winMenuHdl = CreatePopupMenu(); @@ -374,7 +374,7 @@ TkpDestroyMenu( { HMENU winMenuHdl = (HMENU) menuPtr->platformData; const char *searchName; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (menuPtr->menuFlags & MENU_RECONFIGURE_PENDING) { @@ -388,7 +388,7 @@ TkpDestroyMenu( if (menuPtr->menuFlags & MENU_SYSTEM_MENU) { TkMenuEntry *searchEntryPtr; Tcl_HashTable *tablePtr = TkGetMenuHashTable(menuPtr->interp); - char *menuName = Tcl_GetHashKey(tablePtr, + char *menuName = (char *)Tcl_GetHashKey(tablePtr, menuPtr->menuRefPtr->hashEntryPtr); /* @@ -492,16 +492,16 @@ GetEntryText( char *itemText; if (mePtr->type == TEAROFF_ENTRY) { - itemText = ckalloc(sizeof("(Tear-off)")); + itemText = (char *)ckalloc(sizeof("(Tear-off)")); strcpy(itemText, "(Tear-off)"); } else if (mePtr->imagePtr != NULL) { - itemText = ckalloc(sizeof("(Image)")); + itemText = (char *)ckalloc(sizeof("(Image)")); strcpy(itemText, "(Image)"); } else if (mePtr->bitmapPtr != NULL) { - itemText = ckalloc(sizeof("(Pixmap)")); + itemText = (char *)ckalloc(sizeof("(Pixmap)")); strcpy(itemText, "(Pixmap)"); } else if (mePtr->labelPtr == NULL || mePtr->labelLength == 0) { - itemText = ckalloc(sizeof("( )")); + itemText = (char *)ckalloc(sizeof("( )")); strcpy(itemText, "( )"); } else { int i; @@ -541,7 +541,7 @@ GetEntryText( } } - itemText = ckalloc(Tcl_DStringLength(&itemString) + 1); + itemText = (char *)ckalloc(Tcl_DStringLength(&itemString) + 1); strcpy(itemText, Tcl_DStringValue(&itemString)); Tcl_DStringFree(&itemString); } @@ -569,7 +569,7 @@ static void ReconfigureWindowsMenu( ClientData clientData) /* The menu we are rebuilding */ { - TkMenu *menuPtr = clientData; + TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; @@ -729,7 +729,7 @@ ReconfigureWindowsMenu( if ((menuPtr->menuType == MENUBAR) && (menuPtr->parentTopLevelPtr != NULL)) { - HANDLE bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr); + HWND bar = TkWinGetWrapperWindow(menuPtr->parentTopLevelPtr); if (bar) { DrawMenuBar(bar); @@ -760,7 +760,7 @@ ReconfigureWindowsMenu( int TkpPostMenu( - Tcl_Interp *interp, + Tcl_Interp *dummy, TkMenu *menuPtr, int x, int y, int index) { @@ -770,8 +770,9 @@ TkpPostMenu( POINT point; Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin); int oldServiceMode = Tcl_GetServiceMode(); - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; tsdPtr->inPostMenu++; CallPendingReconfigureImmediately(menuPtr); @@ -870,13 +871,14 @@ TkpPostMenu( int TkpPostTearoffMenu( - Tcl_Interp *interp, /* The interpreter of the menu */ + Tcl_Interp *dummy, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; + (void)dummy; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; @@ -1065,7 +1067,7 @@ TkWinEmbeddedMenuProc( { static int nIdles = 0; LRESULT lResult = 1; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch(message) { @@ -1141,15 +1143,16 @@ TkWinHandleMenuEvent( int returnResult = 0; TkMenu *menuPtr; TkMenuEntry *mePtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)phwnd; switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *pwParam); if (hashEntryPtr != NULL) { - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); if ((menuPtr->menuRefPtr != NULL) && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) { TkPostSubmenu(menuPtr->interp, @@ -1164,7 +1167,7 @@ TkWinHandleMenuEvent( *pwParam); if (hashEntryPtr != NULL) { tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); tsdPtr->modalMenuPtr = menuPtr; CallPendingReconfigureImmediately(menuPtr); RecursivelyClearActiveMenu(menuPtr); @@ -1200,7 +1203,7 @@ TkWinHandleMenuEvent( if (hashEntryPtr == NULL) { break; } - mePtr = Tcl_GetHashValue(hashEntryPtr); + mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr); if (mePtr != NULL) { TkMenuReferences *menuRefPtr; TkMenuEntry *parentEntryPtr; @@ -1255,7 +1258,7 @@ TkWinHandleMenuEvent( Tcl_DString ds; *plResult = 0; - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); /* * Assume we have something directly convertable to Tcl_UniChar. * True at least for wide systems. @@ -1327,7 +1330,7 @@ TkWinHandleMenuEvent( } mePtr = (TkMenuEntry *) itemPtr->itemData; menuPtr = mePtr->menuPtr; - twdPtr = ckalloc(sizeof(TkWinDrawable)); + twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDC; twdPtr->winDC.hdc = itemPtr->hDC; @@ -1393,7 +1396,7 @@ TkWinHandleMenuEvent( hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { - menuPtr = Tcl_GetHashValue(hashEntryPtr); + menuPtr = (TkMenu *)Tcl_GetHashValue(hashEntryPtr); } } @@ -1418,7 +1421,7 @@ TkWinHandleMenuEvent( hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, INT2PTR(entryIndex)); if (hashEntryPtr != NULL) { - mePtr = Tcl_GetHashValue(hashEntryPtr); + mePtr = (TkMenuEntry *)Tcl_GetHashValue(hashEntryPtr); } } } @@ -1507,7 +1510,7 @@ TkpSetWindowMenuBar( TkMenu *menuPtr) /* The menu we are inserting */ { HMENU winMenuHdl; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (menuPtr != NULL) { @@ -1555,6 +1558,10 @@ TkpSetMainMenubar( const char *menuName) /* The name of the menu to put in front. If * NULL, use the default menu bar. */ { + (void)interp; + (void)tkwin; + (void)menuName; + /* * Nothing to do. */ @@ -1585,6 +1592,10 @@ GetMenuIndicatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)tkfont; + (void)fmPtr; + *heightPtr = indicatorDimensions[0]; if (mePtr->hideMargin) { *widthPtr = 0; @@ -1668,6 +1679,9 @@ GetTearoffEntryGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)mePtr; + (void)tkfont; + if (menuPtr->menuType != MASTER_MENU) { *heightPtr = 0; } else { @@ -1701,6 +1715,10 @@ GetMenuSeparatorGeometry( int *widthPtr, /* The resulting width */ int *heightPtr) /* The resulting height */ { + (void)menuPtr; + (void)mePtr; + (void)tkfont; + *widthPtr = 0; *heightPtr = fmPtr->linespace - (2 * fmPtr->descent); } @@ -1814,6 +1832,11 @@ DrawMenuEntryIndicator( int width, int height) { + (void)tkfont; + (void)fmPtr; + (void)width; + (void)height; + if ((mePtr->type == CHECK_BUTTON_ENTRY) || (mePtr->type == RADIO_BUTTON_ENTRY)) { if (mePtr->indicatorOn && (mePtr->entryFlags & ENTRY_SELECTED)) { @@ -1894,6 +1917,9 @@ DrawMenuEntryAccelerator( int baseline; int leftEdge = x + mePtr->indicatorSpace + mePtr->labelWidth; const char *accel; + (void)activeBorder; + (void)width; + (void)height; if (menuPtr->menuType == MENUBAR) { return; @@ -1967,6 +1993,8 @@ DrawMenuEntryArrow( COLORREF oldFgColor; COLORREF oldBgColor; RECT rect; + (void)gc; + (void)activeBorder; if (!drawArrow || (mePtr->type != CASCADE_ENTRY)) { return; @@ -2037,6 +2065,10 @@ DrawMenuSeparator( { XPoint points[2]; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; points[0].x = x; points[0].y = y + height / 2; @@ -2076,6 +2108,9 @@ DrawMenuUnderline( int width, /* Width of entry */ int height) /* Height of entry */ { + (void)fmPtr; + (void)width; + if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; @@ -2115,7 +2150,7 @@ DrawMenuUnderline( static int TkWinMenuKeyObjCmd( - ClientData clientData, /* Unused. */ + ClientData dummy, /* Unused. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -2127,6 +2162,7 @@ TkWinMenuKeyObjCmd( TkWindow *winPtr; KeySym keySym; int i; + (void)dummy; if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "window keySym"); @@ -2538,6 +2574,10 @@ DrawTearoffEntry( XPoint points[2]; int segmentWidth, maxX; Tk_3DBorder border; + (void)mePtr; + (void)gc; + (void)tkfont; + (void)fmPtr; if (menuPtr->menuType != MASTER_MENU) { return; @@ -2645,7 +2685,7 @@ TkpDrawMenuEntry( menuDc = TkWinGetDrawableDC(menuPtr->display, menuDrawable, &dcState); memDc = CreateCompatibleDC(menuDc); - oldBitmap = SelectObject(memDc, + oldBitmap = (HBITMAP)SelectObject(memDc, CreateCompatibleBitmap(menuDc, width, height) ); memWinDraw.type = TWD_WINDC; @@ -3204,8 +3244,9 @@ HWND Tk_GetMenuHWND( Tk_Window tkwin) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)tkwin; TkMenuInit(); return tsdPtr->embeddedMenuHWND; @@ -3229,8 +3270,10 @@ Tk_GetMenuHWND( static void MenuExitHandler( - ClientData clientData) /* Not used */ + ClientData dummy) /* Not used */ { + (void)dummy; + UnregisterClassW(MENU_CLASS_NAME, Tk_GetHINSTANCE()); UnregisterClassW(EMBEDDED_MENU_CLASS_NAME, Tk_GetHINSTANCE()); } @@ -3254,10 +3297,11 @@ MenuExitHandler( static void MenuThreadExitHandler( - ClientData clientData) /* Not used */ + ClientData dummy) /* Not used */ { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + (void)dummy; DestroyWindow(tsdPtr->menuHWND); DestroyWindow(tsdPtr->embeddedMenuHWND); @@ -3294,6 +3338,8 @@ TkWinGetMenuSystemDefault( const char *className) /* The name of the option class. */ { Tcl_Obj *valuePtr = NULL; + (void)tkwin; + (void)className; if ((strcmp(dbName, "activeBorderWidth") == 0) || (strcmp(dbName, "borderWidth") == 0)) { @@ -3492,7 +3538,7 @@ TkpMenuInit(void) void TkpMenuThreadInit(void) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->menuHWND = CreateWindowW(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP, diff --git a/win/tkWinPixmap.c b/win/tkWinPixmap.c index e28f348..d189245 100644 --- a/win/tkWinPixmap.c +++ b/win/tkWinPixmap.c @@ -42,7 +42,7 @@ Tk_GetPixmap( display->request++; - newTwdPtr = ckalloc(sizeof(TkWinDrawable)); + newTwdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); newTwdPtr->type = TWD_BITMAP; newTwdPtr->bitmap.depth = depth; twdPtr = (TkWinDrawable *) d; @@ -208,6 +208,12 @@ XGetGeometry( unsigned int *depth_return) { TkWinDrawable *twdPtr = (TkWinDrawable *)d; + (void)display; + (void)root_return; + (void)x_return; + (void)y_return; + (void)border_width_return; + (void)depth_return; if (twdPtr->type == TWD_BITMAP) { HDC dc; diff --git a/win/tkWinPointer.c b/win/tkWinPointer.c index 06cbe67..561d90e 100644 --- a/win/tkWinPointer.c +++ b/win/tkWinPointer.c @@ -179,6 +179,12 @@ XGrabKeyboard( int keyboard_mode, Time time) { + (void)display; + (void)owner_events; + (void)pointer_mode; + (void)keyboard_mode; + (void)time; + keyboardWinPtr = TkWinGetWinPtr(grab_window); return GrabSuccess; } @@ -204,6 +210,9 @@ XUngrabKeyboard( Display *display, Time time) { + (void)display; + (void)time; + keyboardWinPtr = NULL; return Success; } @@ -226,9 +235,10 @@ XUngrabKeyboard( void MouseTimerProc( - ClientData clientData) + ClientData dummy) { POINT pos; + (void)dummy; mouseTimerSet = 0; @@ -290,6 +300,7 @@ TkGetPointerCoords( int *xPtr, int *yPtr) /* Store pointer coordinates here. */ { POINT point; + (void)tkwin; GetCursorPos(&point); *xPtr = point.x; @@ -327,6 +338,12 @@ XQueryPointer( int *win_y_return, unsigned int *mask_return) { + (void)w; + (void)root_return; + (void)child_return; + (void)win_x_return; + (void)win_y_return; + display->request++; TkGetPointerCoords(NULL, root_x_return, root_y_return); *mask_return = TkWinGetModifierState(); @@ -401,6 +418,12 @@ XWarpPointer( int dest_y) { RECT r; + (void)display; + (void)src_w; + (void)src_x; + (void)src_y; + (void)src_width; + (void)src_height; GetWindowRect(Tk_GetHWND(dest_w), &r); TkSetCursorPos(r.left+dest_x, r.top+dest_y); @@ -445,7 +468,7 @@ XGetInputFocus( { Tk_Window tkwin = Tk_HWNDToWindow(GetFocus()); - *focus_return = tkwin ? Tk_WindowId(tkwin) : None; + *focus_return = tkwin ? Tk_WindowId(tkwin) : 0; *revert_to_return = RevertToParent; display->request++; return Success; @@ -475,6 +498,9 @@ XSetInputFocus( int revert_to, Time time) { + (void)revert_to; + (void)time; + display->request++; if (focus != None) { SetFocus(Tk_GetHWND(focus)); diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 89d91a7..11ecf21 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.h @@ -65,6 +65,9 @@ typedef _TCHAR TCHAR; #endif +#if defined(__GNUC__) && !defined(__cplusplus) +# pragma GCC diagnostic ignored "-Wc++-compat" +#endif #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> diff --git a/win/tkWinScrlbr.c b/win/tkWinScrlbr.c index 40f7186..9f8c636 100644 --- a/win/tkWinScrlbr.c +++ b/win/tkWinScrlbr.c @@ -82,7 +82,7 @@ const Tk_ClassProcs tkpScrollbarProcs = { static void WinScrollbarEventProc(ClientData clientData, XEvent *eventPtr) { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; if (eventPtr->type == ButtonPress) { ModalLoop(scrollPtr, eventPtr); @@ -121,7 +121,7 @@ TkpCreateScrollbar( Tcl_MutexUnlock(&winScrlbrMutex); } - scrollPtr = ckalloc(sizeof(WinScrollbar)); + scrollPtr = (WinScrollbar *)ckalloc(sizeof(WinScrollbar)); scrollPtr->winFlags = 0; scrollPtr->hwnd = NULL; @@ -275,7 +275,7 @@ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { - WinScrollbar *scrollPtr = clientData; + WinScrollbar *scrollPtr = (WinScrollbar *)clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; @@ -595,6 +595,7 @@ TkpConfigureScrollbar( /* Information about widget; may or may not * already have values for some fields. */ { + (void)scrollPtr; } /* diff --git a/win/tkWinSend.c b/win/tkWinSend.c index 8acc568..0841df1 100644 --- a/win/tkWinSend.c +++ b/win/tkWinSend.c @@ -121,6 +121,8 @@ Tk_SetAppName( * be globally unique. */ { #ifndef TK_SEND_ENABLED_ON_WINDOWS + (void)tkwin; + /* * Temporarily disabled for bug #858822 */ @@ -213,6 +215,8 @@ TkGetInterpNames( * lookup. */ { #ifndef TK_SEND_ENABLED_ON_WINDOWS + (void)interp; + (void)tkwin; /* * Temporarily disabled for bug #858822 */ @@ -735,7 +739,7 @@ Send( * object. */ Tcl_Interp *interp, /* The local interpreter. */ int async, /* Flag for the calling style. */ - ClientData clientData, /* The RegisteredInterp structure for this + ClientData dummy, /* The RegisteredInterp structure for this * interp. */ int objc, /* Number of arguments to be sent. */ Tcl_Obj *const objv[]) /* The arguments to be sent. */ @@ -749,6 +753,7 @@ Send( DISPID dispid; Tcl_DString ds; const char *src; + (void)dummy; cmd = Tcl_ConcatObj(objc, objv); @@ -926,7 +931,7 @@ TkWinSend_QueueCommand( TRACE("SendQueueCommand()\n"); - evPtr = ckalloc(sizeof(SendEvent)); + evPtr = (SendEvent *)ckalloc(sizeof(SendEvent)); evPtr->header.proc = SendEventProc; evPtr->header.nextPtr = NULL; evPtr->interp = interp; @@ -968,6 +973,7 @@ SendEventProc( int flags) { SendEvent *evPtr = (SendEvent *)eventPtr; + (void)flags; TRACE("SendEventProc\n"); diff --git a/win/tkWinSendCom.c b/win/tkWinSendCom.c index 2422300..536c6c1 100644 --- a/win/tkWinSendCom.c +++ b/win/tkWinSendCom.c @@ -166,17 +166,17 @@ WinSendCom_QueryInterface( void **ppvObject) { HRESULT hr = E_NOINTERFACE; - TkWinSendCom *this = (TkWinSendCom *) This; + TkWinSendCom *sendCom = (TkWinSendCom *) This; *ppvObject = NULL; if (memcmp(riid, &IID_IUnknown, sizeof(IID)) == 0 || memcmp(riid, &IID_IDispatch, sizeof(IID)) == 0) { - *ppvObject = (void **) this; - this->lpVtbl->AddRef(This); + *ppvObject = (void **) sendCom; + sendCom->lpVtbl->AddRef(This); hr = S_OK; } else if (memcmp(riid, &IID_ISupportErrorInfo, sizeof(IID)) == 0) { - *ppvObject = (void **) (this + 1); - this->lpVtbl2->AddRef((ISupportErrorInfo *) (this + 1)); + *ppvObject = (void **) (sendCom + 1); + sendCom->lpVtbl2->AddRef((ISupportErrorInfo *) (sendCom + 1)); hr = S_OK; } return hr; @@ -186,9 +186,9 @@ static STDMETHODIMP_(ULONG) WinSendCom_AddRef( IDispatch *This) { - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; - return InterlockedIncrement(&this->refcount); + return InterlockedIncrement(&sendCom->refcount); } static STDMETHODIMP_(ULONG) @@ -196,9 +196,9 @@ WinSendCom_Release( IDispatch *This) { long r = 0; - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; - if ((r = InterlockedDecrement(&this->refcount)) == 0) { + if ((r = InterlockedDecrement(&sendCom->refcount)) == 0) { TkWinSendCom_Destroy(This); } return r; @@ -210,6 +210,7 @@ WinSendCom_GetTypeInfoCount( UINT *pctinfo) { HRESULT hr = E_POINTER; + (void)This; if (pctinfo != NULL) { *pctinfo = 0; @@ -226,6 +227,9 @@ WinSendCom_GetTypeInfo( ITypeInfo **ppTI) { HRESULT hr = E_POINTER; + (void)This; + (void)iTInfo; + (void)lcid; if (ppTI) { *ppTI = NULL; @@ -244,6 +248,10 @@ WinSendCom_GetIDsOfNames( DISPID *rgDispId) { HRESULT hr = E_POINTER; + (void)This; + (void)riid; + (void)cNames; + (void)lcid; if (rgDispId) { hr = DISP_E_UNKNOWNNAME; @@ -269,7 +277,9 @@ WinSendCom_Invoke( UINT *puArgErr) { HRESULT hr = DISP_E_MEMBERNOTFOUND; - TkWinSendCom *this = (TkWinSendCom*)This; + TkWinSendCom *sendCom = (TkWinSendCom*)This; + (void)riid; + (void)lcid; switch (dispidMember) { case TKWINSENDCOM_DISPID_SEND: @@ -277,7 +287,7 @@ WinSendCom_Invoke( if (pDispParams->cArgs != 1) { hr = DISP_E_BADPARAMCOUNT; } else { - hr = Send(this, pDispParams->rgvarg[0], pvarResult, + hr = Send(sendCom, pDispParams->rgvarg[0], pvarResult, pExcepInfo, puArgErr); } } @@ -288,7 +298,7 @@ WinSendCom_Invoke( if (pDispParams->cArgs != 1) { hr = DISP_E_BADPARAMCOUNT; } else { - hr = Async(this, pDispParams->rgvarg[0], pExcepInfo, puArgErr); + hr = Async(sendCom, pDispParams->rgvarg[0], pExcepInfo, puArgErr); } } break; @@ -313,27 +323,27 @@ ISupportErrorInfo_QueryInterface( REFIID riid, void **ppvObject) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return this->lpVtbl->QueryInterface((IDispatch *) this, riid, ppvObject); + return sendCom->lpVtbl->QueryInterface((IDispatch *) sendCom, riid, ppvObject); } static STDMETHODIMP_(ULONG) ISupportErrorInfo_AddRef( ISupportErrorInfo *This) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return InterlockedIncrement(&this->refcount); + return InterlockedIncrement(&sendCom->refcount); } static STDMETHODIMP_(ULONG) ISupportErrorInfo_Release( ISupportErrorInfo *This) { - TkWinSendCom *this = (TkWinSendCom *)(This - 1); + TkWinSendCom *sendCom = (TkWinSendCom *)(This - 1); - return this->lpVtbl->Release((IDispatch *) this); + return sendCom->lpVtbl->Release((IDispatch *) sendCom); } static STDMETHODIMP @@ -341,7 +351,10 @@ ISupportErrorInfo_InterfaceSupportsErrorInfo( ISupportErrorInfo *This, REFIID riid) { - /*TkWinSendCom *this = (TkWinSendCom*)(This - 1);*/ + (void)This; + (void)riid; + + /*TkWinSendCom *sendCom = (TkWinSendCom*)(This - 1);*/ return S_OK; /* or S_FALSE */ } @@ -371,6 +384,7 @@ Async( HRESULT hr = S_OK; VARIANT vCmd; Tcl_DString ds; + (void)puArgErr; VariantInit(&vCmd); @@ -430,6 +444,7 @@ Send( Tcl_Interp *interp = obj->interp; Tcl_Obj *scriptPtr; Tcl_DString ds; + (void)puArgErr; if (interp == NULL) { return S_OK; diff --git a/win/tkWinTest.c b/win/tkWinTest.c index 613eda3..c419be8 100644 --- a/win/tkWinTest.c +++ b/win/tkWinTest.c @@ -231,6 +231,8 @@ SetSelectionResult( Tcl_Interp *interp, const char *selection) { + (void)dummy; + Tcl_AppendResult(interp, selection, NULL); return TCL_OK; } @@ -242,7 +244,7 @@ TestclipboardObjCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { - Tk_Window tkwin = clientData; + Tk_Window tkwin = (Tk_Window)clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); @@ -271,7 +273,7 @@ TestclipboardObjCmd( static int TestwineventObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -304,6 +306,7 @@ TestwineventObjCmd( {WM_COMMAND, "WM_COMMAND"}, {-1, NULL} }; + (void)dummy; if ((objc == 3) && (strcmp(Tcl_GetString(objv[1]), "debug") == 0)) { int b; @@ -319,7 +322,7 @@ TestwineventObjCmd( return TCL_ERROR; } - hwnd = INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0)); + hwnd = (HWND)INT2PTR(strtol(Tcl_GetString(objv[1]), &rest, 0)); if (rest == Tcl_GetString(objv[1])) { hwnd = FindWindowA(NULL, Tcl_GetString(objv[1])); if (hwnd == NULL) { @@ -439,7 +442,7 @@ TestwineventObjCmd( static int TestfindwindowObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -449,6 +452,7 @@ TestfindwindowObjCmd( HWND hwnd = NULL; int r = TCL_OK; DWORD myPid; + (void)dummy; Tcl_DStringInit(&classString); Tcl_DStringInit(&titleString); @@ -511,7 +515,7 @@ EnumChildrenProc( static int TestgetwindowinfoObjCmd( - ClientData clientData, + ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -522,6 +526,7 @@ TestgetwindowinfoObjCmd( WCHAR buf[512]; int cch, cchBuf = 256; Tcl_DString ds; + (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "hwnd"); @@ -531,7 +536,7 @@ TestgetwindowinfoObjCmd( if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK) return TCL_ERROR; - cch = GetClassNameW(INT2PTR(hwnd), buf, cchBuf); + cch = GetClassNameW((HWND)INT2PTR(hwnd), buf, cchBuf); if (cch == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1)); AppendSystemError(interp, GetLastError()); @@ -548,7 +553,7 @@ TestgetwindowinfoObjCmd( Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2), Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID))); - cch = GetWindowTextW(INT2PTR(hwnd), buf, cchBuf); + cch = GetWindowTextW((HWND)INT2PTR(hwnd), buf, cchBuf); Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(buf, cch, &ds); textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); @@ -568,11 +573,13 @@ TestgetwindowinfoObjCmd( static int TestwinlocaleObjCmd( - ClientData clientData, /* Main window for application. */ + ClientData dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { + (void)dummy; + if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; diff --git a/win/tkWinWindow.c b/win/tkWinWindow.c index ff916b7..f868a06 100644 --- a/win/tkWinWindow.c +++ b/win/tkWinWindow.c @@ -49,7 +49,7 @@ Tk_AttachHWND( Tk_Window tkwin, HWND hwnd) { - int new; + int isNew; Tcl_HashEntry *entryPtr; TkWinDrawable *twdPtr = (TkWinDrawable *) Tk_WindowId(tkwin); ThreadSpecificData *tsdPtr = (ThreadSpecificData *) @@ -66,7 +66,7 @@ Tk_AttachHWND( */ if (twdPtr == NULL) { - twdPtr = ckalloc(sizeof(TkWinDrawable)); + twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = (TkWindow *) tkwin; } else if (twdPtr->window.handle != NULL) { @@ -80,7 +80,7 @@ Tk_AttachHWND( */ twdPtr->window.handle = hwnd; - entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &new); + entryPtr = Tcl_CreateHashEntry(&tsdPtr->windowTable, (char *)hwnd, &isNew); Tcl_SetHashValue(entryPtr, tkwin); return (Window)twdPtr; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index e6a0a4b..08e8882 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -856,7 +856,7 @@ static int InitWindowClass( WinIconPtr titlebaricon) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -1117,7 +1117,7 @@ TkWinGetIcon( { WmInfo *wmPtr; HICON icon; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->iconPtr != NULL) { @@ -1260,7 +1260,7 @@ ReadIconFromFile( size = sizeof(BlockOfIconImages) + ((res != 0) ? sizeof(ICONIMAGE) : 0); - lpIR = ckalloc(size); + lpIR = (BlockOfIconImagesPtr)ckalloc(size); if (lpIR == NULL) { if (res != 0) { DestroyIcon(sfi.hIcon); @@ -1291,7 +1291,7 @@ ReadIconFromFile( Tcl_DStringFree(&ds2); } if (lpIR != NULL) { - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; } @@ -1367,7 +1367,7 @@ GetIconFromPixmap( return NULL; } - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); if (lpIR == NULL) { DestroyIcon(hIcon); return NULL; @@ -1388,7 +1388,7 @@ GetIconFromPixmap( lpIR->IconImages[0].lpXOR = 0; lpIR->IconImages[0].lpAND = 0; - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; return titlebaricon; @@ -1593,7 +1593,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource structure */ - lpIR = ckalloc(sizeof(BlockOfIconImages)); + lpIR = (BlockOfIconImagesPtr)ckalloc(sizeof(BlockOfIconImages)); /* * Read in the header @@ -1611,14 +1611,14 @@ ReadIconOrCursorFromFile( * Adjust the size of the struct to account for the images. */ - lpIR = ckrealloc(lpIR, sizeof(BlockOfIconImages) + lpIR = (BlockOfIconImagesPtr)ckrealloc(lpIR, sizeof(BlockOfIconImages) + (lpIR->nNumImages - 1) * sizeof(ICONIMAGE)); /* * Allocate enough memory for the icon directory entries. */ - lpIDE = ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); + lpIDE = (LPICONDIRENTRY)ckalloc(lpIR->nNumImages * sizeof(ICONDIRENTRY)); /* * Read in the icon directory entries. @@ -1653,7 +1653,7 @@ ReadIconOrCursorFromFile( * Allocate memory for the resource. */ - lpIR->IconImages[i].lpBits = ckalloc(lpIDE[i].dwBytesInRes); + lpIR->IconImages[i].lpBits = (LPBYTE)ckalloc(lpIDE[i].dwBytesInRes); lpIR->IconImages[i].dwNumBytes = lpIDE[i].dwBytesInRes; /* @@ -1732,7 +1732,7 @@ static TkWindow * GetTopLevel( HWND hwnd) { - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* @@ -1874,7 +1874,7 @@ TkWinWmCleanup( } initialized = 0; - tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); + tsdPtr = (ThreadSpecificData *)Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { return; @@ -1905,7 +1905,7 @@ void TkWmNewWindow( TkWindow *winPtr) /* Newly-created top-level window. */ { - WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); + WmInfo *wmPtr = (WmInfo *)ckalloc(sizeof(WmInfo)); /* * Initialize full structure, then set what isn't NULL @@ -1999,7 +1999,7 @@ UpdateWrapper( HICON hBigIcon = NULL; Tcl_DString titleString; int *childStateInfo = NULL; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->window == None) { @@ -2209,7 +2209,7 @@ UpdateWrapper( WmInfo *wmPtr2; - childStateInfo = ckalloc(wmPtr->numTransients * sizeof(int)); + childStateInfo = (int *)ckalloc(wmPtr->numTransients * sizeof(int)); state = 0; for (wmPtr2 = winPtr->dispPtr->firstWmPtr; wmPtr2 != NULL; wmPtr2 = wmPtr2->nextPtr) { @@ -2356,7 +2356,7 @@ TkWmMapWindow( * mapped. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { @@ -2742,6 +2742,8 @@ void TkWmSetClass( TkWindow *winPtr) /* Newly-created top-level window. */ { + (void)winPtr; + /* Do nothing */ return; } @@ -2771,7 +2773,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", "frame", @@ -2953,6 +2955,7 @@ WmAspectCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int numer1, denom1, numer2, denom2; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3320,6 +3323,7 @@ WmClientCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); @@ -3347,7 +3351,7 @@ WmClientCmd( if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } - wmPtr->clientMachine = ckalloc(length + 1); + wmPtr->clientMachine = (char *)ckalloc(length + 1); memcpy(wmPtr->clientMachine, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; @@ -3414,7 +3418,7 @@ WmColormapwindowsCmd( != TCL_OK) { return TCL_ERROR; } - cmapList = ckalloc((windowObjc + 1) * sizeof(TkWindow*)); + cmapList = (TkWindow**)ckalloc((windowObjc + 1) * sizeof(TkWindow*)); gotToplevel = 0; for (i = 0; i < windowObjc; i++) { if (TkGetWindowFromObj(interp, tkwin, windowObjv[i], @@ -3485,6 +3489,7 @@ WmCommandCmd( const char *argv3; int cmdArgc; const char **cmdArgv; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?value?"); @@ -3551,6 +3556,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3610,6 +3616,7 @@ WmFocusmodelCmd( OPT_ACTIVE, OPT_PASSIVE }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?active|passive?"); @@ -3654,11 +3661,15 @@ static int WmForgetCmd( Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel or Frame to work with */ - Tcl_Interp *interp, /* Current interpreter. */ + Tcl_Interp *dummy, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window frameWin = (Tk_Window) winPtr; + (void)tkwin; + (void)dummy; + (void)objc; + (void)objv; if (Tk_IsTopLevel(frameWin)) { Tk_UnmapWindow(frameWin); @@ -3709,6 +3720,7 @@ WmFrameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; HWND hwnd; char buf[TCL_INTEGER_SPACE]; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -3755,6 +3767,7 @@ WmGeometryCmd( char xSign, ySign; int width, height; const char *argv3; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newGeometry?"); @@ -3821,6 +3834,7 @@ WmGridCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int reqWidth, reqHeight, widthInc, heightInc; + (void)tkwin; if ((objc != 3) && (objc != 7)) { Tcl_WrongNumArgs(interp, 2, objv, @@ -3949,7 +3963,7 @@ WmGroupCmd( } wmPtr->hints.window_group = Tk_WindowId(tkwin2); wmPtr->hints.flags |= WindowGroupHint; - wmPtr->leaderName = ckalloc(length + 1); + wmPtr->leaderName = (char *)ckalloc(length + 1); memcpy(wmPtr->leaderName, argv3, length + 1); } return TCL_OK; @@ -3983,6 +3997,7 @@ WmIconbitmapCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *useWinPtr = winPtr; /* window to apply to (NULL if -default) */ const char *string; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? ?image?"); @@ -4117,6 +4132,8 @@ WmIconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; @@ -4242,6 +4259,7 @@ WmIconnameCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); @@ -4256,7 +4274,7 @@ WmIconnameCmd( ckfree(wmPtr->iconName); } argv3 = TkGetStringFromObj(objv[3], &length); - wmPtr->iconName = ckalloc(length + 1); + wmPtr->iconName = (char *)ckalloc(length + 1); memcpy(wmPtr->iconName, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); @@ -4302,6 +4320,7 @@ WmIconphotoCmd( unsigned size; BITMAPINFO bmInfo; ICONINFO iconInfo; + (void)tkwin; if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, @@ -4339,7 +4358,7 @@ WmIconphotoCmd( */ size = sizeof(BlockOfIconImages) + (sizeof(ICONIMAGE) * (objc-startObj-1)); - lpIR = attemptckalloc(size); + lpIR = (BlockOfIconImagesPtr)attemptckalloc(size); if (lpIR == NULL) { return TCL_ERROR; } @@ -4444,7 +4463,7 @@ WmIconphotoCmd( lpIR->IconImages[i-startObj].hIcon = hIcon; } - titlebaricon = ckalloc(sizeof(WinIconInstance)); + titlebaricon = (WinIconPtr)ckalloc(sizeof(WinIconInstance)); titlebaricon->iconBlock = lpIR; titlebaricon->refCount = 1; if (WinSetIcon(interp, titlebaricon, (Tk_Window) useWinPtr) != TCL_OK) { @@ -4485,6 +4504,7 @@ WmIconpositionCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int x, y; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); @@ -4651,6 +4671,9 @@ WmManageCmd( { Tk_Window frameWin = (Tk_Window) winPtr; WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; + (void)objc; + (void)objv; if (!Tk_IsTopLevel(frameWin)) { if (!Tk_IsManageable(frameWin)) { @@ -4705,6 +4728,7 @@ WmMaxsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4756,6 +4780,7 @@ WmMinsizeCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -4808,6 +4833,7 @@ WmOverrideredirectCmd( WmInfo *wmPtr = winPtr->wmInfoPtr; int boolean, curValue; XSetWindowAttributes atts; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -4885,6 +4911,7 @@ WmPositionfromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user/program?"); @@ -4951,6 +4978,7 @@ WmProtocolCmd( const char *cmd; TkSizeT cmdLength; Tcl_Obj *resultObj; + (void)tkwin; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); @@ -5006,7 +5034,7 @@ WmProtocolCmd( } cmd = TkGetStringFromObj(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; @@ -5043,6 +5071,7 @@ WmResizableCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; int width, height; + (void)tkwin; if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); @@ -5111,6 +5140,7 @@ WmSizefromCmd( OPT_PROGRAM, OPT_USER }; int index; + (void)tkwin; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?user|program?"); @@ -5308,6 +5338,7 @@ WmStateCmd( OPT_NORMAL, OPT_ICONIC, OPT_WITHDRAWN, OPT_ZOOMED }; int index; + (void)tkwin; if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?state?"); @@ -5444,6 +5475,7 @@ WmTitleCmd( const char *argv3; TkSizeT length; HWND wrapper; + (void)tkwin; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); @@ -5477,7 +5509,7 @@ WmTitleCmd( ckfree(wmPtr->title); } argv3 = TkGetStringFromObj(objv[3], &length); - wmPtr->title = ckalloc(length + 1); + wmPtr->title = (char *)ckalloc(length + 1); memcpy(wmPtr->title, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) { @@ -5646,6 +5678,7 @@ WmWithdrawCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { WmInfo *wmPtr = winPtr->wmInfoPtr; + (void)tkwin; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -5696,7 +5729,7 @@ WmWaitVisibilityOrMapProc( ClientData clientData, /* Pointer to window. */ XEvent *eventPtr) /* Information about event. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; TkWindow *masterPtr = winPtr->wmInfoPtr->masterPtr; if (masterPtr == NULL) @@ -5913,7 +5946,7 @@ TopLevelEventProc( ClientData clientData, /* Window for which event occurred. */ XEvent *eventPtr) /* Event that just happened. */ { - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; if (eventPtr->type == DestroyNotify) { Tk_ErrorHandler handler; @@ -5961,6 +5994,7 @@ TopLevelReqProc( { TkWindow *winPtr = (TkWindow *) tkwin; WmInfo *wmPtr; + (void)dummy; wmPtr = winPtr->wmInfoPtr; if (wmPtr) { @@ -6004,7 +6038,7 @@ UpdateGeometryInfo( int width, height; /* Size of client area. */ int min, max; RECT rect; - TkWindow *winPtr = clientData; + TkWindow *winPtr = (TkWindow *)clientData; WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->flags &= ~WM_UPDATE_PENDING; @@ -6514,6 +6548,8 @@ Tk_GetVRootGeometry( int *widthPtr, int *heightPtr) /* Store dimensions of virtual root here. */ { + (void)tkwin; + *xPtr = GetSystemMetrics(SM_XVIRTUALSCREEN); *yPtr = GetSystemMetrics(SM_YVIRTUALSCREEN); *widthPtr = GetSystemMetrics(SM_CXVIRTUALSCREEN); @@ -6675,7 +6711,7 @@ TkWmStackorderToplevelEnumProc( hPtr = Tcl_FindHashEntry(pair->table, hwnd); if (hPtr != NULL) { - childWinPtr = Tcl_GetHashValue(hPtr); + childWinPtr = (TkWindow *)Tcl_GetHashValue(hPtr); /* * Double check that same HWND does not get passed twice. @@ -6775,7 +6811,7 @@ TkWmStackorderToplevel( Tcl_InitHashTable(&table, TCL_ONE_WORD_KEYS); TkWmStackorderToplevelWrapperMap(parentPtr, parentPtr->display, &table); - windows = ckalloc((table.numEntries+1) * sizeof(TkWindow *)); + windows = (TkWindow **)ckalloc((table.numEntries+1) * sizeof(TkWindow *)); /* * Special cases: If zero or one toplevels were mapped there is no need to @@ -6788,7 +6824,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; } @@ -6951,7 +6987,7 @@ TkWmAddToColormapWindows( * Automatically add the toplevel itself as the last element of the list. */ - newPtr = ckalloc((count+2) * sizeof(TkWindow *)); + newPtr = (TkWindow **)ckalloc((count+2) * sizeof(TkWindow *)); if (count > 0) { memcpy(newPtr, oldPtr, count * sizeof(TkWindow*)); } @@ -8247,7 +8283,7 @@ TkpGetWrapperWindow( static void GenerateActivateEvent(TkWindow * winPtr, const int *flagPtr) { - ActivateEvent *eventPtr = ckalloc(sizeof(ActivateEvent)); + ActivateEvent *eventPtr = (ActivateEvent *)ckalloc(sizeof(ActivateEvent)); eventPtr->ev.proc = ActivateWindow; eventPtr->winPtr = winPtr; diff --git a/win/tkWinX.c b/win/tkWinX.c index 7b2d004..e17dad1 100644 --- a/win/tkWinX.c +++ b/win/tkWinX.c @@ -125,11 +125,12 @@ TkGetServerInfo( { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; + (void)tkwin; if (!buffer[0]) { - HANDLE handle = GetModuleHandleW(L"NTDLL"); - int(__stdcall *getversion)(void *) = - (int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion"); + HMODULE handle = GetModuleHandleW(L"NTDLL"); + int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *)) + (void *)GetProcAddress(handle, "RtlGetVersion"); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&os)) { GetVersionExW(&os); @@ -259,7 +260,7 @@ TkWinXInit( if (GetLocaleInfoW(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (LPWSTR) &lpCP, sizeof(lpCP)/sizeof(WCHAR)) - && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) { + && TranslateCharsetInfo((DWORD *)INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) { UpdateInputLanguage((int) lpCs.ciCharset); } @@ -290,7 +291,7 @@ void TkWinXCleanup( ClientData clientData) { - HINSTANCE hInstance = clientData; + HINSTANCE hInstance = (HINSTANCE)clientData; /* * Clean up our own class. @@ -390,9 +391,11 @@ TkWinGetPlatformTheme(void) const char * TkGetDefaultScreenName( - Tcl_Interp *interp, /* Not used. */ + Tcl_Interp *dummy, /* Not used. */ const char *screenName) /* If NULL, use default string. */ { + (void)dummy; + if ((screenName == NULL) || (screenName[0] == '\0')) { screenName = winScreenName; } @@ -445,13 +448,13 @@ TkWinDisplayChanged( * the HWND and we'll just get blank spots copied onto the screen. */ - screen->ext_data = INT2PTR(GetDeviceCaps(dc, PLANES)); + screen->ext_data = (XExtData *)INT2PTR(GetDeviceCaps(dc, PLANES)); screen->root_depth = GetDeviceCaps(dc, BITSPIXEL) * PTR2INT(screen->ext_data); if (screen->root_visual != NULL) { ckfree(screen->root_visual); } - screen->root_visual = ckalloc(sizeof(Visual)); + screen->root_visual = (Visual *)ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; if (GetDeviceCaps(dc, RASTERCAPS) & RC_PALETTE) { screen->root_visual->map_entries = GetDeviceCaps(dc, SIZEPALETTE); @@ -497,7 +500,7 @@ TkWinDisplayChanged( /* *---------------------------------------------------------------------- * - * TkpOpenDisplay -- + * TkpOpenDisplay/XkbOpenDisplay -- * * Create the Display structure and fill it with device specific * information. @@ -515,10 +518,8 @@ TkDisplay * TkpOpenDisplay( const char *display_name) { - Screen *screen; - TkWinDrawable *twdPtr; Display *display; - ThreadSpecificData *tsdPtr = + ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); DWORD initialWheelTick; @@ -530,33 +531,47 @@ TkpOpenDisplay( } } - display = ckalloc(sizeof(Display)); - ZeroMemory(display, sizeof(Display)); - - display->display_name = ckalloc(strlen(display_name) + 1); - strcpy(display->display_name, display_name); + display = XkbOpenDisplay((char *)display_name, NULL, NULL, NULL, NULL, NULL); + TkWinDisplayChanged(display); - display->cursor_font = 1; - display->nscreens = 1; - display->request = 1; - display->qlen = 0; + tsdPtr->winDisplay =(TkDisplay *) ckalloc(sizeof(TkDisplay)); + ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); + tsdPtr->winDisplay->display = display; + tsdPtr->updatingClipboard = FALSE; + initialWheelTick = GetTickCount(); + tsdPtr->vWheelTickPrev = initialWheelTick; + tsdPtr->hWheelTickPrev = initialWheelTick; + tsdPtr->vWheelAcc = 0; + tsdPtr->hWheelAcc = 0; - screen = ckalloc(sizeof(Screen)); - ZeroMemory(screen, sizeof(Screen)); - screen->display = display; + /* + * Key map info must be available immediately, because of "send event". + */ + TkpInitKeymapInfo(tsdPtr->winDisplay); /* - * Set up the root window. + * Key map info must be available immediately, because of "send event". */ + TkpInitKeymapInfo(tsdPtr->winDisplay); - twdPtr = ckalloc(sizeof(TkWinDrawable)); - if (twdPtr == NULL) { - return NULL; - } - twdPtr->type = TWD_WINDOW; - twdPtr->window.winPtr = NULL; - twdPtr->window.handle = NULL; - screen->root = (Window)twdPtr; + return tsdPtr->winDisplay; +} + +Display * +XkbOpenDisplay( + char *name, + int *ev_rtrn, + int *err_rtrn, + int *major_rtrn, + int *minor_rtrn, + int *reason) +{ + Display *display = (Display *)ckalloc(sizeof(Display)); + Screen *screen = (Screen *)ckalloc(sizeof(Screen)); + TkWinDrawable *twdPtr = (TkWinDrawable *)ckalloc(sizeof(TkWinDrawable)); + + ZeroMemory(screen, sizeof(Screen)); + ZeroMemory(display, sizeof(Display)); /* * Note that these pixel values are not palette relative. @@ -570,29 +585,27 @@ TkpOpenDisplay( display->nscreens = 1; display->default_screen = 0; - TkWinDisplayChanged(display); + twdPtr->type = TWD_WINDOW; + twdPtr->window.winPtr = NULL; + twdPtr->window.handle = NULL; + screen->root = (Window)twdPtr; + screen->display = display; - tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); - ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); - tsdPtr->winDisplay->display = display; - tsdPtr->updatingClipboard = FALSE; - initialWheelTick = GetTickCount(); - tsdPtr->vWheelTickPrev = initialWheelTick; - tsdPtr->hWheelTickPrev = initialWheelTick; - tsdPtr->vWheelAcc = 0; - tsdPtr->hWheelAcc = 0; + display->display_name = (char *)ckalloc(strlen(name) + 1); + strcpy(display->display_name, name); - /* - * Key map info must be available immediately, because of "send event". - */ - TkpInitKeymapInfo(tsdPtr->winDisplay); + display->cursor_font = 1; + display->nscreens = 1; + display->request = 1; + display->qlen = 0; - /* - * Key map info must be available immediately, because of "send event". - */ - TkpInitKeymapInfo(tsdPtr->winDisplay); + if (ev_rtrn) *ev_rtrn = 0; + if (err_rtrn) *err_rtrn = 0; + if (major_rtrn) *major_rtrn = 0; + if (minor_rtrn) *minor_rtrn = 0; + if (reason) *reason = 0; - return tsdPtr->winDisplay; + return display; } /* @@ -701,6 +714,9 @@ XBell( Display *display, int percent) { + (void)display; + (void)percent; + MessageBeep(MB_OK); return Success; } @@ -1485,7 +1501,7 @@ UpdateInputLanguage( if (keyInputCharset == charset) { return; } - if (TranslateCharsetInfo(INT2PTR(charset), &charsetInfo, + if (TranslateCharsetInfo((DWORD*)INT2PTR(charset), &charsetInfo, TCI_SRCCHARSET) == 0) { /* * Some mysterious failure. @@ -1930,6 +1946,7 @@ Tk_GetUserInactiveTime( Display *dpy) /* Ignored on Windows */ { LASTINPUTINFO li; + (void)dpy; li.cbSize = sizeof(li); if (!GetLastInputInfo(&li)) { @@ -1965,6 +1982,7 @@ Tk_ResetUserInactiveTime( Display *dpy) { INPUT inp; + (void)dpy; inp.type = INPUT_MOUSE; inp.mi.dx = 0; diff --git a/win/ttkWinTheme.c b/win/ttkWinTheme.c index 7d26c12..4f90ea7 100644 --- a/win/ttkWinTheme.c +++ b/win/ttkWinTheme.c @@ -147,9 +147,13 @@ static void FrameControlElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - FrameControlElementData *p = clientData; + FrameControlElementData *p = (FrameControlElementData *)clientData; int cx = GETMETRIC(p->cxId); int cy = GETMETRIC(p->cyId); + (void)elementRecord; + (void)tkwin; + (void)paddingPtr; + if (p->cxId & _HALFMETRIC) cx /= 2; if (p->cyId & _HALFMETRIC) cy /= 2; *widthPtr = cx + Ttk_PaddingWidth(p->margins); @@ -160,10 +164,11 @@ static void FrameControlElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FrameControlElementData *elementData = clientData; + FrameControlElementData *elementData = (FrameControlElementData *)clientData; RECT rc = BoxToRect(Ttk_PadBox(b, elementData->margins)); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); + (void)elementRecord; DrawFrameControl(hdc, &rc, elementData->classId, @@ -189,26 +194,34 @@ typedef struct { static const Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void BorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void BorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - BorderElement *border = elementRecord; + BorderElement *border = (BorderElement *)elementRecord; RECT rc = BoxToRect(b); int relief = TK_RELIEF_FLAT; TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)state; Tk_GetReliefFromObj(NULL, border->reliefObj, &relief); @@ -240,26 +253,34 @@ typedef struct { static const Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void FieldElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void FieldElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FieldElement *field = elementRecord; + FieldElement *field = (FieldElement *)elementRecord; Tk_3DBorder bg = Tk_Get3DBorderFromObj(tkwin, field->backgroundObj); RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)state; Tk_Fill3DRectangle( tkwin, d, bg, b.x, b.y, b.width, b.height, 0, TK_RELIEF_FLAT); @@ -295,17 +316,21 @@ static const Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; static void ButtonBorderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_RAISED; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; short int cx, cy; + (void)dummy; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -327,15 +352,16 @@ static void ButtonBorderElementSize( } static void ButtonBorderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - ButtonBorderElement *bd = elementRecord; + ButtonBorderElement *bd = (ButtonBorderElement *)elementRecord; int relief = TK_RELIEF_FLAT; Ttk_ButtonDefaultState defaultState = TTK_BUTTON_DEFAULT_DISABLED; TkWinDCState dcState; HDC hdc; RECT rc; + (void)dummy; Tk_GetReliefFromObj(NULL, bd->reliefObj, &relief); Ttk_GetButtonDefaultStateFromObj(NULL, bd->defaultStateObj, &defaultState); @@ -381,16 +407,25 @@ static const Ttk_ElementSpec ButtonBorderElementSpec = { */ static void FocusElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + *paddingPtr = Ttk_UniformPadding(1); } static void FocusElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { + (void)dummy; + (void)elementRecord; + if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; @@ -419,15 +454,17 @@ typedef struct { static const Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, offsetof(FillFocusElement,fillColorObj), "white" }, - {NULL, 0, 0, NULL} + {NULL, TK_OPTION_BOOLEAN, 0, NULL} }; /* @@@ FIX THIS */ static void FillFocusElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - FillFocusElement *focus = elementRecord; + FillFocusElement *focus = (FillFocusElement *)elementRecord; + (void)dummy; + if (state & TTK_STATE_FOCUS) { RECT rc = BoxToRect(b); TkWinDCState dcState; @@ -482,7 +519,7 @@ static const WORD Pattern[] = { static void TroughClientDataDeleteProc(void *clientData) { - TroughClientData *cd = clientData; + TroughClientData *cd = (TroughClientData *)clientData; DeleteObject(cd->PatternBrush); DeleteObject(cd->PatternBitmap); ckfree(clientData); @@ -490,7 +527,7 @@ static void TroughClientDataDeleteProc(void *clientData) static TroughClientData *TroughClientDataInit(Tcl_Interp *interp) { - TroughClientData *cd = ckalloc(sizeof(*cd)); + TroughClientData *cd = (TroughClientData *)ckalloc(sizeof(*cd)); cd->PatternBitmap = CreateBitmap(8, 8, 1, 1, Pattern); cd->PatternBrush = CreatePatternBrush(cd->PatternBitmap); Ttk_RegisterCleanup(interp, cd, TroughClientDataDeleteProc); @@ -501,13 +538,15 @@ static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { - TroughClientData *cd = clientData; + TroughClientData *cd = (TroughClientData *)clientData; TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); HBRUSH hbr; COLORREF bk, oldbk, oldtxt; + (void)elementRecord; + (void)state; - hbr = SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); + hbr = (HBRUSH)SelectObject(hdc, GetSysColorBrush(COLOR_SCROLLBAR)); bk = GetSysColor(COLOR_3DHIGHLIGHT); oldtxt = SetTextColor(hdc, GetSysColor(COLOR_3DFACE)); oldbk = SetBkColor(hdc, bk); @@ -543,17 +582,20 @@ typedef struct { static const Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void ThumbElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - ThumbElement *thumbPtr = elementRecord; - int orient; + ThumbElement *thumbPtr = (ThumbElement *)elementRecord; + Ttk_Orient orient; + (void)dummy; + (void)tkwin; + (void)paddingPtr; - Ttk_GetOrientFromObj(NULL, thumbPtr->orientObj, &orient); + TtkGetOrientFromObj(NULL, thumbPtr->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = GetSystemMetrics(SM_CXHTHUMB); *heightPtr = GetSystemMetrics(SM_CYHSCROLL); @@ -564,12 +606,14 @@ static void ThumbElementSize( } static void ThumbElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)elementRecord; /* Windows doesn't show a thumb when the scrollbar is disabled */ if (state & TTK_STATE_DISABLED) @@ -600,17 +644,20 @@ typedef struct { static const Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, - { NULL, 0, 0, NULL } + { NULL, TK_OPTION_BOOLEAN, 0, NULL } }; static void SliderElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - SliderElement *slider = elementRecord; - int orient; + SliderElement *slider = (SliderElement *)elementRecord; + Ttk_Orient orient; + (void)dummy; + (void)tkwin; + (void)paddingPtr; - Ttk_GetOrientFromObj(NULL, slider->orientObj, &orient); + TtkGetOrientFromObj(NULL, slider->orientObj, &orient); if (orient == TTK_ORIENT_HORIZONTAL) { *widthPtr = (GetSystemMetrics(SM_CXHTHUMB) / 2) | 1; *heightPtr = GetSystemMetrics(SM_CYHSCROLL); @@ -621,12 +668,15 @@ static void SliderElementSize( } static void SliderElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc; + (void)dummy; + (void)elementRecord; + (void)state; hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_MIDDLE); @@ -646,20 +696,30 @@ static const Ttk_ElementSpec SliderElementSpec = { */ static void ClientElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { + (void)dummy; + (void)elementRecord; + (void)tkwin; + (void)widthPtr; + (void)heightPtr; + paddingPtr->left = paddingPtr->right = GetSystemMetrics(SM_CXEDGE); paddingPtr->top = paddingPtr->bottom = GetSystemMetrics(SM_CYEDGE); } static void ClientElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, + void *dummy, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { RECT rc = BoxToRect(b); TkWinDCState dcState; HDC hdc = TkWinGetDrawableDC(Tk_Display(tkwin), d, &dcState); + (void)dummy; + (void)elementRecord; + (void)state; + DrawEdge(hdc, &rc, EDGE_RAISED, BF_RECT | BF_SOFT); TkWinReleaseDrawableDC(d, hdc, &dcState); } @@ -699,6 +759,7 @@ int TtkWinTheme_Init(Tcl_Interp *interp, HWND hwnd) { Ttk_Theme themePtr, parentPtr; const FrameControlElementData *fce = FrameControlElements; + (void)hwnd; parentPtr = Ttk_GetTheme(interp, "alt"); themePtr = Ttk_CreateTheme(interp, "winnative", parentPtr); diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 7f20ed1..11150ff 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -104,7 +104,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) */ XPThemeProcs *procs = (XPThemeProcs *)ckalloc(sizeof(XPThemeProcs)); #define LOADPROC(name) \ - (0 != (procs->name = (name ## Proc *)GetProcAddress(handle, #name) )) + (0 != (procs->name = (name ## Proc *)(void *)GetProcAddress(handle, #name) )) if ( LOADPROC(OpenThemeData) && LOADPROC(CloseThemeData) diff --git a/win/winMain.c b/win/winMain.c index f1d671f..a21cc34 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -25,7 +25,13 @@ int _CRT_glob = 0; #endif /* __GNUC__ */ #ifdef TK_TEST +#ifdef __cplusplus +extern "C" { +#endif extern Tcl_PackageInitProc Tktest_Init; +#ifdef __cplusplus +} +#endif #endif /* TK_TEST */ #if defined(STATIC_BUILD) && TCL_USE_STATIC_PACKAGES @@ -106,6 +112,10 @@ _tWinMain( TCHAR **argv; int argc; TCHAR *p; + (void)hInstance; + (void)hPrevInstance; + (void)lpszCmdLine; + (void)nCmdShow; /* * Create the console channels and install them as the standard channels. diff --git a/xlib/X11/Xlib.h b/xlib/X11/Xlib.h index 2db3f10..66beef4 100644 --- a/xlib/X11/Xlib.h +++ b/xlib/X11/Xlib.h @@ -555,8 +555,8 @@ typedef struct _XDisplay { * list to find the right procedure for each event might be * expensive if many extensions are being used. */ - Bool (*event_vec[128])(); /* vector for wire to event */ - Status (*wire_vec[128])(); /* vector for event to wire */ + Bool (*event_vec[128])(void); /* vector for wire to event */ + Status (*wire_vec[128])(void); /* vector for event to wire */ KeySym lock_meaning; /* for XLookupString */ struct _XLockInfo *lock; /* multi-thread state, display lock */ struct _XInternalAsync *async_handlers; /* for internal async */ @@ -568,7 +568,7 @@ typedef struct _XDisplay { struct _XDisplayAtoms *atoms; /* for XInternAtom */ unsigned int mode_switch; /* keyboard group modifiers */ struct _XContextDB *context_db; /* context database */ - Bool (**error_vec)(); /* vector for wire to error */ + Bool (**error_vec)(void); /* vector for wire to error */ /* * Xcms information */ @@ -581,7 +581,7 @@ typedef struct _XDisplay { struct _XIMFilter *im_filters; struct _XSQEvent *qfree; /* unallocated event queue elements */ unsigned long next_event_serial_num; /* inserted into next queue elt */ - int (*savedsynchandler)(); /* user synchandler when Xlib usurps */ + int (*savedsynchandler)(void); /* user synchandler when Xlib usurps */ } Display; #if NeedFunctionPrototypes /* prototypes require event type definitions */ @@ -1726,6 +1726,7 @@ EXTERN XHostAddress *XListHosts( int* /* nhosts_return */, Bool* /* state_return */ ); +_X_DEPRECATED EXTERN KeySym XKeycodeToKeysym( Display* /* display */, #if NeedWidePrototypes diff --git a/xlib/xcolors.c b/xlib/xcolors.c index 31db297..f2d3d2e 100644 --- a/xlib/xcolors.c +++ b/xlib/xcolors.c @@ -341,6 +341,9 @@ XParseColor( const char *spec, XColor *colorPtr) { + (void)display; + (void)map; + if (spec[0] == '#') { char *p; Tcl_WideInt value = parseHex64bit(++spec, &p); @@ -48,7 +48,7 @@ static TkpClipMask *AllocClipMask(GC gc) { TkpClipMask *clip_mask = (TkpClipMask*) gc->clip_mask; if (clip_mask == NULL) { - clip_mask = ckalloc(sizeof(TkpClipMask)); + clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; #ifdef MAC_OSX_TK } else if (clip_mask->type == TKP_CLIP_REGION) { @@ -110,6 +110,7 @@ XCreateGC( XGCValues *values) { GC gp; + (void)d; /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars @@ -120,7 +121,7 @@ XCreateGC( #define MAX_DASH_LIST_SIZE 10 - gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); + gp = (GC)ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); if (!gp) { return NULL; } @@ -141,11 +142,11 @@ XCreateGC( InitField(fill_style, GCFillStyle, FillSolid); InitField(fill_rule, GCFillRule, WindingRule); InitField(arc_mode, GCArcMode, ArcPieSlice); - InitField(tile, GCTile, None); - InitField(stipple, GCStipple, None); + InitField(tile, GCTile, 0); + InitField(stipple, GCStipple, 0); InitField(ts_x_origin, GCTileStipXOrigin, 0); InitField(ts_y_origin, GCTileStipYOrigin, 0); - InitField(font, GCFont, None); + InitField(font, GCFont, 0); InitField(subwindow_mode, GCSubwindowMode, ClipByChildren); InitField(graphics_exposures, GCGraphicsExposures, True); InitField(clip_x_origin, GCClipXOrigin, 0); @@ -265,6 +266,8 @@ int XFreeGC( Display *d, GC gc) { + (void)d; + if (gc != NULL) { FreeClipMask(gc); TkpFreeGCCache(gc); @@ -296,6 +299,8 @@ XSetForeground( GC gc, unsigned long foreground) { + (void)display; + gc->foreground = foreground; return Success; } @@ -306,6 +311,8 @@ XSetBackground( GC gc, unsigned long background) { + (void)display; + gc->background = background; return Success; } @@ -319,6 +326,7 @@ XSetDashes( int n) { char *p = &(gc->dashes); + (void)display; #ifdef TkWinDeleteBrush TkWinDeleteBrush(gc->fgBrush); @@ -341,6 +349,8 @@ XSetFunction( GC gc, int function) { + (void)display; + gc->function = function; return Success; } @@ -351,6 +361,8 @@ XSetFillRule( GC gc, int fill_rule) { + (void)display; + gc->fill_rule = fill_rule; return Success; } @@ -361,6 +373,8 @@ XSetFillStyle( GC gc, int fill_style) { + (void)display; + gc->fill_style = fill_style; return Success; } @@ -371,6 +385,8 @@ XSetTSOrigin( GC gc, int x, int y) { + (void)display; + gc->ts_x_origin = x; gc->ts_y_origin = y; return Success; @@ -382,6 +398,8 @@ XSetFont( GC gc, Font font) { + (void)display; + gc->font = font; return Success; } @@ -392,6 +410,8 @@ XSetArcMode( GC gc, int arc_mode) { + (void)display; + gc->arc_mode = arc_mode; return Success; } @@ -402,6 +422,8 @@ XSetStipple( GC gc, Pixmap stipple) { + (void)display; + gc->stipple = stipple; return Success; } @@ -415,6 +437,8 @@ XSetLineAttributes( int cap_style, int join_style) { + (void)display; + gc->line_width = line_width; gc->line_style = line_style; gc->cap_style = cap_style; @@ -429,6 +453,8 @@ XSetClipOrigin( int clip_x_origin, int clip_y_origin) { + (void)display; + gc->clip_x_origin = clip_x_origin; gc->clip_y_origin = clip_y_origin; return Success; @@ -461,6 +487,8 @@ TkSetRegion( GC gc, TkRegion r) { + (void)display; + if (r == NULL) { Tcl_Panic("must not pass NULL to TkSetRegion for compatibility with X11; use XSetClipMask instead"); } else { @@ -481,6 +509,8 @@ XSetClipMask( GC gc, Pixmap pixmap) { + (void)display; + if (pixmap == None) { FreeClipMask(gc); } else { @@ -539,6 +569,7 @@ XDrawPoints( int mode) { int res = Success; + (void)mode; while (npoints-- > 0) { res = XDrawLine(display, d, gc, @@ -558,6 +589,12 @@ XDrawSegments( XSegment *segments, int nsegments) { + (void)display; + (void)d; + (void)gc; + (void)segments; + (void)nsegments; + return BadDrawable; } #endif @@ -568,6 +605,10 @@ XFetchBuffer( int *nbytes_return, int buffer) { + (void)display; + (void)nbytes_return; + (void)buffer; + return (char *) 0; } @@ -577,6 +618,10 @@ XFetchName( Window w, char **window_name_return) { + (void)display; + (void)w; + (void)window_name_return; + return Success; } @@ -586,6 +631,10 @@ XListProperties( Window w, int *num_prop_return) { + (void)display; + (void)w; + (void)num_prop_return; + return (Atom *) 0; } @@ -594,7 +643,10 @@ XMapRaised( Display *display, Window w) { - return Success; + (void)display; + (void)w; + + return Success; } int @@ -608,6 +660,15 @@ XQueryTextExtents( int *font_descent_return, XCharStruct *overall_return) { + (void)display; + (void)font_ID; + (void)string; + (void)nchars; + (void)direction_return; + (void)font_ascent_return; + (void)font_descent_return; + (void)overall_return; + return Success; } @@ -619,6 +680,12 @@ XReparentWindow( int x, int y) { + (void)display; + (void)w; + (void)parent; + (void)x; + (void)y; + return BadWindow; } @@ -627,6 +694,9 @@ XUndefineCursor( Display *display, Window w) { + (void)display; + (void)w; + return Success; } @@ -634,6 +704,7 @@ XVaNestedList XVaCreateNestedList( int unused, ...) { + (void)unused; return NULL; } @@ -641,6 +712,7 @@ char * XSetICValues( XIC xic, ...) { + (void)xic; return NULL; } @@ -648,6 +720,7 @@ char * XGetICValues( XIC xic, ...) { + (void)xic; return NULL; } @@ -655,6 +728,7 @@ void XSetICFocus( XIC xic) { + (void)xic; } Window @@ -672,6 +746,19 @@ XCreateWindow( unsigned long value_mask, XSetWindowAttributes *attributes) { + (void)display; + (void)parent; + (void)x; + (void)y; + (void)width; + (void)height; + (void)border_width; + (void)depth; + (void)clazz; + (void)visual; + (void)value_mask; + (void)attributes; + return 0; } @@ -681,6 +768,10 @@ XPointInRegion( int x, int y) { + (void)rgn; + (void)x; + (void)y; + return 0; } @@ -690,6 +781,10 @@ XUnionRegion( Region srcb, Region dr_return) { + (void)srca; + (void)srcb; + (void)dr_return; + return 0; } @@ -699,6 +794,10 @@ XPolygonRegion( int n, int rule) { + (void)pts; + (void)n; + (void)rule; + return 0; } @@ -706,6 +805,7 @@ void XDestroyIC( XIC ic) { + (void)ic; } Cursor @@ -718,6 +818,14 @@ XCreatePixmapCursor( unsigned int x, unsigned int y) { + (void)display; + (void)source; + (void)mask; + (void)foreground_color; + (void)background_color; + (void)x; + (void)y; + return (Cursor) NULL; } @@ -731,6 +839,14 @@ XCreateGlyphCursor( XColor _Xconst *foreground_color, XColor _Xconst *background_color) { + (void)display; + (void)source_font; + (void)mask_font; + (void)source_char; + (void)mask_char; + (void)foreground_color; + (void)background_color; + return 1; } @@ -742,6 +858,12 @@ XCreateFontSet( int *missing_charset_count /* missing_charset_count */, char **def_string /* def_string */ ) { + (void)display; + (void)base_font_name_list; + (void)missing_charset_list; + (void)missing_charset_count; + (void)def_string; + return (XFontSet)0; } @@ -750,18 +872,23 @@ XFreeFontSet( Display *display, /* display */ XFontSet fontset /* font_set */ ) { + (void)display; + (void)fontset; } void XFreeStringList( char **list /* list */ ) { + (void)list; } Status XCloseIM( XIM im /* im */ ) { + (void)im; + return Success; } @@ -774,6 +901,13 @@ XRegisterIMInstantiateCallback( XIDProc callback /* callback */, XPointer client_data /* client_data */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + return False; } @@ -786,6 +920,13 @@ XUnregisterIMInstantiateCallback( XIDProc callback /* callback */, XPointer client_data /* client_data */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + (void)callback; + (void)client_data; + return False; } @@ -793,6 +934,8 @@ char * XSetLocaleModifiers( const char *modifier_list /* modifier_list */ ) { + (void)modifier_list; + return NULL; } @@ -802,6 +945,11 @@ XIM XOpenIM( char *res_name /* res_name */, char *res_class /* res_class */ ) { + (void)dpy; + (void)rdb; + (void)res_name; + (void)res_class; + return NULL; } @@ -809,6 +957,8 @@ char * XGetIMValues( XIM im /* im */, ... ) { + (void)im; + return NULL; } @@ -816,6 +966,8 @@ char * XSetIMValues( XIM im /* im */, ... ) { + (void)im; + return NULL; } diff --git a/xlib/xutil.c b/xlib/xutil.c index d80b742..a5f3b99 100644 --- a/xlib/xutil.c +++ b/xlib/xutil.c @@ -36,6 +36,8 @@ XInternAtom( Bool only_if_exists) { static Atom atom = XA_LAST_PREDEFINED; + (void)atom_name; + (void)only_if_exists; display->request++; return ++atom; @@ -64,7 +66,7 @@ XGetVisualInfo( XVisualInfo *vinfo_template, int *nitems_return) { - XVisualInfo *info = ckalloc(sizeof(XVisualInfo)); + XVisualInfo *info = (XVisualInfo *)ckalloc(sizeof(XVisualInfo)); info->visual = DefaultVisual(display, 0); info->visualid = info->visual->visualid; |