From 1a1118fa21d731504dac09ed2e6d6238601f5c84 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 12 Mar 2023 21:20:21 +0000 Subject: More -1 -> TCL_INDEX_NONE. More TCL_UNUSED( --- generic/tk3d.c | 21 +++++----- generic/tkArgv.c | 8 ++-- generic/tkBind.c | 89 +++++++++++++++++++-------------------- generic/tkBitmap.c | 2 +- generic/tkBusy.c | 4 +- generic/tkCanvArc.c | 26 ++++++------ generic/tkCanvBmap.c | 18 ++++---- generic/tkCanvLine.c | 27 ++++++------ generic/tkCanvPoly.c | 10 ++--- generic/tkCanvPs.c | 66 ++++++++++++++--------------- generic/tkCanvText.c | 22 ++++------ generic/tkCanvUtil.c | 86 ++++++++++++++------------------------ generic/tkCanvWind.c | 56 ++++++++++--------------- generic/tkCanvas.c | 58 +++++++++++++------------- generic/tkClipboard.c | 24 +++++------ generic/tkCmds.c | 52 +++++++++++------------ generic/tkColor.c | 4 +- generic/tkConfig.c | 72 ++++++++++++++++---------------- generic/tkConsole.c | 69 +++++++++++++++---------------- generic/tkCursor.c | 4 +- generic/tkEntry.c | 103 +++++++++++++++++++++------------------------- generic/tkFileFilter.c | 3 +- generic/tkFont.c | 66 ++++++++++++++--------------- generic/tkFrame.c | 85 +++++++++++++++++--------------------- generic/tkGrab.c | 16 +++---- generic/tkGrid.c | 64 ++++++++++++++-------------- generic/tkIcu.c | 8 ++-- generic/tkImage.c | 24 +++++------ generic/tkImgBmap.c | 20 ++++----- generic/tkImgGIF.c | 36 ++++++++-------- generic/tkImgListFormat.c | 34 ++++++--------- generic/tkImgPNG.c | 68 +++++++++++++++--------------- generic/tkImgPPM.c | 10 ++--- generic/tkImgPhoto.c | 76 +++++++++++++++++----------------- generic/tkImgSVGnano.c | 52 +++++++++++------------ generic/tkImgUtil.c | 4 +- generic/tkListbox.c | 77 ++++++++++++++++------------------ generic/tkMain.c | 22 +++++----- generic/tkMenu.c | 102 +++++++++++++++++++++------------------------ generic/tkMenuDraw.c | 54 ++++++++++-------------- generic/tkMessage.c | 40 ++++++++---------- generic/tkObj.c | 4 +- generic/tkOldConfig.c | 10 ++--- generic/tkOption.c | 10 ++--- generic/tkPack.c | 50 +++++++++++----------- generic/tkPanedWindow.c | 12 +++--- generic/tkPlace.c | 34 +++++++-------- generic/tkRectOval.c | 25 +++++------ generic/tkScale.c | 33 +++++++-------- generic/tkScrollbar.c | 16 +++---- generic/tkSelect.c | 6 +-- generic/tkSquare.c | 24 +++++------ generic/tkTest.c | 89 ++++++++++++++++++++------------------- generic/tkUtil.c | 24 +++++------ generic/tkVisual.c | 4 +- generic/tkWindow.c | 61 +++++++++++++-------------- 56 files changed, 984 insertions(+), 1100 deletions(-) diff --git a/generic/tk3d.c b/generic/tk3d.c index 3f40931..55ca340 100644 --- a/generic/tk3d.c +++ b/generic/tk3d.c @@ -750,7 +750,7 @@ Tk_Draw3DPolygon( XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ - Tcl_Size numPoints1, /* Number of points at *pointPtr. */ + Tcl_Size numPoints, /* Number of points at *pointPtr. */ int borderWidth, /* Width of border, measured in pixels to the * left of the polygon's trajectory. May be * negative. */ @@ -763,9 +763,9 @@ Tk_Draw3DPolygon( XPoint *p1Ptr, *p2Ptr; TkBorder *borderPtr = (TkBorder *) border; GC gc; - int i, lightOnLeft, dx, dy, parallel, pointsSeen; + Tcl_Size i; + int lightOnLeft, dx, dy, parallel, pointsSeen; Display *display = Tk_Display(tkwin); - int numPoints = numPoints1; if (borderPtr->lightGC == NULL) { TkpGetShadows(borderPtr, tkwin); @@ -837,9 +837,9 @@ Tk_Draw3DPolygon( */ pointsSeen = 0; - for (i = -2, p1Ptr = &pointPtr[numPoints-2], p2Ptr = p1Ptr+1; - i < numPoints; i++, p1Ptr = p2Ptr, p2Ptr++) { - if ((i == -1) || (i == numPoints-1)) { + for (i = 0, p1Ptr = &pointPtr[numPoints-2], p2Ptr = p1Ptr+1; + i < numPoints + 2; i++, p1Ptr = p2Ptr, p2Ptr++) { + if ((i == 1) || (i == numPoints + 1)) { p2Ptr = pointPtr; } if ((p2Ptr->x == p1Ptr->x) && (p2Ptr->y == p1Ptr->y)) { @@ -1020,7 +1020,7 @@ Tk_Fill3DPolygon( XPoint *pointPtr, /* Array of points describing polygon. All * points must be absolute * (CoordModeOrigin). */ - Tcl_Size numPoints1, /* Number of points at *pointPtr. */ + Tcl_Size numPoints, /* Number of points at *pointPtr. */ int borderWidth, /* Width of border, measured in pixels to the * left of the polygon's trajectory. May be * negative. */ @@ -1030,10 +1030,9 @@ Tk_Fill3DPolygon( * TK_RELIEF_SUNKEN. */ { TkBorder *borderPtr = (TkBorder *) border; - int numPoints = numPoints1; XFillPolygon(Tk_Display(tkwin), drawable, borderPtr->bgGC, - pointPtr, numPoints, Complex, CoordModeOrigin); + pointPtr, (int)numPoints, Complex, CoordModeOrigin); if (leftRelief != TK_RELIEF_FLAT) { Tk_Draw3DPolygon(tkwin, drawable, border, pointPtr, numPoints, borderWidth, leftRelief); @@ -1383,9 +1382,9 @@ TkDebugBorder( Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(borderPtr->resourceRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)borderPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(borderPtr->objRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)borderPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkArgv.c b/generic/tkArgv.c index e16dd3c..1a3244a 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -175,7 +175,7 @@ Tk_ParseArgv( infoPtr = matchPtr; switch (infoPtr->type) { case TK_ARGV_CONSTANT: - *((int *) infoPtr->dst) = PTR2INT(infoPtr->src); + *((int *) infoPtr->dst) = (int)PTR2INT(infoPtr->src); break; case TK_ARGV_INT: if (argc == 0) { @@ -363,7 +363,7 @@ PrintUsage( } } - message = Tcl_NewStringObj("Command-specific options:", -1); + message = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE); for (i = 0; ; i++) { for (infoPtr = i ? defaultTable : argTable; infoPtr->type != TK_ARGV_END; infoPtr++) { @@ -376,7 +376,7 @@ PrintUsage( while (numSpaces-- > 0) { Tcl_AppendToObj(message, " ", 1); } - Tcl_AppendToObj(message, infoPtr->help, -1); + Tcl_AppendToObj(message, infoPtr->help, TCL_INDEX_NONE); switch (infoPtr->type) { case TK_ARGV_INT: Tcl_AppendPrintfToObj(message, "\n\t\tDefault value: %d", @@ -403,7 +403,7 @@ PrintUsage( if ((flags & TK_ARGV_NO_DEFAULTS) || (i > 0)) { break; } - Tcl_AppendToObj(message, "\nGeneric options for all commands:", -1); + Tcl_AppendToObj(message, "\nGeneric options for all commands:", TCL_INDEX_NONE); } Tcl_SetObjResult(interp, message); } diff --git a/generic/tkBind.c b/generic/tkBind.c index 5f0b467..d0131ee 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -231,7 +231,7 @@ typedef struct { */ typedef struct { - ClientData object; /* For binding table, identifies the binding tag of the object + void *object; /* For binding table, identifies the binding tag of the object * (or class of objects) relative to which the event occurred. * For virtual event table, always NULL. */ unsigned type; /* Type of event (from X). */ @@ -723,7 +723,7 @@ static void DeleteVirtualEventTable(VirtualEventTable *vetPtr); static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPtr, unsigned scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables, - ClientData object, const char *eventString, int create, + void *object, const char *eventString, int create, int allowVirtual, unsigned *maskPtr); static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr); static const char * GetField(const char *p, char *copy, unsigned size); @@ -736,15 +736,15 @@ static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main, static void InitVirtualEventTable(VirtualEventTable *vetPtr); static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSList *psList, PSList *psSuccList, unsigned patIndex, const Event *eventPtr, - ClientData object, PatSeq **physPtrPtr); + void *object, PatSeq **physPtrPtr); static int NameToWindow(Tcl_Interp *interp, Tk_Window main, Tcl_Obj *objPtr, Tk_Window *tkwinPtr); static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, TkPattern *patPtr, unsigned *eventMaskPtr); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents); -static void ClearLookupTable(LookupTables *lookupTables, ClientData object); -static void ClearPromotionLists(Tk_BindingTable bindPtr, ClientData object); +static void ClearLookupTable(LookupTables *lookupTables, void *object); +static void ClearPromotionLists(Tk_BindingTable bindPtr, void *object); static PSEntry * MakeListEntry(PSList *pool, PatSeq *psPtr, int needModMasks); static void RemovePatSeqFromLookup(LookupTables *lookupTables, PatSeq *psPtr); static void RemovePatSeqFromPromotionLists(Tk_BindingTable bindPtr, PatSeq *psPtr); @@ -804,7 +804,7 @@ GetButtonNumber( { unsigned button; assert(field); - button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? field[0] - '0' : 0; + button = (field[0] >= '1' && field[0] <= '9' && field[1] == '\0') ? (unsigned)(field[0] - '0') : 0; return (button > 3) ? (button + 4) : button; } @@ -861,14 +861,14 @@ CountSpecialized( return sndCount - fstCount; } -int +static int IsKeyEventType( - unsigned eventType) + int eventType) { return eventType == KeyPress || eventType == KeyRelease; } -int +static int IsButtonEventType( unsigned eventType) { @@ -940,7 +940,7 @@ static void ClearList( PSList *psList, PSList *pool, - ClientData object) + void *object) { assert(psList); assert(pool); @@ -1168,7 +1168,7 @@ GetLookupForEvent( static void ClearLookupTable( LookupTables *lookupTables, - ClientData object) + void *object) { Tcl_HashSearch search; Tcl_HashEntry *hPtr; @@ -1218,7 +1218,7 @@ ClearLookupTable( static void ClearPromotionLists( Tk_BindingTable bindPtr, - ClientData object) + void *object) { unsigned newArraySize = 0; unsigned i; @@ -1643,7 +1643,7 @@ unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ - ClientData object, /* Token for object with which binding is associated. */ + void *object, /* Token for object with which binding is associated. */ const char *eventString, /* String describing event sequence that triggers binding. */ const char *script, /* Contains Tcl script to execute when binding triggers. */ int append) /* 0 means replace any existing binding for eventString; @@ -1742,7 +1742,7 @@ int Tk_DeleteBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to delete binding. */ - ClientData object, /* Token for object with which binding is associated. */ + void *object, /* Token for object with which binding is associated. */ const char *eventString) /* String describing event sequence that triggers binding. */ { PatSeq *psPtr; @@ -1815,7 +1815,7 @@ const char * Tk_GetBinding( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to look for binding. */ - ClientData object, /* Token for object with which binding is associated. */ + void *object, /* Token for object with which binding is associated. */ const char *eventString) /* String describing event sequence that triggers binding. */ { const PatSeq *psPtr; @@ -1853,7 +1853,7 @@ void Tk_GetAllBindings( Tcl_Interp *interp, /* Interpreter returning result or error. */ Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ - ClientData object) /* Token for object. */ + void *object) /* Token for object. */ { Tcl_HashEntry *hPtr; @@ -2042,7 +2042,7 @@ DeletePatSeq( void Tk_DeleteAllBindings( Tk_BindingTable bindPtr, /* Table in which to delete bindings. */ - ClientData object) /* Token for object. */ + void *object) /* Token for object. */ { PatSeq *psPtr; PatSeq *nextPtr; @@ -2170,7 +2170,7 @@ Tk_BindEvent( Tk_Window tkwin, /* Window on display where event occurred (needed in order to * locate display information). */ Tcl_Size numObjects, /* Number of objects at *objArr. */ - ClientData *objArr) /* Array of one or more objects to check for a matching binding. */ + void **objArr) /* Array of one or more objects to check for a matching binding. */ { Tcl_Interp *interp; ScreenInfo *screenPtr; @@ -2193,7 +2193,7 @@ Tk_BindEvent( unsigned flags; unsigned arraySize; unsigned newArraySize; - size_t i, k; + Tcl_Size i, k; assert(bindPtr); assert(eventPtr); @@ -2266,7 +2266,7 @@ Tk_BindEvent( bindInfoPtr->lastEventTime = eventPtr->xkey.time; } /* Modifier keys should not influence button events. */ - for (i = 0; i < (size_t) dispPtr->numModKeyCodes; ++i) { + for (i = 0; i < dispPtr->numModKeyCodes; ++i) { if (dispPtr->modKeyCodes[i] == eventPtr->xkey.keycode) { reset = 0; } @@ -2614,7 +2614,7 @@ Tk_BindEvent( Tcl_Preserve(bindInfoPtr); for (p = Tcl_DStringValue(&scripts), end = p + Tcl_DStringLength(&scripts); p < end; ) { - unsigned len = strlen(p); + Tcl_Size len = strlen(p); int code; if (!bindInfoPtr->deleted) { @@ -2679,7 +2679,7 @@ static int VirtPatIsBound( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr, /* Test this pattern. */ - ClientData object, /* Check for this binding tag. */ + void *object, /* Check for this binding tag. */ PatSeq **physPtrPtr) /* Input: the best physical event. * Output: the physical event associated with matching virtual event. */ { @@ -2808,7 +2808,7 @@ MatchPatterns( * Can be NULL. */ unsigned patIndex, /* Match only this tag in sequence. */ const Event *curEvent, /* Match this event. */ - ClientData object, /* Check for this binding tag. */ + void *object, /* Check for this binding tag. */ PatSeq **physPtrPtr) /* Input: the best physical event; NULL if we test physical events. * Output: the associated physical event for the best matching virtual * event; NULL when we match physical events. */ @@ -2819,7 +2819,8 @@ MatchPatterns( PatSeq *bestPhysPtr; unsigned bestModMask; const PSModMaskArr *bestModMaskArr = NULL; - int i, isModKeyOnly = 0; + int isModKeyOnly = 0; + Tcl_Size i; assert(dispPtr); assert(bindPtr); @@ -3040,7 +3041,7 @@ ExpandPercents( for (string = before; *string && *string != '%'; ++string) ; if (string != before) { - Tcl_DStringAppend(dsPtr, before, string - before); + Tcl_DStringAppend(dsPtr, before, (Tcl_Size)(string - before)); before = string; } if (!*before) { @@ -3291,8 +3292,8 @@ ExpandPercents( } { /* local scope */ int cvtFlags; - unsigned spaceNeeded = Tcl_ScanElement(string, &cvtFlags); - unsigned length = Tcl_DStringLength(dsPtr); + Tcl_Size spaceNeeded = Tcl_ScanElement(string, &cvtFlags); + Tcl_Size length = Tcl_DStringLength(dsPtr); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); spaceNeeded = Tcl_ConvertElement( @@ -3366,7 +3367,7 @@ ChangeScreen( int Tk_EventObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3964,12 +3965,12 @@ HandleEventGenerate( } if (count != 1u) { Tcl_SetObjResult(interp, - Tcl_NewStringObj("Double, Triple, or Quadruple modifier not allowed", -1)); + Tcl_NewStringObj("Double, Triple, or Quadruple modifier not allowed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "BAD_MODIFIER", NULL); return TCL_ERROR; } if (*p) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("only one event specification allowed", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("only one event specification allowed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "MULTIPLE", NULL); return TCL_ERROR; } @@ -4689,7 +4690,7 @@ static PatSeq * FindSequence( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ LookupTables *lookupTables, /* Tables used for lookup. */ - ClientData object, /* For binding table, token for object with which binding is + void *object, /* For binding table, token for object with which binding is * associated. For virtual event table, NULL. */ const char *eventString, /* String description of pattern to match on. See user * documentation for details. */ @@ -4743,7 +4744,7 @@ FindSequence( if (eventMask & VirtualEventMask) { if (!allowVirtual) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "virtual event not allowed in definition of another virtual event", -1)); + "virtual event not allowed in definition of another virtual event", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "INNER", NULL); ckfree(psPtr); return NULL; @@ -4767,13 +4768,13 @@ FindSequence( */ if (numPats == 0) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("no events specified in binding", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("no events specified in binding", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "NO_EVENTS", NULL); ckfree(psPtr); return NULL; } if (numPats > 1u && virtualFound) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("virtual events may not be composed", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("virtual events may not be composed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "COMPOSITION", NULL); ckfree(psPtr); return NULL; @@ -4957,13 +4958,13 @@ ParseEventDescription( return FinalizeParseEventDescription( interp, patPtr, 0, - Tcl_NewStringObj("virtual event \"<<>>\" is badly formed", -1), "MALFORMED"); + Tcl_NewStringObj("virtual event \"<<>>\" is badly formed", TCL_INDEX_NONE), "MALFORMED"); } if (!p || p[1] != '>') { return FinalizeParseEventDescription( interp, patPtr, 0, - Tcl_NewStringObj("missing \">\" in virtual binding", -1), "MALFORMED"); + Tcl_NewStringObj("missing \">\" in virtual binding", TCL_INDEX_NONE), "MALFORMED"); } size = p - field; @@ -5087,7 +5088,7 @@ ParseEventDescription( return FinalizeParseEventDescription( interp, patPtr, 0, - Tcl_NewStringObj("no event type or button # or keysym", -1), "UNMODIFIABLE"); + Tcl_NewStringObj("no event type or button # or keysym", TCL_INDEX_NONE), "UNMODIFIABLE"); } else if (patPtr->eventType == MotionNotify) { patPtr->info = ButtonNumberFromState(patPtr->modMask); } @@ -5101,14 +5102,14 @@ ParseEventDescription( return FinalizeParseEventDescription( interp, patPtr, 0, - Tcl_NewStringObj("extra characters after detail in binding", -1), + Tcl_NewStringObj("extra characters after detail in binding", TCL_INDEX_NONE), "PAST_DETAIL"); } } return FinalizeParseEventDescription( interp, patPtr, 0, - Tcl_NewStringObj("missing \">\" in binding", -1), "MALFORMED"); + Tcl_NewStringObj("missing \">\" in binding", TCL_INDEX_NONE), "MALFORMED"); } ++p; } @@ -5235,7 +5236,7 @@ GetPatternObj( assert(patPtr->eventType < TK_LASTEVENT); assert(((size_t) eventArrayIndex[patPtr->eventType]) < SIZE_OF_ARRAY(eventArray)); - Tcl_AppendToObj(patternObj, eventArray[eventArrayIndex[patPtr->eventType]].name, -1); + Tcl_AppendToObj(patternObj, eventArray[eventArrayIndex[patPtr->eventType]].name, TCL_INDEX_NONE); if (patPtr->info) { switch (patPtr->eventType) { @@ -5244,7 +5245,7 @@ GetPatternObj( const char *string = TkKeysymToString(patPtr->info); if (string) { Tcl_AppendToObj(patternObj, "-", 1); - Tcl_AppendToObj(patternObj, string, -1); + Tcl_AppendToObj(patternObj, string, TCL_INDEX_NONE); } break; } @@ -5305,13 +5306,13 @@ TkStringToKeysym( if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ } else if ((unsigned)(keysym - 0x21) <= 0x5D) { - return keysym; + return (KeySym)keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { - return keysym; + return (KeySym)keysym; } else if (keysym == 0x20AC) { return 0x20AC; } else { - return keysym + 0x1000000; + return (KeySym)keysym + 0x1000000; } } #ifdef REDO_KEYSYM_LOOKUP diff --git a/generic/tkBitmap.c b/generic/tkBitmap.c index 5ff8227..e80760d 100644 --- a/generic/tkBitmap.c +++ b/generic/tkBitmap.c @@ -350,7 +350,7 @@ GetBitmap( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't specify bitmap with '@' in a safe interpreter", - -1)); + TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL); goto error; } diff --git a/generic/tkBusy.c b/generic/tkBusy.c index 79414cf..8d40fc9 100644 --- a/generic/tkBusy.c +++ b/generic/tkBusy.c @@ -766,7 +766,7 @@ HoldBusy( TkpHideBusyWindow(busyPtr); } if (result == TCL_OK) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE)); } return result; } @@ -841,7 +841,7 @@ Tk_BusyObjCmd( Tcl_ResetResult(interp); return TCL_OK; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), TCL_INDEX_NONE)); return TCL_OK; case BUSY_CGET: diff --git a/generic/tkCanvArc.c b/generic/tkCanvArc.c index cfb5d0c..1e08db1 100644 --- a/generic/tkCanvArc.c +++ b/generic/tkCanvArc.c @@ -86,10 +86,10 @@ typedef struct ArcItem { * Information used for parsing configuration specs: */ -static int StyleParseProc(ClientData clientData, Tcl_Interp *interp, +static int StyleParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, Tcl_Size offset); -static const char * StylePrintProc(ClientData clientData, Tk_Window tkwin, +static const char * StylePrintProc(void *clientData, Tk_Window tkwin, char *widgRec, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); static const Tk_CustomOption stateOption = { @@ -507,7 +507,7 @@ ConfigureArc( tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5); } - mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline)); + mask = (unsigned long)Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline)); if (mask) { gcValues.cap_style = CapButt; mask |= GCCapStyle; @@ -2076,7 +2076,7 @@ ArcToPostscript( (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2); if (arcPtr->style != CHORD_STYLE) { - Tcl_AppendToObj(psObj, "0 0 moveto ", -1); + Tcl_AppendToObj(psObj, "0 0 moveto ", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(psObj, "0 0 1 %.15g %.15g arc closepath\nsetmatrix\n", @@ -2087,17 +2087,17 @@ ArcToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (arcPtr->outline.gc != NULL) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } @@ -2120,7 +2120,7 @@ ArcToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (arcPtr->style != ARC_STYLE) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); if (arcPtr->style == CHORD_STYLE) { @@ -2133,15 +2133,15 @@ ArcToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsPath(interp, canvas, @@ -2152,13 +2152,13 @@ ArcToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } } diff --git a/generic/tkCanvBmap.c b/generic/tkCanvBmap.c index 6a6de42..7a11822 100644 --- a/generic/tkCanvBmap.c +++ b/generic/tkCanvBmap.c @@ -417,12 +417,11 @@ ConfigureBitmap( static void DeleteBitmap( - Tk_Canvas canvas, /* Info about overall canvas widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall canvas widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; - (void)canvas; if (bmapPtr->bitmap != None) { Tk_FreeBitmap(display, bmapPtr->bitmap); @@ -673,13 +672,12 @@ DisplayBitmap( static double BitmapToPoint( - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against point. */ double *coordPtr) /* Pointer to x and y coordinates. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; - (void)canvas; x1 = bmapPtr->header.x1; y1 = bmapPtr->header.y1; @@ -730,14 +728,13 @@ BitmapToPoint( static int BitmapToArea( - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against rectangle. */ double *rectPtr) /* Pointer to array of four coordinates * (x1,y1,x2,y2) describing rectangular * area. */ { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; - (void)canvas; if ((rectPtr[2] <= bmapPtr->header.x1) || (rectPtr[0] >= bmapPtr->header.x2) @@ -879,7 +876,7 @@ BitmapToPostscript( Tcl_Interp *interp, /* Leave Postscript or error message here. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -893,7 +890,6 @@ BitmapToPostscript( Tk_State state = itemPtr->state; Tcl_Obj *psObj; Tcl_InterpState interpState; - (void)prepass; if (state == TK_STATE_NULL) { state = Canvas(canvas)->canvas_state; @@ -969,7 +965,7 @@ BitmapToPostscript( Tk_CanvasPsColor(interp, canvas, bgColor); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } /* @@ -987,7 +983,7 @@ BitmapToPostscript( if (width > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't generate Postscript for bitmaps more than 60000" - " pixels wide", -1)); + " pixels wide", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", NULL); goto error; } @@ -1014,7 +1010,7 @@ BitmapToPostscript( rowsThisTime); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - Tcl_AppendToObj(psObj, "\n} imagemask\n", -1); + Tcl_AppendToObj(psObj, "\n} imagemask\n", TCL_INDEX_NONE); } } diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c index 04df55e..bb79e19 100644 --- a/generic/tkCanvLine.c +++ b/generic/tkCanvLine.c @@ -110,16 +110,16 @@ static double LineToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *coordPtr); static int LineToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); -static int ArrowParseProc(ClientData clientData, +static int ArrowParseProc(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, Tcl_Size offset); -static const char * ArrowPrintProc(ClientData clientData, +static const char * ArrowPrintProc(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); -static int ParseArrowShape(ClientData clientData, +static int ParseArrowShape(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, Tcl_Size offset); -static const char * PrintArrowShape(ClientData clientData, +static const char * PrintArrowShape(void *clientData, Tk_Window tkwin, char *recordPtr, Tcl_Size offset, Tcl_FreeProc **freeProcPtr); static void RotateLine(Tk_Canvas canvas, Tk_Item *itemPtr, @@ -1864,7 +1864,7 @@ ScaleLine( static int GetLineIndex( Tcl_Interp *interp, /* Used for error reporting. */ - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item for which the index is being * specified. */ Tcl_Obj *obj, /* Specification of a particular coord in @@ -1874,7 +1874,6 @@ GetLineIndex( Tcl_Size idx, length; LineItem *linePtr = (LineItem *) itemPtr; const char *string; - (void)canvas; if (TCL_OK == TkGetIntForIndex(obj, 2*linePtr->numPoints - 1, 1, &idx)) { if (idx == TCL_INDEX_NONE) { @@ -2486,24 +2485,24 @@ LineToPostscript( */ if (linePtr->numPoints == 1) { - Tcl_AppendToObj(psObj, "matrix currentmatrix\n", -1); + Tcl_AppendToObj(psObj, "matrix currentmatrix\n", TCL_INDEX_NONE); Tcl_AppendPrintfToObj(psObj, "%.15g %.15g translate %.15g %.15g", linePtr->coordPtr[0], Tk_CanvasPsY(canvas, linePtr->coordPtr[1]), width/2.0, width/2.0); Tcl_AppendToObj(psObj, - " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", -1); + " scale 1 0 moveto 0 0 1 0 360 arc\nsetmatrix\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsColor(interp, canvas, color); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } goto done; } @@ -2578,14 +2577,14 @@ LineToPostscript( if (linePtr->firstArrowPtr != NULL) { if (stipple != None) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } ArrowheadPostscript(interp, canvas, linePtr, linePtr->firstArrowPtr, psObj); } if (linePtr->lastArrowPtr != NULL) { if (stipple != None) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } ArrowheadPostscript(interp, canvas, linePtr, linePtr->lastArrowPtr, psObj); @@ -2656,13 +2655,13 @@ ArrowheadPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } return TCL_OK; } diff --git a/generic/tkCanvPoly.c b/generic/tkCanvPoly.c index eda1c22..61859c4 100644 --- a/generic/tkCanvPoly.c +++ b/generic/tkCanvPoly.c @@ -1970,13 +1970,13 @@ PolygonToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (stipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, stipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } goto done; } @@ -1998,17 +1998,17 @@ PolygonToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { - Tcl_AppendToObj(psObj, "eoclip ", -1); + Tcl_AppendToObj(psObj, "eoclip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (color != NULL) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { - Tcl_AppendToObj(psObj, "eofill\n", -1); + Tcl_AppendToObj(psObj, "eofill\n", TCL_INDEX_NONE); } } diff --git a/generic/tkCanvPs.c b/generic/tkCanvPs.c index e338a85..3b2c7c3 100644 --- a/generic/tkCanvPs.c +++ b/generic/tkCanvPs.c @@ -192,7 +192,7 @@ TkCanvPostscriptObjCmd( * such. */ - result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", -1, TCL_EVAL_GLOBAL); + result = Tcl_EvalEx(interp, "::tk::ensure_psenc_is_loaded", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result != TCL_OK) { return result; } @@ -337,7 +337,7 @@ TkCanvPostscriptObjCmd( if (psInfo.channelName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't specify both -file and -channel", -1)); + "can't specify both -file and -channel", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "USAGE", NULL); result = TCL_ERROR; goto cleanup; @@ -350,7 +350,7 @@ TkCanvPostscriptObjCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't specify -file in a safe interpreter", -1)); + "can't specify -file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PS_FILE", NULL); result = TCL_ERROR; goto cleanup; @@ -431,7 +431,7 @@ TkCanvPostscriptObjCmd( if (psInfo.prolog) { Tcl_AppendToObj(psObj, "%!PS-Adobe-3.0 EPSF-3.0\n" - "%%Creator: Tk Canvas Widget\n", -1); + "%%Creator: Tk Canvas Widget\n", TCL_INDEX_NONE); #ifdef HAVE_PW_GECOS if (!Tcl_IsSafe(interp)) { @@ -477,7 +477,7 @@ TkCanvPostscriptObjCmd( Tcl_GetHashKey(&psInfo.fontTable, hPtr)); p = "%%%%+ font %s\n"; } - Tcl_AppendToObj(psObj, "%%EndComments\n\n", -1); + Tcl_AppendToObj(psObj, "%%EndComments\n\n", TCL_INDEX_NONE); /* * Insert the prolog @@ -510,7 +510,7 @@ TkCanvPostscriptObjCmd( "%%%%IncludeResource: font %s\n", (char *) Tcl_GetHashKey(&psInfo.fontTable, hPtr)); } - Tcl_AppendToObj(psObj, "%%EndSetup\n\n", -1); + Tcl_AppendToObj(psObj, "%%EndSetup\n\n", TCL_INDEX_NONE); /* * Page setup: move to page positioning point, rotate if needed, set @@ -518,11 +518,11 @@ TkCanvPostscriptObjCmd( * region. */ - Tcl_AppendToObj(psObj, "%%Page: 1 1\nsave\n", -1); + Tcl_AppendToObj(psObj, "%%Page: 1 1\nsave\n", TCL_INDEX_NONE); Tcl_AppendPrintfToObj(psObj, "%.1f %.1f translate\n", psInfo.pageX, psInfo.pageY); if (psInfo.rotate) { - Tcl_AppendToObj(psObj, "90 rotate\n", -1); + Tcl_AppendToObj(psObj, "90 rotate\n", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(psObj, "%.4g %.4g scale\n", psInfo.scale, psInfo.scale); @@ -576,9 +576,9 @@ TkCanvPostscriptObjCmd( goto cleanup; } - Tcl_AppendToObj(psObj, "gsave\n", -1); + Tcl_AppendToObj(psObj, "gsave\n", TCL_INDEX_NONE); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - Tcl_AppendToObj(psObj, "grestore\n", -1); + Tcl_AppendToObj(psObj, "grestore\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); if (psInfo.chan != NULL) { @@ -600,7 +600,7 @@ TkCanvPostscriptObjCmd( "restore showpage\n\n" "%%Trailer\n" "end\n" - "%%EOF\n", -1); + "%%EOF\n", TCL_INDEX_NONE); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { @@ -907,11 +907,11 @@ PostscriptBitmap( * syntactically correct. */ - Tcl_AppendToObj(psObj, "<>", -1); + Tcl_AppendToObj(psObj, "<>", TCL_INDEX_NONE); return; } - Tcl_AppendToObj(psObj, "<", -1); + Tcl_AppendToObj(psObj, "<", TCL_INDEX_NONE); mask = 0x80; value = 0; charsInLine = 0; @@ -929,7 +929,7 @@ PostscriptBitmap( value = 0; charsInLine += 2; if (charsInLine >= 60) { - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); charsInLine = 0; } } @@ -941,7 +941,7 @@ PostscriptBitmap( charsInLine += 2; } } - Tcl_AppendToObj(psObj, ">", -1); + Tcl_AppendToObj(psObj, ">", TCL_INDEX_NONE); XDestroyImage(imagePtr); } @@ -1002,7 +1002,7 @@ Tk_PostscriptStipple( psObj = GetPostscriptBuffer(interp); Tcl_AppendPrintfToObj(psObj, "%d %d ", width, height); PostscriptBitmap(tkwin, bitmap, 0, 0, width, height, psObj); - Tcl_AppendToObj(psObj, " StippleFill\n", -1); + Tcl_AppendToObj(psObj, " StippleFill\n", TCL_INDEX_NONE); return TCL_OK; } @@ -1196,13 +1196,11 @@ GetPostscriptPoints( #if defined(_WIN32) || defined(MAC_OSX_TK) static void TkImageGetColor( - TkColormapData *cdata, + TCL_UNUSED(TkColormapData *), unsigned long pixel, /* Pixel value to look up */ 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; @@ -1405,7 +1403,7 @@ TkPostscriptImage( lineLen += 2; if (lineLen > 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; @@ -1433,7 +1431,7 @@ TkPostscriptImage( lineLen += 2; if (lineLen > 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; @@ -1453,7 +1451,7 @@ TkPostscriptImage( lineLen += 6; if (lineLen > 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; @@ -1461,9 +1459,9 @@ TkPostscriptImage( } switch (level) { case 0: case 1: - Tcl_AppendToObj(psObj, ">\n} image\n", -1); break; + Tcl_AppendToObj(psObj, ">\n} image\n", TCL_INDEX_NONE); break; default: - Tcl_AppendToObj(psObj, ">\n} false 3 colorimage\n", -1); break; + Tcl_AppendToObj(psObj, ">\n} false 3 colorimage\n", TCL_INDEX_NONE); break; } Tcl_AppendPrintfToObj(psObj, "0 %d translate\n", rows); } @@ -1556,17 +1554,17 @@ Tk_PostscriptPhoto( psObj = GetPostscriptBuffer(interp); switch (colorLevel) { case 0: - Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", -1); + Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", TCL_INDEX_NONE); decode = "1 0"; bpc = 1; break; case 1: - Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", -1); + Tcl_AppendToObj(psObj, "/DeviceGray setcolorspace\n\n", TCL_INDEX_NONE); decode = "0 1"; bpc = 8; break; default: - Tcl_AppendToObj(psObj, "/DeviceRGB setcolorspace\n\n", -1); + Tcl_AppendToObj(psObj, "/DeviceRGB setcolorspace\n\n", TCL_INDEX_NONE); decode = "0 1 0 1 0 1"; bpc = 8; break; @@ -1642,7 +1640,7 @@ Tk_PostscriptPhoto( lineLen += 2; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; @@ -1681,7 +1679,7 @@ Tk_PostscriptPhoto( lineLen += 2; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } mask = 0x80; data = 0x00; @@ -1707,7 +1705,7 @@ Tk_PostscriptPhoto( lineLen += 2; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } @@ -1729,7 +1727,7 @@ Tk_PostscriptPhoto( lineLen += 2; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; @@ -1747,7 +1745,7 @@ Tk_PostscriptPhoto( lineLen += 2; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } @@ -1767,7 +1765,7 @@ Tk_PostscriptPhoto( lineLen += 6; if (lineLen >= 60) { lineLen = 0; - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } } break; @@ -1778,7 +1776,7 @@ Tk_PostscriptPhoto( * The end-of-data marker. */ - Tcl_AppendToObj(psObj, ">\n", -1); + Tcl_AppendToObj(psObj, ">\n", TCL_INDEX_NONE); return TCL_OK; } diff --git a/generic/tkCanvText.c b/generic/tkCanvText.c index a1c8d42..c8492f3 100644 --- a/generic/tkCanvText.c +++ b/generic/tkCanvText.c @@ -99,9 +99,9 @@ static const Tk_CustomOption offsetOption = { static int UnderlineParseProc( - ClientData dummy, /* Not used.*/ + TCL_UNUSED(void *), /* Not used.*/ 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. */ Tcl_Size offset) /* Offset into item (ignored). */ @@ -110,8 +110,6 @@ UnderlineParseProc( Tcl_Obj obj; int code; Tcl_Size underline; - (void)dummy; - (void)tkwin; if (value == NULL || *value == 0) { *underlinePtr = INT_MIN; /* No underline */ @@ -125,13 +123,13 @@ UnderlineParseProc( code = TkGetIntForIndex(&obj, TCL_INDEX_END, 0, &underline); if (code == TCL_OK) { if (underline == TCL_INDEX_NONE) { - underline = INT_MIN; + underline = (Tcl_Size)INT_MIN; } else if ((size_t)underline > (size_t)TCL_INDEX_END>>1) { underline++; } else if (underline >= INT_MAX) { underline = INT_MAX; } - *underlinePtr = underline; + *underlinePtr = (int)underline; } else { Tcl_AppendResult(interp, "bad index \"", value, @@ -140,10 +138,10 @@ UnderlineParseProc( return code; } -const char * +static const char * UnderlinePrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Pointer to record for item. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with @@ -152,8 +150,6 @@ UnderlinePrintProc( { int underline = *(int *)(widgRec + offset); char *p; - (void)dummy; - (void)tkwin; if (underline == INT_MIN) { #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 @@ -1491,7 +1487,7 @@ GetTextIndex( && (strncmp(string, "sel.first", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "selection isn't in item", -1)); + "selection isn't in item", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", NULL); return TCL_ERROR; } @@ -1500,7 +1496,7 @@ GetTextIndex( && (strncmp(string, "sel.last", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "selection isn't in item", -1)); + "selection isn't in item", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", NULL); return TCL_ERROR; } diff --git a/generic/tkCanvUtil.c b/generic/tkCanvUtil.c index b4c9852..beff519 100644 --- a/generic/tkCanvUtil.c +++ b/generic/tkCanvUtil.c @@ -46,7 +46,7 @@ static const Tk_SmoothMethod tkRawSmoothMethod = { * Function forward-declarations. */ -static void SmoothMethodCleanupProc(ClientData clientData, +static void SmoothMethodCleanupProc(void *clientData, Tcl_Interp *interp); static SmoothAssocData *InitSmoothMethods(Tcl_Interp *interp); static int DashConvert(char *l, const char *p, int n, @@ -235,14 +235,12 @@ Tk_CanvasWindowCoords( int Tk_CanvasGetCoord( - Tcl_Interp *dummy, /* Interpreter for error reporting. */ + TCL_UNUSED(Tcl_Interp *), /* 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; @@ -273,14 +271,12 @@ Tk_CanvasGetCoord( int Tk_CanvasGetCoordFromObj( - Tcl_Interp *dummy, /* Interpreter for error reporting. */ + TCL_UNUSED(Tcl_Interp *), /* 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); } @@ -407,20 +403,17 @@ Tk_CanvasGetTextInfo( int Tk_CanvasTagsParseProc( - ClientData dummy, /* Not used.*/ + TCL_UNUSED(void *), 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 (list of tag names). */ char *widgRec, /* Pointer to record for item. */ - Tcl_Size offset) /* Offset into item (ignored). */ + TCL_UNUSED(Tcl_Size)) /* Offset into item (ignored). */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; Tcl_Size argc, i; const char **argv; Tk_Uid *newPtr; - (void)dummy; - (void)tkwin; - (void)offset; /* * Break the value up into the individual tag names. @@ -477,18 +470,15 @@ Tk_CanvasTagsParseProc( const char * Tk_CanvasTagsPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ - Tcl_Size offset, /* Ignored. */ + TCL_UNUSED(Tcl_Size), /* Ignored. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with * information about how to reclaim storage * for return string. */ { Tk_Item *itemPtr = (Tk_Item *) widgRec; - (void)dummy; - (void)tkwin; - (void)offset; if (itemPtr->numTags == 0) { *freeProcPtr = NULL; @@ -522,16 +512,13 @@ Tk_CanvasTagsPrintProc( int TkCanvasDashParseProc( - ClientData dummy, /* Not used.*/ + TCL_UNUSED(void *), 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. */ Tcl_Size offset) /* Offset into item. */ { - (void)dummy; - (void)tkwin; - return Tk_GetDash(interp, value, (Tk_Dash *) (widgRec+offset)); } @@ -559,8 +546,8 @@ TkCanvasDashParseProc( const char * TkCanvasDashPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size offset, /* Offset in record for item. */ Tcl_FreeProc **freeProcPtr) /* Pointer to variable to fill in with @@ -570,13 +557,11 @@ 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 = (char *)ckalloc(i + 1); + buffer = (char *)ckalloc((Tcl_Size)i + 1); p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; memcpy(buffer, p, (unsigned int) i); buffer[i] = 0; @@ -585,13 +570,13 @@ TkCanvasDashPrintProc( *freeProcPtr = NULL; return ""; } - buffer = (char *)ckalloc(4 * i); + buffer = (char *)ckalloc(4 * (Tcl_Size)i); *freeProcPtr = TCL_DYNAMIC; p = (i > (int)sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - snprintf(buffer, 4 * i, "%d", *p++ & 0xff); + snprintf(buffer, 4 * (size_t)i, "%d", *p++ & 0xff); while (--i) { - snprintf(buffer + strlen(buffer), 4 * i - strlen(buffer), " %d", *p++ & 0xff); + snprintf(buffer + strlen(buffer), 4 * (size_t)i - strlen(buffer), " %d", *p++ & 0xff); } return buffer; } @@ -713,12 +698,11 @@ Tk_CreateSmoothMethod( static void SmoothMethodCleanupProc( - ClientData clientData, /* Points to "smoothMethod" AssocData for the + void *clientData, /* Points to "smoothMethod" AssocData for the * interpreter. */ - Tcl_Interp *dummy) /* Interpreter that is being deleted. */ + TCL_UNUSED(Tcl_Interp *)) /* Interpreter that is being deleted. */ { SmoothAssocData *ptr, *methods = (SmoothAssocData *)clientData; - (void)dummy; while (methods != NULL) { ptr = methods; @@ -746,9 +730,9 @@ SmoothMethodCleanupProc( int TkSmoothParseProc( - ClientData dummy, /* Ignored. */ + TCL_UNUSED(void *), 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. */ Tcl_Size offset) /* Offset into item. */ @@ -759,8 +743,6 @@ TkSmoothParseProc( int b; size_t length; SmoothAssocData *methods; - (void)dummy; - (void)tkwin; if (value == NULL || *value == 0) { *smoothPtr = NULL; @@ -840,19 +822,16 @@ TkSmoothParseProc( const char * TkSmoothPrintProc( - ClientData dummy, /* Ignored. */ - Tk_Window tkwin, /* Window containing canvas widget. */ + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), /* Window containing canvas widget. */ char *widgRec, /* Pointer to record for item. */ Tcl_Size 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. */ { const Tk_SmoothMethod *smoothPtr = * (Tk_SmoothMethod **) (widgRec + offset); - (void)dummy; - (void)tkwin; - (void)freeProcPtr; return smoothPtr ? smoothPtr->name : "0"; } @@ -900,7 +879,7 @@ Tk_GetDash( if (i <= 0) { goto badDashList; } - i = strlen(value); + i = (int)strlen(value); if (i > (int) sizeof(char *)) { dash->pattern.pt = pt = (char *)ckalloc(strlen(value)); } else { @@ -1454,7 +1433,7 @@ Tk_CanvasPsOutline( ptr = ((unsigned) ABS(dash->number) > sizeof(char *)) ? dash->pattern.pt : dash->pattern.array; - Tcl_AppendToObj(psObj, "[", -1); + Tcl_AppendToObj(psObj, "[", TCL_INDEX_NONE); if (dash->number > 0) { Tcl_Obj *converted; char *p = ptr; @@ -1465,7 +1444,7 @@ Tk_CanvasPsOutline( } Tcl_AppendObjToObj(psObj, converted); if (dash->number & 1) { - Tcl_AppendToObj(psObj, " ", -1); + Tcl_AppendToObj(psObj, " ", TCL_INDEX_NONE); Tcl_AppendObjToObj(psObj, converted); } Tcl_DecrRefCount(converted); @@ -1484,22 +1463,22 @@ Tk_CanvasPsOutline( } Tcl_AppendPrintfToObj(psObj, "] %d setdash\n", outline->offset); } else { - Tcl_AppendToObj(psObj, "] 0 setdash\n", -1); + Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } if (lptr != pattern) { ckfree(lptr); } } else { - Tcl_AppendToObj(psObj, "] 0 setdash\n", -1); + Tcl_AppendToObj(psObj, "] 0 setdash\n", TCL_INDEX_NONE); } Tk_CanvasPsColor(interp, canvas, color); if (stipple != None) { - Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", -1); + Tcl_AppendToObj(GetPostscriptBuffer(interp), "StrokeClip ", TCL_INDEX_NONE); Tk_CanvasPsStipple(interp, canvas, stipple); } else { - Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", -1); + Tcl_AppendToObj(GetPostscriptBuffer(interp), "stroke\n", TCL_INDEX_NONE); } return TCL_OK; @@ -1665,7 +1644,7 @@ TkCanvTranslatePath( int numVertex, /* Number of vertices specified by * coordArr[] */ double *coordArr, /* X and Y coordinates for each vertex */ - int closedPath, /* True if this is a closed polygon */ + TCL_UNUSED(int), /* True if this is a closed polygon */ XPoint *outArr) /* Write results here, if not NULL */ { int numOutput = 0; /* Number of output coordinates */ @@ -1677,7 +1656,6 @@ 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 diff --git a/generic/tkCanvWind.c b/generic/tkCanvWind.c index 2ef4a82..c53b8b6 100644 --- a/generic/tkCanvWind.c +++ b/generic/tkCanvWind.c @@ -87,11 +87,11 @@ static void TranslateWinItem(Tk_Canvas canvas, static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, Tcl_Size objc, Tcl_Obj *const objv[]); -static void WinItemLostContentProc(ClientData clientData, +static void WinItemLostContentProc(void *clientData, Tk_Window tkwin); -static void WinItemRequestProc(ClientData clientData, +static void WinItemRequestProc(void *clientData, Tk_Window tkwin); -static void WinItemStructureProc(ClientData clientData, +static void WinItemStructureProc(void *clientData, XEvent *eventPtr); static int WinItemToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); @@ -100,7 +100,7 @@ static int WinItemToPostscript(Tcl_Interp *interp, static double WinItemToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); #ifdef X_GetImage -static int xerrorhandler(ClientData clientData, XErrorEvent *e); +static int xerrorhandler(void *clientData, XErrorEvent *e); #endif static int CanvasPsWindow(Tcl_Interp *interp, Tk_Window tkwin, Tk_Canvas canvas, double x, @@ -207,10 +207,10 @@ CreateWinItem( i = 1; } } - if (WinItemCoords(interp, canvas, itemPtr, i, objv) != TCL_OK) { + if (WinItemCoords(interp, canvas, itemPtr, (Tcl_Size)i, objv) != TCL_OK) { goto error; } - if (ConfigureWinItem(interp, canvas, itemPtr, objc-i, objv+i, 0) + if (ConfigureWinItem(interp, canvas, itemPtr, objc-(Tcl_Size)i, objv+i, 0) == TCL_OK) { return TCL_OK; } @@ -404,11 +404,10 @@ static void DeleteWinItem( Tk_Canvas canvas, /* Overall info about widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ - Display *display) /* Display containing window for canvas. */ + TCL_UNUSED(Display *)) /* Display containing window for canvas. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; Tk_Window canvasTkwin = Tk_CanvasTkwin(canvas); - (void)display; if (winItemPtr->tkwin != NULL) { Tk_DeleteEventHandler(winItemPtr->tkwin, StructureNotifyMask, @@ -560,22 +559,18 @@ static void DisplayWinItem( Tk_Canvas canvas, /* Canvas that contains item. */ Tk_Item *itemPtr, /* Item to be displayed. */ - Display *display, /* Display on which to draw item. */ + TCL_UNUSED(Display *), /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int regionX, int regionY, int regionWidth, int regionHeight) - /* Describes region of canvas that must be - * redisplayed (not used). */ + TCL_UNUSED(int), /* Describes region of canvas that must be */ + TCL_UNUSED(int), /* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { WindowItem *winItemPtr = (WindowItem *) itemPtr; int width, height; 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; @@ -668,13 +663,12 @@ DisplayWinItem( static double WinItemToPoint( - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against point. */ double *pointPtr) /* Pointer to x and y coordinates. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; double x1, x2, y1, y2, xDiff, yDiff; - (void)canvas; x1 = winItemPtr->header.x1; y1 = winItemPtr->header.y1; @@ -725,14 +719,13 @@ WinItemToPoint( static int WinItemToArea( - Tk_Canvas canvas, /* Canvas containing item. */ + TCL_UNUSED(Tk_Canvas), /* Canvas containing item. */ Tk_Item *itemPtr, /* Item to check against rectangle. */ double *rectPtr) /* Pointer to array of four coordinates * (x1,y1,x2,y2) describing rectangular * area. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; - (void)canvas; if ((rectPtr[2] <= winItemPtr->header.x1) || (rectPtr[0] >= winItemPtr->header.x2) @@ -769,12 +762,9 @@ WinItemToArea( #ifdef X_GetImage static int xerrorhandler( - ClientData dummy, - XErrorEvent *e) + TCL_UNUSED(void *), + TCL_UNUSED(XErrorEvent *)) { - (void)dummy; - (void)e; - return 0; } #endif /* X_GetImage */ @@ -885,7 +875,7 @@ CanvasPsWindow( "1.000 1.000 1.000 setrgbcolor AdjustColor\nfill\ngrestore\n", height, width, height, width); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); - Tcl_AppendToObj(psObj, "\nrestore\nend\n\n\n", -1); + Tcl_AppendToObj(psObj, "\nrestore\nend\n\n\n", TCL_INDEX_NONE); goto done; } @@ -1062,7 +1052,7 @@ TranslateWinItem( static void WinItemStructureProc( - ClientData clientData, /* Pointer to record describing window item. */ + void *clientData, /* Pointer to record describing window item. */ XEvent *eventPtr) /* Describes what just happened. */ { WindowItem *winItemPtr = (WindowItem *)clientData; @@ -1092,11 +1082,10 @@ WinItemStructureProc( static void WinItemRequestProc( - ClientData clientData, /* Pointer to record for window item. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + void *clientData, /* Pointer to record for window item. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { WindowItem *winItemPtr = (WindowItem *)clientData; - (void)tkwin; ComputeWindowBbox(winItemPtr->canvas, winItemPtr); @@ -1128,13 +1117,12 @@ WinItemRequestProc( static void WinItemLostContentProc( - ClientData clientData, /* WindowItem structure for content window window that + void *clientData, /* WindowItem structure for content window window that * was stolen away. */ - Tk_Window tkwin) /* Tk's handle for the content window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { 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 5f3d9ff..23a16d8 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -261,7 +261,7 @@ static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, Tcl_Obj *const *objv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); #if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9) -static const char** TkGetStringsFromObjs(int objc, Tcl_Obj *const *objv); +static const char** TkGetStringsFromObjs(Tcl_Size objc, Tcl_Obj *const *objv); #endif static void InitCanvas(void); static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr); @@ -561,20 +561,20 @@ ItemScale( xOrigin, yOrigin, xScale, yScale); } -static inline int +static inline Tcl_Size ItemSelection( TkCanvas *canvasPtr, Tk_Item *itemPtr, int offset, char *buffer, - int maxBytes) + Tcl_Size maxBytes) { if (itemPtr == NULL || itemPtr->typePtr->selectionProc == NULL) { - return -1; + return TCL_INDEX_NONE; } - return itemPtr->typePtr->selectionProc((Tk_Canvas) canvasPtr, itemPtr, - offset, buffer, maxBytes); + return (Tcl_Size)itemPtr->typePtr->selectionProc((Tk_Canvas) canvasPtr, itemPtr, + offset, buffer, (int)maxBytes); } static inline void @@ -1070,7 +1070,7 @@ CanvasWidgetCmd( object, Tcl_GetString(objv[3])); Tcl_SetObjResult(interp, Tcl_NewStringObj( "requested illegal events; only key, button, motion," - " enter, leave, and virtual events may be used", -1)); + " enter, leave, and virtual events may be used", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "BAD_EVENTS", NULL); result = TCL_ERROR; goto done; @@ -1095,7 +1095,7 @@ CanvasWidgetCmd( } Tcl_ResetResult(interp); } else { - Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(command, TCL_INDEX_NONE)); } } else { Tk_GetAllBindings(interp, canvasPtr->bindingTable, object); @@ -1556,7 +1556,7 @@ CanvasWidgetCmd( for (i = 0; i < (int)itemPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, resultObj, - Tcl_NewStringObj(itemPtr->tagPtr[i], -1)); + Tcl_NewStringObj(itemPtr->tagPtr[i], TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); } @@ -1922,7 +1922,7 @@ CanvasWidgetCmd( } if ((xScale == 0.0) || (yScale == 0.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "scale factor cannot be zero", -1)); + "scale factor cannot be zero", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "BAD_SCALE", NULL); result = TCL_ERROR; goto done; @@ -2090,7 +2090,7 @@ CanvasWidgetCmd( FIRST_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done); if (itemPtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(itemPtr->typePtr->name, -1)); + Tcl_NewStringObj(itemPtr->typePtr->name, TCL_INDEX_NONE)); } break; case CANV_XVIEW: { @@ -4027,7 +4027,7 @@ TagSearchScanExpr( case '!': /* Negate next tag or subexpr */ if (looking_for_tag > 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "too many '!' in tag search expression", -1)); + "too many '!' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "COMPLEXITY", NULL); return TCL_ERROR; @@ -4077,7 +4077,7 @@ TagSearchScanExpr( } if (!found_endquote) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "missing endquote in tag search expression", -1)); + "missing endquote in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "ENDQUOTE", NULL); return TCL_ERROR; @@ -4085,7 +4085,7 @@ TagSearchScanExpr( if (!(tag - searchPtr->rewritebuffer)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "null quoted tag string in tag search expression", - -1)); + TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "EMPTY", NULL); return TCL_ERROR; @@ -4102,7 +4102,7 @@ TagSearchScanExpr( case '^': case ')': Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unexpected operator in tag search expression", -1)); + "unexpected operator in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "UNEXPECTED", NULL); return TCL_ERROR; @@ -4166,7 +4166,7 @@ TagSearchScanExpr( c = searchPtr->string[searchPtr->stringIndex++]; if (c != '&') { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "singleton '&' in tag search expression", -1)); + "singleton '&' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "INCOMPLETE_OP", NULL); return TCL_ERROR; @@ -4179,7 +4179,7 @@ TagSearchScanExpr( c = searchPtr->string[searchPtr->stringIndex++]; if (c != '|') { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "singleton '|' in tag search expression", -1)); + "singleton '|' in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "INCOMPLETE_OP", NULL); return TCL_ERROR; @@ -4200,7 +4200,7 @@ TagSearchScanExpr( default: /* syntax error */ Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid boolean operator in tag search expression", - -1)); + TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "BAD_OP", NULL); return TCL_ERROR; @@ -4213,7 +4213,7 @@ TagSearchScanExpr( return TCL_OK; } Tcl_SetObjResult(interp, Tcl_NewStringObj( - "missing tag in tag search expression", -1)); + "missing tag in tag search expression", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "SEARCH", "NO_TAG", NULL); return TCL_ERROR; } @@ -5924,10 +5924,10 @@ CanvasUpdateScrollbars( xOrigin + width - inset, scrollX1, scrollX2); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, xScrollCmd, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&buf, xScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, Tcl_GetString(fractions), TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { @@ -5942,10 +5942,10 @@ CanvasUpdateScrollbars( yOrigin + height - inset, scrollY1, scrollY2); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, yScrollCmd, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, Tcl_GetString(fractions), -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&buf, yScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, Tcl_GetString(fractions), TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); Tcl_DecrRefCount(fractions); if (result != TCL_OK) { @@ -6105,10 +6105,10 @@ CanvasSetOrigin( #if !defined(TK_NO_DEPRECATED) && (TK_MAJOR_VERSION < 9) static const char ** TkGetStringsFromObjs( - int objc, + Tcl_Size objc, Tcl_Obj *const objv[]) { - int i; + Tcl_Size i; const char **argv; if (objc <= 0) { diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index 8dd9cd4..1b16b86 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -19,14 +19,14 @@ * Prototypes for functions used only in this file: */ -static Tcl_Size ClipboardAppHandler(ClientData clientData, +static Tcl_Size ClipboardAppHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); -static Tcl_Size ClipboardHandler(ClientData clientData, +static Tcl_Size ClipboardHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); -static Tcl_Size ClipboardWindowHandler(ClientData clientData, +static Tcl_Size ClipboardWindowHandler(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); -static void ClipboardLostSel(ClientData clientData); -static int ClipboardGetProc(ClientData clientData, +static void ClipboardLostSel(void *clientData); +static int ClipboardGetProc(void *clientData, Tcl_Interp *interp, const char *portion); /* @@ -50,7 +50,7 @@ static int ClipboardGetProc(ClientData clientData, static Tcl_Size ClipboardHandler( - ClientData clientData, /* Information about data to fetch. */ + void *clientData, /* Information about data to fetch. */ Tcl_Size offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ @@ -128,7 +128,7 @@ ClipboardHandler( static Tcl_Size ClipboardAppHandler( - ClientData clientData, /* Pointer to TkDisplay structure. */ + void *clientData, /* Pointer to TkDisplay structure. */ Tcl_Size offset, /* Return selection bytes starting at this * offset. */ char *buffer, /* Place to store converted selection. */ @@ -204,7 +204,7 @@ ClipboardWindowHandler( static void ClipboardLostSel( - ClientData clientData) /* Pointer to TkDisplay structure. */ + void *clientData) /* Pointer to TkDisplay structure. */ { TkDisplay *dispPtr = (TkDisplay *)clientData; @@ -418,7 +418,7 @@ Tk_ClipboardAppend( int Tk_ClipboardObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -703,7 +703,7 @@ TkClipInit( static int ClipboardGetProc( - ClientData clientData, /* Dynamic string holding partially assembled + void *clientData, /* Dynamic string holding partially assembled * selection. */ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not * used). */ @@ -712,8 +712,8 @@ ClipboardGetProc( Tcl_Encoding utf8 = Tcl_GetEncoding(NULL, "utf-8"); Tcl_DString ds; - (void)Tcl_ExternalToUtfDString(utf8, portion, -1, &ds); - Tcl_DStringAppend((Tcl_DString *) clientData, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); + const char *str = Tcl_ExternalToUtfDString(utf8, portion, TCL_INDEX_NONE, &ds); + Tcl_DStringAppend((Tcl_DString *) clientData, str, Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); Tcl_FreeEncoding(utf8); return TCL_OK; diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 6fc89cf..0474fed 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -237,7 +237,7 @@ Tk_BindObjCmd( Tcl_ResetResult(interp); return TCL_OK; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(command, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(command, TCL_INDEX_NONE)); } else { Tk_GetAllBindings(interp, winPtr->mainPtr->bindingTable, object); } @@ -367,23 +367,23 @@ Tk_BindtagsObjCmd( listPtr = Tcl_NewObj(); if (winPtr->numTags == 0) { Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj(winPtr->pathName, -1)); + Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj(winPtr->classUid, -1)); + Tcl_NewStringObj(winPtr->classUid, TCL_INDEX_NONE)); winPtr2 = winPtr; while ((winPtr2 != NULL) && !(Tk_TopWinHierarchy(winPtr2))) { winPtr2 = winPtr2->parentPtr; } if ((winPtr != winPtr2) && (winPtr2 != NULL)) { Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj(winPtr2->pathName, -1)); + Tcl_NewStringObj(winPtr2->pathName, TCL_INDEX_NONE)); } Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj("all", -1)); + Tcl_NewStringObj("all", TCL_INDEX_NONE)); } else { for (i = 0; i < winPtr->numTags; i++) { Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj((char *) winPtr->tagPtr[i], -1)); + Tcl_NewStringObj((char *) winPtr->tagPtr[i], TCL_INDEX_NONE)); } } Tcl_SetObjResult(interp, listPtr); @@ -692,7 +692,7 @@ AppnameCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "appname not accessible in a safe interpreter", -1)); + "appname not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "APPLICATION", NULL); return TCL_ERROR; } @@ -707,7 +707,7 @@ AppnameCmd( string = Tcl_GetString(objv[1]); winPtr->nameUid = Tk_GetUid(Tk_SetAppName(tkwin, string)); } - Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, TCL_INDEX_NONE)); return TCL_OK; } @@ -829,7 +829,7 @@ ScalingCmd( Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d)); } else if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "setting the scaling not accessible in a safe interpreter", -1)); + "setting the scaling not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "SCALING", NULL); return TCL_ERROR; } else if (objc == 2 + skip) { @@ -867,7 +867,7 @@ UseinputmethodsCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "useinputmethods not accessible in a safe interpreter", -1)); + "useinputmethods not accessible in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "INPUT_METHODS", NULL); return TCL_ERROR; } @@ -920,7 +920,7 @@ WindowingsystemCmd( #else windowingsystem = "x11"; #endif - Tcl_SetObjResult(interp, Tcl_NewStringObj(windowingsystem, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(windowingsystem, TCL_INDEX_NONE)); return TCL_OK; } @@ -957,7 +957,7 @@ InactiveCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "resetting the user inactivity timer " - "is not allowed in a safe interpreter", -1)); + "is not allowed in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "INACTIVITY_TIMER", NULL); return TCL_ERROR; } @@ -1366,7 +1366,7 @@ Tk_WinfoObjCmd( winPtr = winPtr->childList; for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) { if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) { - strPtr = Tcl_NewStringObj(winPtr->pathName, -1); + strPtr = Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } } @@ -1374,7 +1374,7 @@ Tk_WinfoObjCmd( break; } case WIN_CLASS: - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Class(tkwin), -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Class(tkwin), TCL_INDEX_NONE)); break; case WIN_COLORMAPFULL: Tcl_SetObjResult(interp, @@ -1395,7 +1395,7 @@ Tk_WinfoObjCmd( Tk_MakeWindowExist(tkwin); TkpPrintWindowId(buf, Tk_WindowId(tkwin)); - Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); break; } case WIN_ISMAPPED: @@ -1404,16 +1404,16 @@ Tk_WinfoObjCmd( case WIN_MANAGER: if (winPtr->geomMgrPtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(winPtr->geomMgrPtr->name, -1)); + Tcl_NewStringObj(winPtr->geomMgrPtr->name, TCL_INDEX_NONE)); } break; case WIN_NAME: - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Name(tkwin), -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Name(tkwin), TCL_INDEX_NONE)); break; case WIN_PARENT: if (winPtr->parentPtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(winPtr->parentPtr->pathName, -1)); + Tcl_NewStringObj(winPtr->parentPtr->pathName, TCL_INDEX_NONE)); } break; case WIN_POINTERX: @@ -1499,7 +1499,7 @@ Tk_WinfoObjCmd( case WIN_TOPLEVEL: winPtr = GetTopHierarchy(tkwin); if (winPtr != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->pathName, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->pathName, TCL_INDEX_NONE)); } break; case WIN_VIEWABLE: { @@ -1526,7 +1526,7 @@ Tk_WinfoObjCmd( if (string == NULL) { string = "unknown"; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(string, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(string, TCL_INDEX_NONE)); break; case WIN_VISUALID: Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) @@ -1600,7 +1600,7 @@ Tk_WinfoObjCmd( Tcl_GetString(objv[2]), NULL); return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE)); break; } case WIN_CONTAINING: @@ -1624,7 +1624,7 @@ Tk_WinfoObjCmd( } tkwin = Tk_CoordsToWindow(x, y, tkwin); if (tkwin != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE)); } break; case WIN_INTERPS: @@ -1670,7 +1670,7 @@ Tk_WinfoObjCmd( tkwin = (Tk_Window) winPtr; if (Tk_PathName(tkwin) != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin),-1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE)); } break; } @@ -1795,7 +1795,7 @@ Tk_WinfoObjCmd( &templ, &count); if (visInfoPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't find any visuals for screen", -1)); + "can't find any visuals for screen", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VISUAL", "NONE", NULL); return TCL_ERROR; } @@ -1812,7 +1812,7 @@ Tk_WinfoObjCmd( (unsigned long) visInfoPtr[i].visualid); strcat(buf, visualIdString); } - strPtr = Tcl_NewStringObj(buf, -1); + strPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, resultPtr, strPtr); } Tcl_SetObjResult(interp, resultPtr); @@ -1875,7 +1875,7 @@ TkGetDisplayOf( (strncmp(string, "-displayof", length) == 0)) { if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "value for \"-displayof\" missing", -1)); + "value for \"-displayof\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_VALUE", "DISPLAYOF", NULL); return TCL_INDEX_NONE; } diff --git a/generic/tkColor.c b/generic/tkColor.c index 37a1cd2..b23255e 100644 --- a/generic/tkColor.c +++ b/generic/tkColor.c @@ -824,9 +824,9 @@ TkDebugColor( Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tkColPtr->resourceRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)tkColPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tkColPtr->objRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)tkColPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkConfig.c b/generic/tkConfig.c index c8aedfb..0e47b03 100644 --- a/generic/tkConfig.c +++ b/generic/tkConfig.c @@ -274,14 +274,14 @@ Tk_CreateOptionTable( optionPtr->dbClassUID = Tk_GetUid(specPtr->dbClass); } if (specPtr->defValue != NULL) { - optionPtr->defaultPtr = Tcl_NewStringObj(specPtr->defValue,-1); + optionPtr->defaultPtr = Tcl_NewStringObj(specPtr->defValue, TCL_INDEX_NONE); Tcl_IncrRefCount(optionPtr->defaultPtr); } if (((specPtr->type == TK_OPTION_COLOR) || (specPtr->type == TK_OPTION_BORDER)) && (specPtr->clientData != NULL)) { optionPtr->extra.monoColorPtr = - Tcl_NewStringObj((const char *)specPtr->clientData, -1); + Tcl_NewStringObj((const char *)specPtr->clientData, TCL_INDEX_NONE); Tcl_IncrRefCount(optionPtr->extra.monoColorPtr); } @@ -411,7 +411,7 @@ Tk_InitOptions( { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; - int count; + size_t count; Tk_Uid value; Tcl_Obj *valuePtr; enum { @@ -459,7 +459,7 @@ Tk_InitOptions( value = Tk_GetOption(tkwin, optionPtr->dbNameUID, optionPtr->dbClassUID); if (value != NULL) { - valuePtr = Tcl_NewStringObj(value, -1); + valuePtr = Tcl_NewStringObj(value, TCL_INDEX_NONE); source = OPTION_DATABASE; } } @@ -643,10 +643,10 @@ DoObjConfig( if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); - *((char *) internalPtr) = newBool; + *((char *) internalPtr) = (char)newBool; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); - *((short *) internalPtr) = newBool; + *((short *) internalPtr) = (short)newBool; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_BOOLEAN"); } @@ -665,10 +665,10 @@ DoObjConfig( newInt = INT_MIN; } else if (Tcl_GetIntFromObj(nullOK ? NULL : interp, valuePtr, &newInt) != TCL_OK) { if (nullOK && interp) { - Tcl_Obj *msg = Tcl_NewStringObj("expected integer or \"\" but got \"", -1); + Tcl_Obj *msg = Tcl_NewStringObj("expected integer or \"\" but got \"", TCL_INDEX_NONE); - Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), -1, 50, ""); - Tcl_AppendToObj(msg, "\"", -1); + Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), TCL_INDEX_NONE, 50, ""); + Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msg); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } @@ -714,10 +714,10 @@ DoObjConfig( } else { if (Tcl_GetDoubleFromObj(nullOK ? NULL : interp, valuePtr, &newDbl) != TCL_OK) { if (nullOK && interp) { - Tcl_Obj *msg = Tcl_NewStringObj("expected floating-point number or \"\" but got \"", -1); + Tcl_Obj *msg = Tcl_NewStringObj("expected floating-point number or \"\" but got \"", TCL_INDEX_NONE); - Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), -1, 50, ""); - Tcl_AppendToObj(msg, "\"", -1); + Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), TCL_INDEX_NONE, 50, ""); + Tcl_AppendToObj(msg, "\"", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msg); Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL); } @@ -773,10 +773,10 @@ DoObjConfig( if (optionPtr->specPtr->flags & TYPE_MASK) { if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(char)) { *((char *) oldInternalPtr) = *((char *) internalPtr); - *((char *) internalPtr) = newValue; + *((char *) internalPtr) = (char)newValue; } else if ((optionPtr->specPtr->flags & TYPE_MASK) == TK_OPTION_VAR(short)) { *((short *) oldInternalPtr) = *((short *) internalPtr); - *((short *) internalPtr) = newValue; + *((short *) internalPtr) = (short)newValue; } else { Tcl_Panic("Invalid flags for %s", "TK_OPTION_STRING_TABLE"); } @@ -1924,24 +1924,24 @@ GetConfigList( listPtr = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(NULL, listPtr, - Tcl_NewStringObj(optionPtr->specPtr->optionName, -1)); + Tcl_NewStringObj(optionPtr->specPtr->optionName, TCL_INDEX_NONE)); if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) { elementPtr = Tcl_NewStringObj( - optionPtr->extra.synonymPtr->specPtr->optionName, -1); + optionPtr->extra.synonymPtr->specPtr->optionName, TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); } else { if (optionPtr->dbNameUID == NULL) { elementPtr = Tcl_NewObj(); } else { - elementPtr = Tcl_NewStringObj(optionPtr->dbNameUID, -1); + elementPtr = Tcl_NewStringObj(optionPtr->dbNameUID, TCL_INDEX_NONE); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); if (optionPtr->dbClassUID == NULL) { elementPtr = Tcl_NewObj(); } else { - elementPtr = Tcl_NewStringObj(optionPtr->dbClassUID, -1); + elementPtr = Tcl_NewStringObj(optionPtr->dbClassUID, TCL_INDEX_NONE); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); @@ -2032,13 +2032,13 @@ GetObjectForOption( if (*((int *) internalPtr) == INT_MIN) { objPtr = TkNewIndexObj(TCL_INDEX_NONE); } else if (*((int *) internalPtr) == INT_MAX) { - objPtr = Tcl_NewStringObj("end+1", -1); + objPtr = Tcl_NewStringObj("end+1", TCL_INDEX_NONE); } else if (*((int *) internalPtr) == -1) { - objPtr = Tcl_NewStringObj("end", -1); + objPtr = Tcl_NewStringObj("end", TCL_INDEX_NONE); } else if (*((int *) internalPtr) < 0) { char buf[32]; snprintf(buf, 32, "end%d", 1 + *((int *) internalPtr)); - objPtr = Tcl_NewStringObj(buf, -1); + objPtr = Tcl_NewStringObj(buf, TCL_INDEX_NONE); } else { objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); } @@ -2049,7 +2049,7 @@ GetObjectForOption( } break; case TK_OPTION_STRING: - objPtr = Tcl_NewStringObj(*((char **)internalPtr), -1); + objPtr = Tcl_NewStringObj(*((char **)internalPtr), TCL_INDEX_NONE); break; case TK_OPTION_STRING_TABLE: { int value; @@ -2066,7 +2066,7 @@ GetObjectForOption( } if (value >= 0) { objPtr = Tcl_NewStringObj(((char **) optionPtr->specPtr->clientData)[ - value], -1); + value], TCL_INDEX_NONE); } break; } @@ -2074,7 +2074,7 @@ GetObjectForOption( XColor *colorPtr = *((XColor **)internalPtr); if (colorPtr != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfColor(colorPtr), TCL_INDEX_NONE); } break; } @@ -2082,7 +2082,7 @@ GetObjectForOption( Tk_Font tkfont = *((Tk_Font *)internalPtr); if (tkfont != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfFont(tkfont), TCL_INDEX_NONE); } break; } @@ -2090,7 +2090,7 @@ GetObjectForOption( Tk_Style style = *((Tk_Style *)internalPtr); if (style != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfStyle(style), TCL_INDEX_NONE); } break; } @@ -2099,7 +2099,7 @@ GetObjectForOption( if (pixmap != None) { objPtr = Tcl_NewStringObj( - Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), -1); + Tk_NameOfBitmap(Tk_Display(tkwin), pixmap), TCL_INDEX_NONE); } break; } @@ -2107,29 +2107,29 @@ GetObjectForOption( Tk_3DBorder border = *((Tk_3DBorder *)internalPtr); if (border != NULL) { - objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), -1); + objPtr = Tcl_NewStringObj(Tk_NameOf3DBorder(border), TCL_INDEX_NONE); } break; } case TK_OPTION_RELIEF: - objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), -1); + objPtr = Tcl_NewStringObj(Tk_NameOfRelief(*((int *)internalPtr)), TCL_INDEX_NONE); break; case TK_OPTION_CURSOR: { Tk_Cursor cursor = *((Tk_Cursor *)internalPtr); if (cursor != NULL) { objPtr = Tcl_NewStringObj( - Tk_NameOfCursor(Tk_Display(tkwin), cursor), -1); + Tk_NameOfCursor(Tk_Display(tkwin), cursor), TCL_INDEX_NONE); } break; } case TK_OPTION_JUSTIFY: objPtr = Tcl_NewStringObj(Tk_NameOfJustify( - *((Tk_Justify *)internalPtr)), -1); + *((Tk_Justify *)internalPtr)), TCL_INDEX_NONE); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( - *((Tk_Anchor *)internalPtr)), -1); + *((Tk_Anchor *)internalPtr)), TCL_INDEX_NONE); break; case TK_OPTION_PIXELS: if (!(optionPtr->specPtr->flags & (TK_OPTION_NULL_OK|TCL_NULL_OK)) || *((int *) internalPtr) != INT_MIN) { @@ -2140,7 +2140,7 @@ GetObjectForOption( tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { - objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); + objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE); } break; } @@ -2274,11 +2274,11 @@ TkDebugConfig( if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tablePtr->refCount)); + Tcl_NewWideIntObj((Tcl_WideInt)tablePtr->refCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(tablePtr->numOptions)); + Tcl_NewWideIntObj((Tcl_WideInt)tablePtr->numOptions)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj( - tablePtr->options[0].specPtr->optionName, -1)); + tablePtr->options[0].specPtr->optionName, TCL_INDEX_NONE)); } break; } diff --git a/generic/tkConsole.c b/generic/tkConsole.c index 0c12c43..88aacd4 100644 --- a/generic/tkConsole.c +++ b/generic/tkConsole.c @@ -43,22 +43,22 @@ typedef struct ChannelData { * Prototypes for local procedures defined in this file: */ -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, - ClientData *handlePtr); -static int ConsoleInput(ClientData instanceData, char *buf, int toRead, +static int ConsoleClose(void *instanceData, Tcl_Interp *interp); +static int Console2Close(void *instanceData, Tcl_Interp *interp, int flags); +static void ConsoleDeleteProc(void *clientData); +static void ConsoleEventProc(void *clientData, XEvent *eventPtr); +static int ConsoleHandle(void *instanceData, int direction, + void **handlePtr); +static int ConsoleInput(void *instanceData, char *buf, int toRead, int *errorCode); -static int ConsoleObjCmd(ClientData clientData, Tcl_Interp *interp, +static int ConsoleObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int ConsoleOutput(ClientData instanceData, const char *buf, +static int ConsoleOutput(void *instanceData, const char *buf, int toWrite, int *errorCode); -static void ConsoleWatch(ClientData instanceData, int mask); -static void DeleteConsoleInterp(ClientData clientData); -static void InterpDeleteProc(ClientData clientData, Tcl_Interp *interp); -static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp, +static void ConsoleWatch(void *instanceData, int mask); +static void DeleteConsoleInterp(void *clientData); +static void InterpDeleteProc(void *clientData, Tcl_Interp *interp); +static int InterpreterObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* @@ -444,7 +444,7 @@ Tk_CreateConsoleWindow( Tcl_Preserve(consoleInterp); result = Tcl_EvalEx(consoleInterp, "source $tk_library/console.tcl", - -1, TCL_EVAL_GLOBAL); + TCL_INDEX_NONE, TCL_EVAL_GLOBAL); if (result == TCL_ERROR) { Tcl_SetReturnOptions(interp, Tcl_GetReturnOptions(consoleInterp, result)); @@ -493,7 +493,7 @@ Tk_CreateConsoleWindow( static int ConsoleOutput( - ClientData instanceData, /* Indicates which device to use. */ + void *instanceData, /* Indicates which device to use. */ const char *buf, /* The data buffer. */ int toWrite, /* How many bytes to write? */ int *errorCode) /* Where to store error code. */ @@ -517,19 +517,18 @@ ConsoleOutput( * Assumption is utf-8 Tcl_Encoding is reliably present. */ - (void)Tcl_ExternalToUtfDString(utf8, buf, toWrite, &ds); - const char *bytes = Tcl_DStringValue(&ds); - int numBytes = Tcl_DStringLength(&ds); - Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", -1); + const char *bytes = Tcl_ExternalToUtfDString(utf8, buf, (Tcl_Size)toWrite, &ds); + Tcl_Size numBytes = Tcl_DStringLength(&ds); + Tcl_Obj *cmd = Tcl_NewStringObj("tk::ConsoleOutput", TCL_INDEX_NONE); Tcl_FreeEncoding(utf8); if (data->type == TCL_STDERR) { Tcl_ListObjAppendElement(NULL, cmd, - Tcl_NewStringObj("stderr", -1)); + Tcl_NewStringObj("stderr", TCL_INDEX_NONE)); } else { Tcl_ListObjAppendElement(NULL, cmd, - Tcl_NewStringObj("stdout", -1)); + Tcl_NewStringObj("stdout", TCL_INDEX_NONE)); } Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj(bytes, numBytes)); @@ -588,7 +587,7 @@ ConsoleInput( static int ConsoleClose( - ClientData instanceData, + void *instanceData, TCL_UNUSED(Tcl_Interp *)) { ChannelData *data = (ChannelData *)instanceData; @@ -609,7 +608,7 @@ ConsoleClose( static int Console2Close( - ClientData instanceData, /* Unused. */ + void *instanceData, /* Unused. */ Tcl_Interp *interp, /* Unused. */ int flags) { @@ -693,7 +692,7 @@ ConsoleHandle( static int ConsoleObjCmd( - ClientData clientData, /* Access to the console interp */ + void *clientData, /* Access to the console interp */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -728,21 +727,21 @@ ConsoleObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm withdraw .", -1); + cmd = Tcl_NewStringObj("wm withdraw .", TCL_INDEX_NONE); break; case CON_SHOW: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm deiconify .", -1); + cmd = Tcl_NewStringObj("wm deiconify .", TCL_INDEX_NONE); break; case CON_TITLE: if (objc > 3) { Tcl_WrongNumArgs(interp, 2, objv, "?title?"); return TCL_ERROR; } - cmd = Tcl_NewStringObj("wm title .", -1); + cmd = Tcl_NewStringObj("wm title .", TCL_INDEX_NONE); if (objc == 3) { Tcl_ListObjAppendElement(NULL, cmd, objv[2]); } @@ -761,7 +760,7 @@ ConsoleObjCmd( Tcl_Release(consoleInterp); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no active console interp", -1)); + "no active console interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NONE", NULL); result = TCL_ERROR; } @@ -785,7 +784,7 @@ ConsoleObjCmd( static int InterpreterObjCmd( - ClientData clientData, /* */ + void *clientData, /* */ Tcl_Interp *interp, /* Current interpreter */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* Argument objects */ @@ -812,7 +811,7 @@ InterpreterObjCmd( if ((otherInterp == NULL) || Tcl_InterpDeleted(otherInterp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no active parent interp", -1)); + "no active parent interp", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CONSOLE", "NO_INTERP", NULL); return TCL_ERROR; } @@ -859,7 +858,7 @@ InterpreterObjCmd( static void DeleteConsoleInterp( - ClientData clientData) + void *clientData) { Tcl_Interp *interp = (Tcl_Interp *)clientData; @@ -885,7 +884,7 @@ DeleteConsoleInterp( static void InterpDeleteProc( - ClientData clientData, + void *clientData, Tcl_Interp *interp) { ConsoleInfo *info = (ConsoleInfo *)clientData; @@ -918,7 +917,7 @@ InterpDeleteProc( static void ConsoleDeleteProc( - ClientData clientData) + void *clientData) { ConsoleInfo *info = (ConsoleInfo *)clientData; @@ -951,7 +950,7 @@ ConsoleDeleteProc( static void ConsoleEventProc( - ClientData clientData, + void *clientData, XEvent *eventPtr) { if (eventPtr->type == DestroyNotify) { @@ -959,7 +958,7 @@ ConsoleEventProc( Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { - Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); + Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (info->refCount-- <= 1) { diff --git a/generic/tkCursor.c b/generic/tkCursor.c index 9785470..ea0a35f 100644 --- a/generic/tkCursor.c +++ b/generic/tkCursor.c @@ -868,9 +868,9 @@ TkDebugCursor( for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(cursorPtr->resourceRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)cursorPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, - Tcl_NewWideIntObj(cursorPtr->objRefCount)); + Tcl_NewWideIntObj((Tcl_WideInt)cursorPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 1ebce19..6034687 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -409,21 +409,21 @@ static int ConfigureEntry(Tcl_Interp *interp, Entry *entryPtr, int objc, Tcl_Obj *const objv[]); static int DeleteChars(Entry *entryPtr, Tcl_Size index, Tcl_Size count); static void DestroyEntry(void *memPtr); -static void DisplayEntry(ClientData clientData); -static void EntryBlinkProc(ClientData clientData); -static void EntryCmdDeletedProc(ClientData clientData); +static void DisplayEntry(void *clientData); +static void EntryBlinkProc(void *clientData); +static void EntryCmdDeletedProc(void *clientData); static void EntryComputeGeometry(Entry *entryPtr); -static void EntryEventProc(ClientData clientData, +static void EntryEventProc(void *clientData, XEvent *eventPtr); static void EntryFocusProc(Entry *entryPtr, int gotFocus); -static Tcl_Size EntryFetchSelection(ClientData clientData, Tcl_Size offset, +static Tcl_Size EntryFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); -static void EntryLostSelection(ClientData clientData); +static void EntryLostSelection(void *clientData); static void EventuallyRedraw(Entry *entryPtr); static void EntryScanTo(Entry *entryPtr, int y); static void EntrySetValue(Entry *entryPtr, const char *value); static void EntrySelectTo(Entry *entryPtr, Tcl_Size index); -static char * EntryTextVarProc(ClientData clientData, +static char * EntryTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void EntryUpdateScrollbar(Entry *entryPtr); @@ -437,10 +437,10 @@ static int EntryValueChanged(Entry *entryPtr, const char *newValue); static void EntryVisibleRange(Entry *entryPtr, double *firstPtr, double *lastPtr); -static int EntryWidgetObjCmd(ClientData clientData, +static int EntryWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void EntryWorldChanged(ClientData instanceData); +static void EntryWorldChanged(void *instanceData); static int GetEntryIndex(Tcl_Interp *interp, Entry *entryPtr, Tcl_Obj *indexObj, Tcl_Size *indexPtr); static int InsertChars(Entry *entryPtr, Tcl_Size index, const char *string); @@ -449,7 +449,7 @@ static int InsertChars(Entry *entryPtr, Tcl_Size index, const char *string); * These forward declarations are the spinbox specific ones: */ -static int SpinboxWidgetObjCmd(ClientData clientData, +static int SpinboxWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int GetSpinboxElement(Spinbox *sbPtr, int x, int y); @@ -488,7 +488,7 @@ static const Tk_ClassProcs entryClass = { int Tk_EntryObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -497,7 +497,6 @@ Tk_EntryObjCmd( Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -602,7 +601,7 @@ Tk_EntryObjCmd( static int EntryWidgetObjCmd( - ClientData clientData, /* Information about entry widget. */ + void *clientData, /* Information about entry widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -715,7 +714,7 @@ EntryWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE)); break; case COMMAND_ICURSOR: @@ -1268,7 +1267,7 @@ ConfigureEntry( Tcl_Obj *newObjPtr; Tcl_Size nelems; - newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, -1); + newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, TCL_INDEX_NONE); if (Tcl_ListObjLength(interp, newObjPtr, &nelems) != TCL_OK) { valuesChanged = -1; @@ -1452,7 +1451,7 @@ ConfigureEntry( static void EntryWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc = NULL; @@ -1565,14 +1564,10 @@ EntryWorldChanged( int TkpDrawEntryBorderAndFocus( - Entry *entryPtr, - Drawable pixmap, - int isSpinbox) + TCL_UNUSED(Entry *), + TCL_UNUSED(Drawable), + TCL_UNUSED(int)) { - (void)entryPtr; - (void)pixmap; - (void)isSpinbox; - return 0; } @@ -1596,12 +1591,9 @@ TkpDrawEntryBorderAndFocus( int TkpDrawSpinboxButtons( - Spinbox *sbPtr, - Pixmap pixmap) + TCL_UNUSED(Spinbox *), + TCL_UNUSED(Pixmap)) { - (void)sbPtr; - (void)pixmap; - return 0; } #endif /* Not MAC_OSX_TK */ @@ -1624,7 +1616,7 @@ TkpDrawSpinboxButtons( static void DisplayEntry( - ClientData clientData) /* Information about window. */ + void *clientData) /* Information about window. */ { Entry *entryPtr = (Entry *)clientData; Tk_Window tkwin = entryPtr->tkwin; @@ -2199,7 +2191,7 @@ InsertChars( * The following construction is used because inserting improperly formed * UTF-8 sequences between other improperly formed UTF-8 sequences could * result in actually forming valid UTF-8 sequences; the number of - * characters added may not be Tcl_NumUtfChars(string, -1), because of + * characters added may not be Tcl_NumUtfChars(string, TCL_INDEX_NONE), because of * context. The actual number of characters added is how many characters * are in the string now minus the number that used to be there. */ @@ -2477,7 +2469,7 @@ EntrySetValue( malloced = 1; entryPtr->flags |= VALIDATE_VAR; - (void) EntryValidateChange(entryPtr, NULL, value, -1, + (void) EntryValidateChange(entryPtr, NULL, value, TCL_INDEX_NONE, VALIDATE_FORCED); entryPtr->flags &= ~VALIDATE_VAR; @@ -2556,7 +2548,7 @@ EntrySetValue( static void EntryEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Entry *entryPtr = (Entry *)clientData; @@ -2638,7 +2630,7 @@ EntryEventProc( static void EntryCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { Entry *entryPtr = (Entry *)clientData; @@ -2918,7 +2910,7 @@ EntrySelectTo( static Tcl_Size EntryFetchSelection( - ClientData clientData, /* Information about entry widget. */ + void *clientData, /* Information about entry widget. */ Tcl_Size offset, /* Byte offset within selection of first * character to be returned. */ char *buffer, /* Location in which to place selection. */ @@ -2970,7 +2962,7 @@ EntryFetchSelection( static void EntryLostSelection( - ClientData clientData) /* Information about entry widget. */ + void *clientData) /* Information about entry widget. */ { Entry *entryPtr = (Entry *)clientData; @@ -3157,7 +3149,7 @@ EntryUpdateScrollbar( static void EntryBlinkProc( - ClientData clientData) /* Pointer to record describing entry. */ + void *clientData) /* Pointer to record describing entry. */ { Entry *entryPtr = (Entry *)clientData; @@ -3212,7 +3204,7 @@ EntryFocusProc( if (entryPtr->validate == VALIDATE_ALL || entryPtr->validate == VALIDATE_FOCUS || entryPtr->validate == VALIDATE_FOCUSIN) { - EntryValidateChange(entryPtr, NULL, entryPtr->string, -1, + EntryValidateChange(entryPtr, NULL, entryPtr->string, TCL_INDEX_NONE, VALIDATE_FOCUSIN); } } else { @@ -3221,7 +3213,7 @@ EntryFocusProc( if (entryPtr->validate == VALIDATE_ALL || entryPtr->validate == VALIDATE_FOCUS || entryPtr->validate == VALIDATE_FOCUSOUT) { - EntryValidateChange(entryPtr, NULL, entryPtr->string, -1, + EntryValidateChange(entryPtr, NULL, entryPtr->string, TCL_INDEX_NONE, VALIDATE_FOCUSOUT); } } @@ -3247,16 +3239,14 @@ EntryFocusProc( static char * EntryTextVarProc( - ClientData clientData, /* Information about button. */ + void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Not used. */ - const char *name2, /* Not used. */ + TCL_UNUSED(const char *), + TCL_UNUSED(const char *), int flags) /* Information about what happened. */ { Entry *entryPtr = (Entry *)clientData; const char *value; - (void)name1; - (void)name2; if (entryPtr->flags & ENTRY_DELETED) { /* @@ -3402,7 +3392,7 @@ EntryValidateChange( const char *change, /* Characters to be added/deleted * (NUL-terminated string). */ const char *newValue, /* Potential new value of entry string */ - Tcl_Size index, /* index of insert/delete, -1 otherwise */ + Tcl_Size index, /* index of insert/delete, TCL_INDEX_NONE otherwise */ int type) /* forced, delete, insert, focusin or * focusout */ { @@ -3493,7 +3483,7 @@ EntryValidateChange( change, newValue, index, type, &script); Tcl_DStringAppend(&script, "", 1); p = Tcl_DStringValue(&script); - result = Tcl_EvalEx(entryPtr->interp, p, -1, + result = Tcl_EvalEx(entryPtr->interp, p, TCL_INDEX_NONE, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); if (result != TCL_OK) { Tcl_AddErrorInfo(entryPtr->interp, @@ -3577,7 +3567,7 @@ ExpandPercents( string = Tcl_UtfFindFirst(before, '%'); if (string == NULL) { - Tcl_DStringAppend(dsPtr, before, -1); + Tcl_DStringAppend(dsPtr, before, TCL_INDEX_NONE); break; } else if (string != before) { Tcl_DStringAppend(dsPtr, before, string-before); @@ -3677,10 +3667,10 @@ ExpandPercents( } } - spaceNeeded = Tcl_ScanCountedElement(string, -1, &cvtFlags); + spaceNeeded = Tcl_ScanCountedElement(string, TCL_INDEX_NONE, &cvtFlags); length = Tcl_DStringLength(dsPtr); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); - spaceNeeded = Tcl_ConvertCountedElement(string, -1, + spaceNeeded = Tcl_ConvertCountedElement(string, TCL_INDEX_NONE, Tcl_DStringValue(dsPtr) + length, cvtFlags | TCL_DONT_USE_BRACES); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); @@ -3706,7 +3696,7 @@ ExpandPercents( int Tk_SpinboxObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3716,7 +3706,6 @@ Tk_SpinboxObjCmd( Tk_OptionTable optionTable; Tk_Window tkwin; char *tmp; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -3840,7 +3829,7 @@ Tk_SpinboxObjCmd( static int SpinboxWidgetObjCmd( - ClientData clientData, /* Information about spinbox widget. */ + void *clientData, /* Information about spinbox widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -3955,7 +3944,7 @@ SpinboxWidgetObjCmd( Tcl_WrongNumArgs(interp, 2, objv, NULL); goto error; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE)); break; case SB_CMD_ICURSOR: @@ -3984,7 +3973,7 @@ SpinboxWidgetObjCmd( elem = GetSpinboxElement(sbPtr, x, y); if (elem != SEL_NONE) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(selElementNames[elem], -1)); + Tcl_NewStringObj(selElementNames[elem], TCL_INDEX_NONE)); } break; } @@ -4213,7 +4202,7 @@ SpinboxWidgetObjCmd( } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - selElementNames[sbPtr->selElement], -1)); + selElementNames[sbPtr->selElement], TCL_INDEX_NONE)); } else { int lastElement = sbPtr->selElement; @@ -4244,7 +4233,7 @@ SpinboxWidgetObjCmd( goto error; } } - Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(entryPtr->string, TCL_INDEX_NONE)); break; } @@ -4258,7 +4247,7 @@ SpinboxWidgetObjCmd( selIndex = entryPtr->validate; entryPtr->validate = VALIDATE_ALL; code = EntryValidateChange(entryPtr, NULL, entryPtr->string, - -1, VALIDATE_FORCED); + TCL_INDEX_NONE, VALIDATE_FORCED); if (entryPtr->validate != VALIDATE_NONE) { entryPtr->validate = selIndex; } @@ -4525,7 +4514,7 @@ SpinboxInvoke( VALIDATE_BUTTON, &script); Tcl_DStringAppend(&script, "", 1); - code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), -1, + code = Tcl_EvalEx(interp, Tcl_DStringValue(&script), TCL_INDEX_NONE, TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT); Tcl_DStringFree(&script); diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index db5718d..cac1c78 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -385,8 +385,7 @@ AddClause( * macRoman characters long */ - (void)Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS); - string = Tcl_DStringValue(&osTypeDS); + string = Tcl_UtfToExternalDString(macRoman, strType, len, &osTypeDS); mfPtr->type = (OSType) string[0] << 24 | (OSType) string[1] << 16 | (OSType) string[2] << 8 | (OSType) string[3]; Tcl_DStringFree(&osTypeDS); diff --git a/generic/tkFont.c b/generic/tkFont.c index 64053a1..1c5db41 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -343,7 +343,7 @@ static int ParseFontNameObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, TkFontAttributes *faPtr); static void RecomputeWidgets(TkWindow *winPtr); static int SetFontFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); -static void TheWorldHasChanged(ClientData clientData); +static void TheWorldHasChanged(void *clientData); static void UpdateDependentFonts(TkFontInfo *fiPtr, Tk_Window tkwin, Tcl_HashEntry *namedHashPtr); @@ -473,7 +473,7 @@ TkFontPkgFree( int Tk_FontObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -576,10 +576,10 @@ Tk_FontObjCmd( if (len != (size_t)charPtr->length) { resultPtr = Tcl_NewStringObj( - "expected a single character but got \"", -1); + "expected a single character but got \"", TCL_INDEX_NONE); Tcl_AppendLimitedToObj(resultPtr, string, - -1, 40, "..."); - Tcl_AppendToObj(resultPtr, "\"", -1); + TCL_INDEX_NONE, 40, "..."); + Tcl_AppendToObj(resultPtr, "\"", TCL_INDEX_NONE); Tcl_SetObjResult(interp, resultPtr); Tcl_SetErrorCode(interp, "TK", "VALUE", "FONT_SAMPLE", NULL); return TCL_ERROR; @@ -683,7 +683,7 @@ Tk_FontObjCmd( if (TkCreateNamedFont(interp, tkwin, name, &fa) != TCL_OK) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(name, TCL_INDEX_NONE)); break; } case FONT_DELETE: { @@ -811,7 +811,7 @@ Tk_FontObjCmd( namedHashPtr); Tcl_ListObjAppendElement(NULL, resultPtr, - Tcl_NewStringObj(string, -1)); + Tcl_NewStringObj(string, TCL_INDEX_NONE)); } namedHashPtr = Tcl_NextHashEntry(&search); } @@ -879,7 +879,7 @@ UpdateDependentFonts( static void TheWorldHasChanged( - ClientData clientData) /* Info about application's fonts. */ + void *clientData) /* Info about application's fonts. */ { TkFontInfo *fiPtr = (TkFontInfo *)clientData; @@ -1082,7 +1082,7 @@ Tk_GetFont( Tk_Font tkfont; Tcl_Obj *strPtr; - strPtr = Tcl_NewStringObj(string, -1); + strPtr = Tcl_NewStringObj(string, TCL_INDEX_NONE); Tcl_IncrRefCount(strPtr); tkfont = Tk_AllocFontFromObj(interp, tkwin, strPtr); Tcl_DecrRefCount(strPtr); @@ -1222,7 +1222,7 @@ Tk_AllocFontFromObj( } Tcl_SetObjResult(interp, Tcl_NewStringObj( "failed to allocate font due to internal system font engine" - " problem", -1)); + " problem", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "FONT", "INTERNAL_PROBLEM", NULL); return NULL; } @@ -1731,7 +1731,7 @@ Tk_PostscriptFontName( * to do. */ - Tcl_DStringAppend(dsPtr, family, -1); + Tcl_DStringAppend(dsPtr, family, TCL_INDEX_NONE); src = dest = Tcl_DStringValue(dsPtr) + len; upper = 1; @@ -1754,13 +1754,13 @@ Tk_PostscriptFontName( family = Tcl_DStringValue(dsPtr) + len; } if (family != Tcl_DStringValue(dsPtr) + len) { - Tcl_DStringAppend(dsPtr, family, -1); + Tcl_DStringAppend(dsPtr, family, TCL_INDEX_NONE); family = Tcl_DStringValue(dsPtr) + len; } if (strcasecmp(family, "NewCenturySchoolbook") == 0) { Tcl_DStringSetLength(dsPtr, len); - Tcl_DStringAppend(dsPtr, "NewCenturySchlbk", -1); + Tcl_DStringAppend(dsPtr, "NewCenturySchlbk", TCL_INDEX_NONE); family = Tcl_DStringValue(dsPtr) + len; } @@ -1810,15 +1810,15 @@ Tk_PostscriptFontName( if ((strcmp(family, "Times") == 0) || (strcmp(family, "NewCenturySchlbk") == 0) || (strcmp(family, "Palatino") == 0)) { - Tcl_DStringAppend(dsPtr, "-Roman", -1); + Tcl_DStringAppend(dsPtr, "-Roman", TCL_INDEX_NONE); } } else { - Tcl_DStringAppend(dsPtr, "-", -1); + Tcl_DStringAppend(dsPtr, "-", TCL_INDEX_NONE); if (weightString != NULL) { - Tcl_DStringAppend(dsPtr, weightString, -1); + Tcl_DStringAppend(dsPtr, weightString, TCL_INDEX_NONE); } if (slantString != NULL) { - Tcl_DStringAppend(dsPtr, slantString, -1); + Tcl_DStringAppend(dsPtr, slantString, TCL_INDEX_NONE); } } @@ -2007,7 +2007,7 @@ Tk_ComputeTextLayout( height = fmPtr->ascent + fmPtr->descent; if (numChars == TCL_INDEX_NONE) { - numChars = Tcl_NumUtfChars(string, -1); + numChars = Tcl_NumUtfChars(string, TCL_INDEX_NONE); } if (wrapLength == 0) { wrapLength = -1; @@ -3310,15 +3310,15 @@ Tk_TextLayoutToPostscript( char uindex[5], c, *ps; int ch; - Tcl_AppendToObj(psObj, "[(", -1); + Tcl_AppendToObj(psObj, "[(", TCL_INDEX_NONE); for (i = 0; i < layoutPtr->numChunks; i++, chunkPtr++) { if (baseline != chunkPtr->y) { - Tcl_AppendToObj(psObj, ")]\n[(", -1); + Tcl_AppendToObj(psObj, ")]\n[(", TCL_INDEX_NONE); baseline = chunkPtr->y; } if (chunkPtr->numDisplayChars <= 0) { if (chunkPtr->start[0] == '\t') { - Tcl_AppendToObj(psObj, "\\t", -1); + Tcl_AppendToObj(psObj, "\\t", TCL_INDEX_NONE); } continue; } @@ -3371,10 +3371,10 @@ Tk_TextLayoutToPostscript( ps[len-1] = '/'; } else { - Tcl_AppendToObj(psObj, ")/", -1); + Tcl_AppendToObj(psObj, ")/", TCL_INDEX_NONE); } - Tcl_AppendToObj(psObj, glyphname, -1); - Tcl_AppendToObj(psObj, "(", -1); + Tcl_AppendToObj(psObj, glyphname, TCL_INDEX_NONE); + Tcl_AppendToObj(psObj, "(", TCL_INDEX_NONE); } else { /* * No known mapping for the character into the space of @@ -3389,7 +3389,7 @@ noMapping: ; } } } - Tcl_AppendToObj(psObj, ")]\n", -1); + Tcl_AppendToObj(psObj, ")]\n", TCL_INDEX_NONE); Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj); Tcl_DecrRefCount(psObj); } @@ -3563,12 +3563,12 @@ GetAttributeInfoObj( case FONT_WEIGHT: str = TkFindStateString(weightMap, faPtr->weight); - valuePtr = Tcl_NewStringObj(str, -1); + valuePtr = Tcl_NewStringObj(str, TCL_INDEX_NONE); break; case FONT_SLANT: str = TkFindStateString(slantMap, faPtr->slant); - valuePtr = Tcl_NewStringObj(str, -1); + valuePtr = Tcl_NewStringObj(str, TCL_INDEX_NONE); break; case FONT_UNDERLINE: @@ -3584,7 +3584,7 @@ GetAttributeInfoObj( return TCL_OK; } Tcl_ListObjAppendElement(NULL, resultPtr, - Tcl_NewStringObj(fontOpt[i], -1)); + Tcl_NewStringObj(fontOpt[i], TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, resultPtr, valuePtr); } Tcl_SetObjResult(interp, resultPtr); @@ -3625,19 +3625,19 @@ Tk_FontGetDescription( } if (faPtr->weight != TK_FW_NORMAL) { str = TkFindStateString(weightMap, faPtr->weight); - Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->slant != TK_FS_ROMAN) { str = TkFindStateString(slantMap, faPtr->slant); - Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->underline) { str = TkFindStateString(underlineMap, faPtr->underline); - Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } if (faPtr->overstrike) { str = TkFindStateString(overstrikeMap, faPtr->overstrike); - Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, -1)); + Tcl_ListObjAppendElement(NULL, resultPtr, Tcl_NewStringObj(str, TCL_INDEX_NONE)); } return resultPtr; } @@ -3919,7 +3919,7 @@ TkFontParseXLFD( } Tcl_DStringInit(&ds); - Tcl_DStringAppend(&ds, str, -1); + Tcl_DStringAppend(&ds, str, TCL_INDEX_NONE); src = Tcl_DStringValue(&ds); field[0] = src; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index fad0635..fecf775 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -329,32 +329,32 @@ static const Tk_OptionSpec *const optionSpecs[] = { static void ComputeFrameGeometry(Frame *framePtr); static int ConfigureFrame(Tcl_Interp *interp, Frame *framePtr, int objc, Tcl_Obj *const objv[]); -static int CreateFrame(ClientData clientData, Tcl_Interp *interp, +static int CreateFrame(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], enum FrameType type, const char *appName); static void DestroyFrame(void *memPtr); static void DestroyFramePartly(Frame *framePtr); -static void DisplayFrame(ClientData clientData); +static void DisplayFrame(void *clientData); static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap, int highlightWidth, int borderWidth, Tk_Image bgimg, int bgtile); -static void FrameBgImageProc(ClientData clientData, +static void FrameBgImageProc(void *clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); -static void FrameCmdDeletedProc(ClientData clientData); -static void FrameEventProc(ClientData clientData, +static void FrameCmdDeletedProc(void *clientData); +static void FrameEventProc(void *clientData, XEvent *eventPtr); -static void FrameLostContentProc(ClientData clientData, +static void FrameLostContentProc(void *clientData, Tk_Window tkwin); -static void FrameRequestProc(ClientData clientData, +static void FrameRequestProc(void *clientData, Tk_Window tkwin); -static void FrameStructureProc(ClientData clientData, +static void FrameStructureProc(void *clientData, XEvent *eventPtr); -static int FrameWidgetObjCmd(ClientData clientData, +static int FrameWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void FrameWorldChanged(ClientData instanceData); -static void MapFrame(ClientData clientData); +static void FrameWorldChanged(void *instanceData); +static void MapFrame(void *clientData); /* * The structure below defines frame class behavior by means of functions that @@ -400,7 +400,7 @@ static const Tk_GeomMgr frameGeomType = { int Tk_FrameObjCmd( - ClientData clientData, /* Either NULL or pointer to option table. */ + void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -410,7 +410,7 @@ Tk_FrameObjCmd( int Tk_ToplevelObjCmd( - ClientData clientData, /* Either NULL or pointer to option table. */ + void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -420,7 +420,7 @@ Tk_ToplevelObjCmd( int Tk_LabelframeObjCmd( - ClientData clientData, /* Either NULL or pointer to option table. */ + void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -449,7 +449,7 @@ Tk_LabelframeObjCmd( int TkCreateFrame( - ClientData clientData, /* Either NULL or pointer to option table. */ + void *clientData, /* Either NULL or pointer to option table. */ Tcl_Interp *interp, /* Current interpreter. */ int argc, /* Number of arguments. */ const char *const *argv, /* Argument strings. */ @@ -464,7 +464,7 @@ TkCreateFrame( Tcl_Obj **objv = (Tcl_Obj **)ckalloc((argc+1) * sizeof(Tcl_Obj **)); for (i=0; iuseThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "windows cannot have both the -use and the -container" - " option set", -1)); + " option set", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "FRAME", "CONTAINMENT", NULL); goto error; } @@ -762,7 +761,7 @@ CreateFrame( static int FrameWidgetObjCmd( - ClientData clientData, /* Information about frame widget. */ + void *clientData, /* Information about frame widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1148,7 +1147,7 @@ ConfigureFrame( static void FrameWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { Frame *framePtr = (Frame *)instanceData; Labelframe *labelframePtr = (Labelframe *)instanceData; @@ -1201,7 +1200,7 @@ FrameWorldChanged( Tk_FreeTextLayout(labelframePtr->textLayout); labelframePtr->textLayout = Tk_ComputeTextLayout(labelframePtr->tkfont, - labelText, -1, 0, TK_JUSTIFY_CENTER, 0, + labelText, TCL_INDEX_NONE, 0, TK_JUSTIFY_CENTER, 0, &labelframePtr->labelReqWidth, &labelframePtr->labelReqHeight); labelframePtr->labelReqWidth += 2 * LABELSPACING; @@ -1475,7 +1474,7 @@ ComputeFrameGeometry( static void DisplayFrame( - ClientData clientData) /* Information about widget. */ + void *clientData) /* Information about widget. */ { Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; @@ -1735,7 +1734,7 @@ TkpDrawFrame( static void FrameEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Frame *framePtr = (Frame *)clientData; @@ -1828,7 +1827,7 @@ FrameEventProc( static void FrameCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { Frame *framePtr = (Frame *)clientData; Tk_Window tkwin = framePtr->tkwin; @@ -1879,7 +1878,7 @@ FrameCmdDeletedProc( static void MapFrame( - ClientData clientData) /* Pointer to frame structure. */ + void *clientData) /* Pointer to frame structure. */ { Frame *framePtr = (Frame *)clientData; @@ -1966,7 +1965,7 @@ TkInstallFrameMenu( static void FrameStructureProc( - ClientData clientData, /* Pointer to record describing frame. */ + void *clientData, /* Pointer to record describing frame. */ XEvent *eventPtr) /* Describes what just happened. */ { Labelframe *labelframePtr = (Labelframe *)clientData; @@ -2004,11 +2003,10 @@ FrameStructureProc( static void FrameRequestProc( - ClientData clientData, /* Pointer to record for frame. */ - Tk_Window tkwin) /* Window that changed its desired size. */ + void *clientData, /* Pointer to record for frame. */ + TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { Frame *framePtr = (Frame *)clientData; - (void)tkwin; FrameWorldChanged(framePtr); } @@ -2032,13 +2030,12 @@ FrameRequestProc( static void FrameLostContentProc( - ClientData clientData, /* Frame structure for content window window that was + void *clientData, /* Frame structure for content window window that was * stolen away. */ - Tk_Window tkwin) /* Tk's handle for the content window window. */ + TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window window. */ { Frame *framePtr = (Frame *)clientData; Labelframe *labelframePtr = (Labelframe *)clientData; - (void)tkwin; /* * This should only happen in a labelframe but it doesn't hurt to be @@ -2152,21 +2149,15 @@ TkToplevelWindowForCommand( static void FrameBgImageProc( - ClientData clientData, /* Pointer to widget record. */ - int x, int y, /* Upper left pixel (within image) that must - * be redisplayed. */ - int width, int height, /* Dimensions of area to redisplay (might be - * <= 0). */ - int imgWidth, int imgHeight)/* New dimensions of image. */ + void *clientData, /* Pointer to widget record. */ + TCL_UNUSED(int), /* Upper left pixel (within image) that must */ + TCL_UNUSED(int), /* be redisplayed. */ + TCL_UNUSED(int), /* Dimensions of area to redisplay (might be */ + TCL_UNUSED(int), /* <= 0). */ + TCL_UNUSED(int), /* New dimensions of image. */ + TCL_UNUSED(int)) { 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/tkGrab.c b/generic/tkGrab.c index ab58d1d..5a25dea 100644 --- a/generic/tkGrab.c +++ b/generic/tkGrab.c @@ -170,7 +170,7 @@ static void ReleaseButtonGrab(TkDisplay *dispPtr); int Tk_GrabObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -357,7 +357,7 @@ Tk_GrabObjCmd( } else { statusString = "local"; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(statusString, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(statusString, TCL_INDEX_NONE)); break; } } @@ -523,20 +523,20 @@ Tk_Grab( grabError: if (grabResult == GrabNotViewable) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "grab failed: window not viewable", -1)); + "grab failed: window not viewable", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "UNVIEWABLE", NULL); } else if (grabResult == AlreadyGrabbed) { alreadyGrabbed: Tcl_SetObjResult(interp, Tcl_NewStringObj( - "grab failed: another application has grab", -1)); + "grab failed: another application has grab", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "GRABBED", NULL); } else if (grabResult == GrabFrozen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "grab failed: keyboard or pointer frozen", -1)); + "grab failed: keyboard or pointer frozen", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "FROZEN", NULL); } else if (grabResult == GrabInvalidTime) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "grab failed: invalid time", -1)); + "grab failed: invalid time", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRAB", "BAD_TIME", NULL); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( @@ -1268,7 +1268,7 @@ EatGrabEvents( { Tk_RestrictProc *prevProc; GrabInfo info; - ClientData prevArg; + void *prevArg; info.display = dispPtr->display; info.serial = serial; @@ -1301,7 +1301,7 @@ EatGrabEvents( static Tk_RestrictAction GrabRestrictProc( - ClientData arg, + void *arg, XEvent *eventPtr) { GrabInfo *info = (GrabInfo *)arg; diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 59da151..55f5ef4 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -257,7 +257,7 @@ static void AdjustForSticky(Gridder *contentPtr, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); static int AdjustOffsets(int width, int elements, SlotInfo *slotPtr); -static void ArrangeGrid(ClientData clientData); +static void ArrangeGrid(void *clientData); static int CheckSlotData(Gridder *containerPtr, int slot, int slotType, int checkOnly); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, @@ -286,11 +286,11 @@ static int GridSizeCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int GridContentCommand(Tk_Window tkwin, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void GridStructureProc(ClientData clientData, +static void GridStructureProc(void *clientData, XEvent *eventPtr); -static void GridLostContentProc(ClientData clientData, +static void GridLostContentProc(void *clientData, Tk_Window tkwin); -static void GridReqProc(ClientData clientData, Tk_Window tkwin); +static void GridReqProc(void *clientData, Tk_Window tkwin); static void InitContainerData(Gridder *containerPtr); static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); @@ -330,7 +330,7 @@ static const Tk_GeomMgr gridMgrType = { int Tk_GridObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -416,7 +416,7 @@ Tk_GridObjCmd( } /* This should not happen */ - Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("internal error in grid", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "API_ABUSE", NULL); return TCL_ERROR; } @@ -694,7 +694,7 @@ GridForgetRemoveCommand( } if (contentPtr->containerPtr != NULL) { contentPtr->in = Tcl_NewStringObj( - Tk_PathName(contentPtr->containerPtr->tkwin), -1); + Tk_PathName(contentPtr->containerPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(contentPtr->in); } } @@ -752,21 +752,21 @@ GridInfoCommand( } infoObj = Tcl_NewObj(); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", TCL_INDEX_NONE), Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->column)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->row)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->numCols)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", TCL_INDEX_NONE), Tcl_NewWideIntObj(contentPtr->numRows)); TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft, contentPtr->padX); TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", TCL_INDEX_NONE), StickyToObj(contentPtr->sticky)); Tcl_SetObjResult(interp, infoObj); return TCL_OK; @@ -822,7 +822,7 @@ GridLocationCommand( containerPtr = GetGrid(container); if (containerPtr->containerDataPtr == NULL) { - Tcl_SetObjResult(interp, NewPairObj(-1, -1)); + Tcl_SetObjResult(interp, NewPairObj(-1, TCL_INDEX_NONE)); return TCL_OK; } gridPtr = containerPtr->containerDataPtr; @@ -1031,7 +1031,7 @@ GridRowColumnConfigureCommand( if ((objc == 4) || (objc == 5)) { if (lObjc != 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "must specify a single element on retrieval", -1)); + "must specify a single element on retrieval", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "USAGE", NULL); Tcl_DecrRefCount(listCopy); return TCL_ERROR; @@ -1069,17 +1069,17 @@ GridRowColumnConfigureCommand( } Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-minsize", -1)); + Tcl_NewStringObj("-minsize", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-pad", -1)); + Tcl_NewStringObj("-pad", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-uniform", -1)); + Tcl_NewStringObj("-uniform", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj(uniform == NULL ? "" : uniform, -1)); + Tcl_NewStringObj(uniform == NULL ? "" : uniform, TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, - Tcl_NewStringObj("-weight", -1)); + Tcl_NewStringObj("-weight", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight)); Tcl_SetObjResult(interp, res); Tcl_DecrRefCount(listCopy); @@ -1106,7 +1106,7 @@ GridRowColumnConfigureCommand( Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; Tcl_SetObjResult(interp, Tcl_NewStringObj( - (value == NULL) ? "" : value, -1)); + (value == NULL) ? "" : value, TCL_INDEX_NONE)); } else if (index == ROWCOL_PAD) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].pad : 0)); @@ -1441,7 +1441,7 @@ GridContentCommand( static void GridReqProc( - ClientData clientData, /* Grid's information about window that got + void *clientData, /* Grid's information about window that got * new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ @@ -1474,7 +1474,7 @@ GridReqProc( static void GridLostContentProc( - ClientData clientData, /* Grid structure for content window that was + void *clientData, /* Grid structure for content window that was * stolen away. */ TCL_UNUSED(Tk_Window)) /* Tk's handle for the content window. */ { @@ -1733,7 +1733,7 @@ AdjustForSticky( static void ArrangeGrid( - ClientData clientData) /* Structure describing container whose content + void *clientData) /* Structure describing container whose content * are to be re-layed out. */ { Gridder *containerPtr = (Gridder *)clientData; @@ -2595,7 +2595,7 @@ SetContentRow( lastRow = ((newRow >= 0) ? newRow : 0) + newNumRows; if (lastRow >= MAX_ELEMENT) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("row out of bounds", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_ROW", NULL); return TCL_ERROR; } @@ -2867,7 +2867,7 @@ DestroyGrid( static void GridStructureProc( - ClientData clientData, /* Our information about window referred to by + void *clientData, /* Our information about window referred to by * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { @@ -3048,7 +3048,7 @@ ConfigureContent( if ((firstChar == REL_HORIZ) && ((numWindows == 0) || (prevChar == REL_SKIP) || (prevChar == REL_VERT))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "must specify window before shortcut '-'", -1)); + "must specify window before shortcut '-'", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3068,7 +3068,7 @@ ConfigureContent( if ((objc - numWindows) & 1) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "extra option or option with no value", -1)); + "extra option or option with no value", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "BAD_PARAMETER", NULL); return TCL_ERROR; } @@ -3221,7 +3221,7 @@ ConfigureContent( } if (other == content) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "window can't be managed in itself", -1)); + "window can't be managed in itself", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } @@ -3466,7 +3466,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't use '^', can't find container window", -1)); + "can't use '^', can't find container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3520,7 +3520,7 @@ ConfigureContent( } if (!match) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't find content to extend with \"^\"", -1)); + "can't find content to extend with \"^\"", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } @@ -3528,7 +3528,7 @@ ConfigureContent( if (containerPtr == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't determine container window", -1)); + "can't determine container window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "GRID", "SHORTCUT_USAGE", NULL); return TCL_ERROR; } diff --git a/generic/tkIcu.c b/generic/tkIcu.c index b79694d..c586fb0 100644 --- a/generic/tkIcu.c +++ b/generic/tkIcu.c @@ -70,7 +70,7 @@ TCL_DECLARE_MUTEX(icu_mutex); static int startEndOfCmd( - ClientData clientData, + void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) @@ -228,7 +228,7 @@ Icu_Init( i = 0; while (iculibs[i] != NULL) { Tcl_ResetResult(interp); - nameobj = Tcl_NewStringObj(iculibs[i], -1); + nameobj = Tcl_NewStringObj(iculibs[i], TCL_INDEX_NONE); char *nameStr = Tcl_GetString(nameobj); char *p = strchr(nameStr, '?'); if (p != NULL) { @@ -250,7 +250,7 @@ Icu_Init( #if defined(_WIN32) if (icu_fns.lib == NULL) { Tcl_ResetResult(interp); - nameobj = Tcl_NewStringObj("icu.dll", -1); + nameobj = Tcl_NewStringObj("icu.dll", TCL_INDEX_NONE); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &icu_fns.lib) == TCL_OK) { @@ -260,7 +260,7 @@ Icu_Init( } if (icu_fns.lib == NULL) { Tcl_ResetResult(interp); - nameobj = Tcl_NewStringObj("icuuc.dll", -1); + nameobj = Tcl_NewStringObj("icuuc.dll", TCL_INDEX_NONE); Tcl_IncrRefCount(nameobj); if (Tcl_LoadFile(interp, nameobj, NULL, 0, NULL, &icu_fns.lib) == TCL_OK) { diff --git a/generic/tkImage.c b/generic/tkImage.c index 56b8c67..acc6d1b 100644 --- a/generic/tkImage.c +++ b/generic/tkImage.c @@ -33,12 +33,12 @@ typedef struct Image { struct ImageModel *modelPtr; /* Model for this image (identifiers image * manager, for example). */ - ClientData instanceData; /* One word argument to pass to image manager + void *instanceData; /* One word argument to pass to image manager * when dealing with this image instance. */ Tk_ImageChangedProc *changeProc; /* Code in widget to call when image changes * in a way that affects redisplay. */ - ClientData widgetClientData;/* Argument to pass to changeProc. */ + void *widgetClientData;/* Argument to pass to changeProc. */ struct Image *nextPtr; /* Next in list of all image instances * associated with the same name. */ } Image; @@ -53,7 +53,7 @@ typedef struct ImageModel { Tk_ImageType *typePtr; /* Information about image type. NULL means * that no image manager owns this image: the * image was deleted. */ - ClientData modelData; /* One-word argument to pass to image mgr when + void *modelData; /* One-word argument to pass to image mgr when * dealing with the model, as opposed to * instances. */ int width, height; /* Last known dimensions for image. */ @@ -85,7 +85,7 @@ static Tcl_ThreadDataKey dataKey; * Prototypes for local functions: */ -static void ImageTypeThreadExitProc(ClientData clientData); +static void ImageTypeThreadExitProc(void *clientData); static void DeleteImage(ImageModel *modelPtr); static void EventuallyDeleteImage(ImageModel *modelPtr, int forgetImageHashNow); @@ -206,7 +206,7 @@ Tk_CreateImageType( int Tk_ImageObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -392,7 +392,7 @@ Tk_ImageObjCmd( modelPtr->modelData); } Tcl_SetObjResult(interp, Tcl_NewStringObj( - (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE)); break; } case IMAGE_DELETE: @@ -422,7 +422,7 @@ Tk_ImageObjCmd( continue; } Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), -1)); + (const char *)Tcl_GetHashKey(&winPtr->mainPtr->imageTable, hPtr), TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); break; @@ -435,12 +435,12 @@ Tk_ImageObjCmd( for (typePtr = tsdPtr->imageTypeList; typePtr != NULL; typePtr = typePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - typePtr->name, -1)); + typePtr->name, TCL_INDEX_NONE)); } for (typePtr = tsdPtr->oldImageTypeList; typePtr != NULL; typePtr = typePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, Tcl_NewStringObj( - typePtr->name, -1)); + typePtr->name, TCL_INDEX_NONE)); } Tcl_SetObjResult(interp, resultObj); break; @@ -485,7 +485,7 @@ Tk_ImageObjCmd( case IMAGE_TYPE: if (modelPtr->typePtr != NULL) { Tcl_SetObjResult(interp, - Tcl_NewStringObj(modelPtr->typePtr->name, -1)); + Tcl_NewStringObj(modelPtr->typePtr->name, TCL_INDEX_NONE)); } break; case IMAGE_WIDTH: @@ -609,7 +609,7 @@ Tk_GetImage( Tk_ImageChangedProc *changeProc, /* Function to invoke when redisplay is needed * because image's pixels or size changed. */ - ClientData clientData) /* One-word argument to pass to damageProc. */ + void *clientData) /* One-word argument to pass to damageProc. */ { Tcl_HashEntry *hPtr; ImageModel *modelPtr; @@ -1072,7 +1072,7 @@ TkDeleteAllImages( *---------------------------------------------------------------------- */ -ClientData +void * Tk_GetImageModelData( Tcl_Interp *interp, /* Interpreter in which the image was * created. */ diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c index 3ff3a81..9344777 100644 --- a/generic/tkImgBmap.c +++ b/generic/tkImgBmap.c @@ -78,7 +78,7 @@ static int ImgBmapCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, void **clientDataPtr); -static ClientData ImgBmapGet(Tk_Window tkwin, void *clientData); +static void *ImgBmapGet(Tk_Window tkwin, void *clientData); static void ImgBmapDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, @@ -269,7 +269,7 @@ ImgBmapConfigureModel( || (modelPtr->maskDataString != NULL)) { if (modelPtr->data == NULL) { Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( - "can't have mask without bitmap", -1)); + "can't have mask without bitmap", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "NO_BITMAP", NULL); return TCL_ERROR; @@ -285,7 +285,7 @@ ImgBmapConfigureModel( ckfree(modelPtr->maskData); modelPtr->maskData = NULL; Tcl_SetObjResult(modelPtr->interp, Tcl_NewStringObj( - "bitmap and mask have different sizes", -1)); + "bitmap and mask have different sizes", TCL_INDEX_NONE)); Tcl_SetErrorCode(modelPtr->interp, "TK", "IMAGE", "BITMAP", "MASK_SIZE", NULL); return TCL_ERROR; @@ -595,7 +595,7 @@ TkGetBitmapData( if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "format error in bitmap data; looks like it's an" - " obsolete X10 bitmap file", -1)); + " obsolete X10 bitmap file", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "OBSOLETE", NULL); } @@ -640,7 +640,7 @@ TkGetBitmapData( error: if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "format error in bitmap data", -1)); + "format error in bitmap data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "BITMAP", "FORMAT", NULL); } @@ -805,7 +805,7 @@ ImgBmapCmd( *---------------------------------------------------------------------- */ -static ClientData +static void * ImgBmapGet( Tk_Window tkwin, /* Window in which the instance will be * used. */ @@ -1155,10 +1155,10 @@ ImgBmapPsImagemask( Tcl_AppendPrintfToObj(psObj, " %02x", bit_reverse[0xff & data[i*nBytePerRow + j]]); } - Tcl_AppendToObj(psObj, "\n", -1); + Tcl_AppendToObj(psObj, "\n", TCL_INDEX_NONE); } - Tcl_AppendToObj(psObj, ">} imagemask \n", -1); + Tcl_AppendToObj(psObj, ">} imagemask \n", TCL_INDEX_NONE); } /* @@ -1213,7 +1213,7 @@ ImgBmapPostscript( if (modelPtr->width*modelPtr->height > 60000) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unable to generate postscript for bitmaps larger than 60000" - " pixels", -1)); + " pixels", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "PS", "MEMLIMIT", NULL); return TCL_ERROR; } @@ -1263,7 +1263,7 @@ ImgBmapPostscript( if (modelPtr->maskData == NULL) { Tcl_AppendToObj(psObj, "0 0 moveto 1 0 rlineto 0 1 rlineto -1 0 rlineto " - "closepath fill\n", -1); + "closepath fill\n", TCL_INDEX_NONE); } else { ImgBmapPsImagemask(psObj, modelPtr->width, modelPtr->height, modelPtr->maskData); diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index b577fd8..819505e 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -123,7 +123,7 @@ typedef struct { * serializing in the GIF format. */ -typedef size_t (WriteBytesFunc) (ClientData clientData, const char *bytes, +typedef size_t (WriteBytesFunc) (void *clientData, const char *bytes, size_t byteCount); /* @@ -155,7 +155,7 @@ static int StringWriteGIF(Tcl_Interp *interp, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); static int CommonWriteGIF(Tcl_Interp *interp, - ClientData clientData, + void *clientData, WriteBytesFunc *writeProc, Tcl_Obj *format, Tcl_Obj *metadataInObj, Tk_PhotoImageBlock *blockPtr); @@ -305,7 +305,7 @@ typedef struct { */ int initialBits; - ClientData destination; + void *destination; WriteBytesFunc *writeProc; int clearCode; @@ -333,7 +333,7 @@ typedef struct { static int ColorNumber(GifWriterState *statePtr, int red, int green, int blue); -static void Compress(int initBits, ClientData handle, +static void Compress(int initBits, void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr); static int IsNewColor(GifWriterState *statePtr, @@ -505,7 +505,7 @@ FileReadGIF( if (BitSet(buf[0], LOCALCOLORMAP)) { /* Global Colormap */ if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "error reading color map", -1)); + "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); return TCL_ERROR; } @@ -550,7 +550,7 @@ FileReadGIF( switch (gifLabel) { case GIF_TERMINATOR: Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no image data for this index", -1)); + "no image data for this index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "NO_DATA", NULL); goto error; @@ -567,7 +567,7 @@ FileReadGIF( metadataOutObj) < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "error reading extension in GIF image", -1)); + "error reading extension in GIF image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", NULL); goto error; @@ -608,7 +608,7 @@ FileReadGIF( if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "error reading color map", -1)); + "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); goto error; @@ -671,7 +671,7 @@ FileReadGIF( if (BitSet(buf[8], LOCALCOLORMAP)) { if (!ReadColorMap(gifConfPtr, chan, bitPixel, colorMap)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "error reading color map", -1)); + "error reading color map", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLOR_MAP", NULL); goto error; } @@ -850,7 +850,7 @@ FileReadGIF( metadataOutObj) < 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "error reading extension in GIF image", -1)); + "error reading extension in GIF image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "BAD_EXT", NULL); goto error; @@ -871,7 +871,7 @@ FileReadGIF( break; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(tkImgFmtGIF.name, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(tkImgFmtGIF.name, TCL_INDEX_NONE)); result = TCL_OK; error: @@ -918,7 +918,7 @@ ReadOneByte( */ Tcl_SetObjResult(interp, Tcl_NewStringObj( - "premature end of image data", -1)); + "premature end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "PREMATURE_END", NULL); return -1; } @@ -1331,7 +1331,7 @@ ReadImage( } if (initialCodeSize > MAX_LWZ_BITS) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("malformed image", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("malformed image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "MALFORMED", NULL); return TCL_ERROR; } @@ -1953,7 +1953,7 @@ StringWriteGIF( static size_t WriteToChannel( - ClientData clientData, + void *clientData, const char *bytes, size_t byteCount) { @@ -1964,7 +1964,7 @@ WriteToChannel( static size_t WriteToByteArray( - ClientData clientData, + void *clientData, const char *bytes, size_t byteCount) { @@ -1980,7 +1980,7 @@ WriteToByteArray( static int CommonWriteGIF( Tcl_Interp *interp, - ClientData handle, + void *handle, WriteBytesFunc *writeProc, TCL_UNUSED(Tcl_Obj *), Tcl_Obj *metadataInObj, @@ -2024,7 +2024,7 @@ CommonWriteGIF( state.pixelPitch = blockPtr->pitch; SaveMap(&state, blockPtr); if (state.num >= MAXCOLORMAPSIZE) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("too many colors", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("too many colors", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "GIF", "COLORFUL", NULL); return TCL_ERROR; } @@ -2281,7 +2281,7 @@ ReadValue( static void Compress( int initialBits, - ClientData handle, + void *handle, WriteBytesFunc *writeProc, ifunptr readValue, GifWriterState *statePtr) diff --git a/generic/tkImgListFormat.c b/generic/tkImgListFormat.c index cb3d062..a2cfcd2 100644 --- a/generic/tkImgListFormat.c +++ b/generic/tkImgListFormat.c @@ -137,8 +137,7 @@ static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); -static int ParseColorAsList(Tcl_Interp *interp, const char *colorString, - int colorStrLen, unsigned char *redPtr, +static int ParseColorAsList(const char *colorString, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString, @@ -311,9 +310,9 @@ GetBadOptMsg( Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { - Tcl_AppendToObj(resObj, "no options allowed", -1); + Tcl_AppendToObj(resObj, "no options allowed", TCL_INDEX_NONE); } else { - Tcl_AppendToObj(resObj, "must be ", -1); + Tcl_AppendToObj(resObj, "must be ", TCL_INDEX_NONE); bit = 1; for (i = 0; formatOptionNames[i] != NULL; i++) { if (allowedOpts & bit) { @@ -325,12 +324,12 @@ GetBadOptMsg( /* * not the last option */ - Tcl_AppendToObj(resObj, ", ", -1); + Tcl_AppendToObj(resObj, ", ", TCL_INDEX_NONE); } else { - Tcl_AppendToObj(resObj, ", or ", -1); + Tcl_AppendToObj(resObj, ", or ", TCL_INDEX_NONE); } } - Tcl_AppendToObj(resObj, formatOptionNames[i], -1); + Tcl_AppendToObj(resObj, formatOptionNames[i], TCL_INDEX_NONE); } bit <<=1; } @@ -362,7 +361,7 @@ GetBadOptMsg( static int StringMatchDef( Tcl_Obj *data, /* The data to check */ - Tcl_Obj *formatString, /* Value of the -format option, not used here */ + TCL_UNUSED(Tcl_Obj *), /* Value of the -format option, not used here */ int *widthPtr, /* Width of image is written to this location */ int *heightPtr, /* Height of image is written to this location */ Tcl_Interp *interp) /* Error messages are left in this interpreter */ @@ -370,7 +369,6 @@ 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 @@ -698,13 +696,13 @@ StringWriteDef( case COLORFORMAT_RGB2: snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset]); - Tcl_DStringAppend(&line, colorBuf, -1); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); break; case COLORFORMAT_RGBA2: snprintf(colorBuf, sizeof(colorBuf), "#%02x%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset], alphaVal); - Tcl_DStringAppend(&line, colorBuf, -1); + Tcl_DStringAppend(&line, colorBuf, TCL_INDEX_NONE); break; case COLORFORMAT_LIST: Tcl_DStringStartSublist(&line); @@ -735,7 +733,7 @@ StringWriteDef( Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); Tcl_DStringFree(&line); } - result = Tcl_NewStringObj(Tcl_DStringValue(&data), -1); + result = Tcl_NewStringObj(Tcl_DStringValue(&data), TCL_INDEX_NONE); Tcl_DStringFree(&data); } else { result = Tcl_NewObj(); @@ -802,7 +800,7 @@ ParseColor( return ParseColorAsHex(interp, specString, length, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } - if (ParseColorAsList(interp, specString, length, + if (ParseColorAsList(specString, redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { return TCL_OK; } @@ -833,19 +831,13 @@ ParseColor( * Returns a standard Tcl result. * * Side effects: - * Does *not* leave error messages in interp. The reason is that - * it is not always possible to tell if the list format was even - * intended and thus it is hard to return meaningful messages. - * A general error message from the caller is probably the best - * alternative. + * None * *---------------------------------------------------------------------- */ static int ParseColorAsList( - 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 */ unsigned char *greenPtr, unsigned char *bluePtr, @@ -860,8 +852,6 @@ ParseColorAsList( const char *curPos; int values[4]; int i; - (void)dummy; - (void)colorStrLen; curPos = colorString; i = 0; diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c index 079bed1..7da9190 100644 --- a/generic/tkImgPNG.c +++ b/generic/tkImgPNG.c @@ -353,7 +353,7 @@ InitPNGImage( TCL_ZLIB_COMPRESS_DEFAULT, NULL, &pngPtr->stream) != TCL_OK) { if (interp) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "zlib initialization failed", -1)); + "zlib initialization failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "ZLIB_INIT", NULL); } if (objPtr) { @@ -544,7 +544,7 @@ ReadBase64( if (destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unexpected end of image data", -1)); + "unexpected end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL); return TCL_ERROR; } @@ -588,7 +588,7 @@ ReadByteArray( if ((size_t)pngPtr->strDataLen < destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unexpected end of image data", -1)); + "unexpected end of image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL); return TCL_ERROR; } @@ -676,7 +676,7 @@ ReadData( if (destSz && Tcl_Eof(pngPtr->channel)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unexpected end of file", -1)); + "unexpected end of file", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EOF", NULL); return TCL_ERROR; } @@ -762,7 +762,7 @@ CheckCRC( */ if (calculated != chunked) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("CRC check failed", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("CRC check failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "CRC", NULL); return TCL_ERROR; } @@ -1034,7 +1034,7 @@ ReadChunkHeader( if ((pc[i] < 65) || (pc[i] > 122) || ((pc[i] > 90) && (pc[i] < 97))) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid chunk type", -1)); + "invalid chunk type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "INVALID_CHUNK", NULL); return TCL_ERROR; @@ -1135,7 +1135,7 @@ CheckColor( if ((8 != pngPtr->bitDepth) && (16 != pngPtr->bitDepth)) { unsupportedDepth: Tcl_SetObjResult(interp, Tcl_NewStringObj( - "bit depth is not allowed for given color type", -1)); + "bit depth is not allowed for given color type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_DEPTH", NULL); return TCL_ERROR; } @@ -1300,7 +1300,7 @@ ReadIHDR( if (mismatch) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "data stream does not have a PNG signature", -1)); + "data stream does not have a PNG signature", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NO_SIG", NULL); return TCL_ERROR; } @@ -1318,14 +1318,14 @@ ReadIHDR( if (chunkType != CHUNK_IHDR) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "expected IHDR chunk type", -1)); + "expected IHDR chunk type", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NO_IHDR", NULL); return TCL_ERROR; } if (chunkSz != 13) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid IHDR chunk size", -1)); + "invalid IHDR chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IHDR", NULL); return TCL_ERROR; } @@ -1469,7 +1469,7 @@ ReadPLTE( case PNG_COLOR_GRAY: case PNG_COLOR_GRAYALPHA: Tcl_SetObjResult(interp, Tcl_NewStringObj( - "PLTE chunk type forbidden for grayscale", -1)); + "PLTE chunk type forbidden for grayscale", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "PLTE_UNEXPECTED", NULL); return TCL_ERROR; @@ -1486,7 +1486,7 @@ ReadPLTE( if (!chunkSz || (chunkSz > PNG_PLTE_MAXSZ) || (chunkSz % 3)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid palette chunk size", -1)); + "invalid palette chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PLTE", NULL); return TCL_ERROR; } @@ -1563,7 +1563,7 @@ ReadTRNS( if (chunkSz > PNG_TRNS_MAXSZ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid tRNS chunk size", -1)); + "invalid tRNS chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_TRNS", NULL); return TCL_ERROR; } @@ -1594,7 +1594,7 @@ ReadTRNS( if (chunkSz > pngPtr->paletteLen) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "size of tRNS chunk is too large for the palette", -1)); + "size of tRNS chunk is too large for the palette", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TRNS_SIZE", NULL); return TCL_ERROR; } @@ -1639,7 +1639,7 @@ ReadTRNS( if (chunkSz != 6) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid tRNS chunk size - must 6 bytes for RGB", -1)); + "invalid tRNS chunk size - must 6 bytes for RGB", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_TRNS", NULL); return TCL_ERROR; } @@ -1699,7 +1699,7 @@ ReadPHYS( if (chunkSz != 9) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid physical chunk size", -1)); + "invalid physical chunk size", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL); return TCL_ERROR; } @@ -1728,7 +1728,7 @@ ReadPHYS( if ( PPUx > 2147483647 || PPUy > 2147483647 || unitSpecifier > 1 ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid physical size value", -1)); + "invalid physical size value", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_PHYS", NULL); return TCL_ERROR; } @@ -2216,7 +2216,7 @@ ReadIDAT( if (Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "extra data after end of zlib stream", -1)); + "extra data after end of zlib stream", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; @@ -2308,7 +2308,7 @@ ReadIDAT( if (chunkSz != 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "compressed data after stream finalize in PNG data", -1)); + "compressed data after stream finalize in PNG data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; } @@ -2443,7 +2443,7 @@ ParseFormat( if ((pngPtr->alpha < 0.0) || (pngPtr->alpha > 1.0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "-alpha value must be between 0.0 and 1.0", -1)); + "-alpha value must be between 0.0 and 1.0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_ALPHA", NULL); return TCL_ERROR; @@ -2559,7 +2559,7 @@ DecodePNG( } } else if (PNG_COLOR_PLTE == pngPtr->colorType) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "PLTE chunk required for indexed color", -1)); + "PLTE chunk required for indexed color", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NEED_PLTE", NULL); return TCL_ERROR; } @@ -2620,7 +2620,7 @@ DecodePNG( if (chunkType != CHUNK_IDAT) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "at least one IDAT chunk is required", -1)); + "at least one IDAT chunk is required", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "NEED_IDAT", NULL); return TCL_ERROR; } @@ -2671,7 +2671,7 @@ DecodePNG( pngPtr->block.pixelPtr = (unsigned char *)attemptckalloc(pngPtr->blockLen); if (!pngPtr->block.pixelPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "memory allocation failed", -1)); + "memory allocation failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } @@ -2723,7 +2723,7 @@ DecodePNG( if (!Tcl_ZlibStreamEof(pngPtr->stream)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "unfinalized data stream in PNG data", -1)); + "unfinalized data stream in PNG data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; } @@ -2749,7 +2749,7 @@ DecodePNG( if (chunkSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "IEND chunk contents must be empty", -1)); + "IEND chunk contents must be empty", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IEND", NULL); return TCL_ERROR; } @@ -2770,7 +2770,7 @@ DecodePNG( #if 0 if (ReadData(interp, pngPtr, &c, 1, NULL) != TCL_ERROR) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "extra data following IEND chunk", -1)); + "extra data following IEND chunk", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "BAD_IEND", NULL); return TCL_ERROR; } @@ -3051,7 +3051,7 @@ WriteData( if (objSz + srcSz > INT_MAX) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "image too large to store completely in byte array", -1)); + "image too large to store completely in byte array", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } @@ -3060,7 +3060,7 @@ WriteData( if (!destPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "memory allocation failed", -1)); + "memory allocation failed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } @@ -3408,7 +3408,7 @@ WriteIDAT( if (Tcl_ZlibStreamPut(pngPtr->stream, pngPtr->thisLineObj, flush) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "deflate() returned error", -1)); + "deflate() returned error", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "DEFLATE", NULL); return TCL_ERROR; } @@ -3430,7 +3430,7 @@ WriteIDAT( */ outputObj = Tcl_NewObj(); - (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); + (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, TCL_INDEX_NONE); outputBytes = Tcl_GetByteArrayFromObj(outputObj, &outputSize); result = WriteChunk(interp, pngPtr, CHUNK_IDAT, outputBytes, outputSize); Tcl_DecrRefCount(outputObj); @@ -3500,8 +3500,8 @@ WriteExtraChunks( Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, "Software", 9); - Tcl_DStringAppend(&buf, "Tk Toolkit v", -1); - Tcl_DStringAppend(&buf, TK_PATCH_LEVEL, -1); + Tcl_DStringAppend(&buf, "Tk Toolkit v", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, TK_PATCH_LEVEL, TCL_INDEX_NONE); if (WriteChunk(interp, pngPtr, CHUNK_tEXt, (unsigned char *) Tcl_DStringValue(&buf), Tcl_DStringLength(&buf)) != TCL_OK) { @@ -3569,7 +3569,7 @@ WriteExtraChunks( if ( PPUx > 2147483647 || PPUy > 2147483647 ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "DPI or aspect out of range", -1)); + "DPI or aspect out of range", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "PHYS", NULL); return TCL_ERROR; } @@ -3659,7 +3659,7 @@ EncodePNG( if ((blockPtr->width > (INT_MAX - 1) / (pngPtr->bytesPerPixel)) || (blockPtr->height > INT_MAX / pngPtr->lineSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "image is too large to encode pixel data", -1)); + "image is too large to encode pixel data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index ad8b6a2..50d37d7 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -312,7 +312,7 @@ FileWritePPM( } snprintf(header, sizeof(header), "P6\n%d %d\n255\n", blockPtr->width, blockPtr->height); - Tcl_Write(chan, header, -1); + Tcl_Write(chan, header, TCL_INDEX_NONE); pixLinePtr = blockPtr->pixelPtr + blockPtr->offset[0]; greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; @@ -503,13 +503,13 @@ StringReadPPM( &maxIntensity, &dataBuffer, &dataSize); if (type == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't read raw PPM header from string", -1)); + "couldn't read raw PPM header from string", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "NO_HEADER", NULL); return TCL_ERROR; } if ((fileWidth <= 0) || (fileHeight <= 0)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "PPM image data has dimension(s) <= 0", -1)); + "PPM image data has dimension(s) <= 0", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "DIMENSIONS", NULL); return TCL_ERROR; } @@ -561,7 +561,7 @@ StringReadPPM( if (block.pitch*height > dataSize) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "truncated PPM data", -1)); + "truncated PPM data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "TRUNCATED", NULL); return TCL_ERROR; } @@ -597,7 +597,7 @@ StringReadPPM( if (dataSize < nBytes) { ckfree(pixelPtr); Tcl_SetObjResult(interp, Tcl_NewStringObj( - "truncated PPM data", -1)); + "truncated PPM data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PPM", "TRUNCATED", NULL); return TCL_ERROR; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 82bd956..b66472b 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -112,9 +112,9 @@ static const char *const optionNames[] = { static int ImgPhotoCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *clientDataPtr); -static void ImgPhotoDelete(ClientData clientData); -static int ImgPhotoPostscript(ClientData clientData, + void **clientDataPtr); +static void ImgPhotoDelete(void *clientData); +static int ImgPhotoPostscript(void *clientData, Tcl_Interp *interp, Tk_Window tkwin, Tk_PostscriptInfo psInfo, int x, int y, int width, int height, int prepass); @@ -189,14 +189,14 @@ static const Tk_ConfigSpec configSpecs[] = { * Forward declarations */ -static void PhotoFormatThreadExitProc(ClientData clientData); -static int ImgPhotoCmd(ClientData clientData, Tcl_Interp *interp, +static void PhotoFormatThreadExitProc(void *clientData); +static int ImgPhotoCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ParseSubcommandOptions( struct SubcommandOptions *optPtr, Tcl_Interp *interp, int allowedOptions, int *indexPtr, int objc, Tcl_Obj *const objv[]); -static void ImgPhotoCmdDeletedProc(ClientData clientData); +static void ImgPhotoCmdDeletedProc(void *clientData); static int ImgPhotoConfigureModel(Tcl_Interp *interp, PhotoModel *modelPtr, Tcl_Size objc, Tcl_Obj *const objv[], int flags); @@ -398,7 +398,7 @@ ImgPhotoCreate( TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ - ClientData *clientDataPtr) /* Store manager's token for image here; it + void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { PhotoModel *modelPtr; @@ -451,7 +451,7 @@ ImgPhotoCreate( static int ImgPhotoCmd( - ClientData clientData, /* Information about photo model. */ + void *clientData, /* Information about photo model. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -740,7 +740,7 @@ ImgPhotoCmd( if (ImgPhotoSetSize(modelPtr, options.toX2, options.toY2) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } @@ -788,7 +788,7 @@ ImgPhotoCmd( || (options.fromX2 > modelPtr->width) || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "coordinates for -from option extend outside image", -1)); + "coordinates for -from option extend outside image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); if (options.background) { Tk_FreeColor(options.background); @@ -805,7 +805,7 @@ ImgPhotoCmd( options.fromY2 = modelPtr->height; } if (!(options.options & OPT_FORMAT)) { - options.format = Tcl_NewStringObj("default", -1); + options.format = Tcl_NewStringObj("default", TCL_INDEX_NONE); freeObj = options.format; } @@ -1093,7 +1093,7 @@ ImgPhotoCmd( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't get image from a file in a safe interpreter", -1)); + "can't get image from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); return TCL_ERROR; } @@ -1158,7 +1158,7 @@ ImgPhotoCmd( options.toY + height) != TCL_OK) { Tcl_ResetResult(interp); Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); result = TCL_ERROR; goto readCleanup; @@ -1425,7 +1425,7 @@ readCleanup: if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't write image to a file in a safe interpreter", -1)); + "can't write image to a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "PHOTO_FILE", NULL); return TCL_ERROR; } @@ -1457,7 +1457,7 @@ readCleanup: || (options.fromX2 > modelPtr->width) || (options.fromY2 > modelPtr->height)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "coordinates for -from option extend outside image", -1)); + "coordinates for -from option extend outside image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_FROM", NULL); if (options.background) { Tk_FreeColor(options.background); @@ -1559,7 +1559,7 @@ readCleanup: if (fmtString == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "no available image file format has file writing" - " capability", -1)); + " capability", TCL_INDEX_NONE)); } else if (!matched) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image file format \"%s\" is unknown", fmtString)); @@ -1924,12 +1924,12 @@ ParseSubcommandOptions( if (allowedOptions & bit) { if (allowedOptions & (bit - 1)) { if (allowedOptions & ~((bit << 1) - 1)) { - Tcl_AppendToObj(msgObj, ", ", -1); + Tcl_AppendToObj(msgObj, ", ", TCL_INDEX_NONE); } else { - Tcl_AppendToObj(msgObj, ", or ", -1); + Tcl_AppendToObj(msgObj, ", or ", TCL_INDEX_NONE); } } - Tcl_AppendToObj(msgObj, *listPtr, -1); + Tcl_AppendToObj(msgObj, *listPtr, TCL_INDEX_NONE); } bit <<= 1; } @@ -1989,7 +1989,7 @@ ImgPhotoConfigureModel( data = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "value for \"-data\" missing", -1)); + "value for \"-data\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; @@ -2000,7 +2000,7 @@ ImgPhotoConfigureModel( format = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "value for \"-format\" missing", -1)); + "value for \"-format\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; @@ -2011,7 +2011,7 @@ ImgPhotoConfigureModel( metadataInObj = objv[i]; } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "value for \"-metadata\" missing", -1)); + "value for \"-metadata\" missing", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; @@ -2105,7 +2105,7 @@ ImgPhotoConfigureModel( if (TCL_OK != Tcl_DictObjSize(interp,metadataInObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "value for \"-metadata\" not a dict", -1)); + "value for \"-metadata\" not a dict", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); return TCL_ERROR; @@ -2129,7 +2129,7 @@ ImgPhotoConfigureModel( if (ImgPhotoSetSize(modelPtr, modelPtr->width, modelPtr->height) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } @@ -2184,7 +2184,7 @@ ImgPhotoConfigureModel( if (result != TCL_OK) { Tcl_Close(NULL, chan); Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } @@ -2233,7 +2233,7 @@ ImgPhotoConfigureModel( } if (ImgPhotoSetSize(modelPtr, imageWidth, imageHeight) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); goto errorExit; } @@ -2270,7 +2270,7 @@ ImgPhotoConfigureModel( Tcl_Size dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "driver metadata not a dict", -1)); + "driver metadata not a dict", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); goto errorExit; @@ -2431,7 +2431,7 @@ ToggleComplexAlphaIfNeeded( static void ImgPhotoDelete( - ClientData modelData) /* Pointer to PhotoModel structure for image. + void *modelData) /* Pointer to PhotoModel structure for image. * Must not have any more instances. */ { PhotoModel *modelPtr = (PhotoModel *)modelData; @@ -2486,7 +2486,7 @@ ImgPhotoDelete( static void ImgPhotoCmdDeletedProc( - ClientData clientData) /* Pointer to PhotoModel structure for + void *clientData) /* Pointer to PhotoModel structure for * image. */ { PhotoModel *modelPtr = (PhotoModel *)clientData; @@ -3123,7 +3123,7 @@ MatchStringFormat( if (Tcl_GetString(Tcl_GetObjResult(interp))[0] == '\0') { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't recognize image data", -1)); + "couldn't recognize image data", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); } @@ -3170,7 +3170,7 @@ Tk_FindPhoto( const char *imageName) /* Name of the desired photo image. */ { const Tk_ImageType *typePtr; - ClientData clientData = + void *clientData = Tk_GetImageModelData(interp, imageName, &typePtr); if ((typePtr == NULL) || (typePtr->name != tkPhotoImageType.name)) { @@ -3280,7 +3280,7 @@ Tk_PhotoPutBlock( if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } return TCL_ERROR; @@ -3297,7 +3297,7 @@ Tk_PhotoPutBlock( MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } goto errorExit; @@ -3726,7 +3726,7 @@ Tk_PhotoPutZoomedBlock( if (sourceBlock.pixelPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } return TCL_ERROR; @@ -3742,7 +3742,7 @@ Tk_PhotoPutZoomedBlock( MAX(yEnd, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } goto errorExit; @@ -4147,7 +4147,7 @@ Tk_PhotoExpand( MAX(height, modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } return TCL_ERROR; @@ -4222,7 +4222,7 @@ Tk_PhotoSetSize( ((height > 0) ? height: modelPtr->height)) == TCL_ERROR) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - TK_PHOTO_ALLOC_FAILURE_MESSAGE, -1)); + TK_PHOTO_ALLOC_FAILURE_MESSAGE, TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); } return TCL_ERROR; @@ -4515,7 +4515,7 @@ Tk_PhotoGetImage( static int ImgPhotoPostscript( - ClientData clientData, /* Handle for the photo image. */ + void *clientData, /* Handle for the photo image. */ Tcl_Interp *interp, /* Interpreter. */ TCL_UNUSED(Tk_Window), /* (unused) */ Tk_PostscriptInfo psInfo, /* Postscript info. */ diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index edf6609..73bbbf8 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -46,7 +46,7 @@ typedef struct { * It is a Tcl_Channel if image created by -file option * or a Tcl_Obj, if image is created with the -data option */ - ClientData dataOrChan; + void *dataOrChan; Tcl_DString formatString; NSVGimage *nsvgImage; RastOpts ropts; @@ -77,13 +77,13 @@ static int RasterizeSVG(Tcl_Interp *interp, static double GetScaleFromParameters(NSVGimage *nsvgImage, RastOpts *ropts, int *widthPtr, int *heightPtr); static NSVGcache * GetCachePtr(Tcl_Interp *interp); -static int CacheSVG(Tcl_Interp *interp, ClientData dataOrChan, +static int CacheSVG(Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts); -static NSVGimage * GetCachedSVG(Tcl_Interp *interp, ClientData dataOrChan, +static NSVGimage * GetCachedSVG(Tcl_Interp *interp, void *dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts); static void CleanCache(Tcl_Interp *interp); -static void FreeCache(ClientData clientData, Tcl_Interp *interp); +static void FreeCache(void *clientData, Tcl_Interp *interp); /* * The format record for the SVG nano file format: @@ -161,7 +161,7 @@ MemMem(const void *haystack, size_t haylen, static int FileMatchSVG( Tcl_Channel chan, - const char *fileName, + TCL_UNUSED(const char *), Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) @@ -171,7 +171,6 @@ FileMatchSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage; - (void)fileName; CleanCache(interp); if (Tcl_ReadChars(chan, dataObj, 4096, 0) == TCL_IO_FAILURE) { @@ -186,7 +185,7 @@ FileMatchSVG( Tcl_DecrRefCount(dataObj); return 0; } - if (!Tcl_Eof(chan) && (Tcl_ReadChars(chan, dataObj, -1, 1) == TCL_IO_FAILURE)) { + if (!Tcl_Eof(chan) && (Tcl_ReadChars(chan, dataObj, TCL_INDEX_NONE, 1) == TCL_IO_FAILURE)) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; @@ -231,7 +230,7 @@ static int FileReadSVG( Tcl_Interp *interp, Tcl_Channel chan, - const char *fileName, + TCL_UNUSED(const char *), Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, @@ -242,15 +241,14 @@ FileReadSVG( const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); - (void)fileName; if (nsvgImage == NULL) { Tcl_Obj *dataObj = Tcl_NewObj(); - if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { + if (Tcl_ReadChars(chan, dataObj, TCL_INDEX_NONE, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); - Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL); return TCL_ERROR; } @@ -407,7 +405,7 @@ ParseSVGWithOptions( inputCopy = (char *)attemptckalloc(length+1); if (inputCopy == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto error; } @@ -460,7 +458,7 @@ ParseSVGWithOptions( case OPT_SCALE_TO_WIDTH: if ( parameterScaleSeen ) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "only one of -scale, -scaletoheight, -scaletowidth may be given", -1)); + "only one of -scale, -scaletoheight, -scaletowidth may be given", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; @@ -481,7 +479,7 @@ ParseSVGWithOptions( } if (dpi < 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "-dpi value must be positive", -1)); + "-dpi value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_DPI", NULL); goto error; @@ -494,7 +492,7 @@ ParseSVGWithOptions( } if (ropts->scale <= 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "-scale value must be positive", -1)); + "-scale value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; @@ -507,7 +505,7 @@ ParseSVGWithOptions( } if (ropts->scaleToHeight <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "-scaletoheight value must be positive", -1)); + "-scaletoheight value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; @@ -520,7 +518,7 @@ ParseSVGWithOptions( } if (ropts->scaleToWidth <= 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "-scaletowidth value must be positive", -1)); + "-scaletowidth value must be positive", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; @@ -531,7 +529,7 @@ ParseSVGWithOptions( nsvgImage = nsvgParse(inputCopy, "px", (float) dpi); if (nsvgImage == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL); goto error; } @@ -571,7 +569,8 @@ RasterizeSVG( NSVGimage *nsvgImage, int destX, int destY, int width, int height, - int srcX, int srcY, + TCL_UNUSED(int), + TCL_UNUSED(int), RastOpts *ropts) { int w, h, c; @@ -580,14 +579,12 @@ RasterizeSVG( Tk_PhotoImageBlock svgblock; double scale; Tcl_WideUInt wh; - (void)srcX; - (void)srcY; scale = GetScaleFromParameters(nsvgImage, ropts, &w, &h); rast = nsvgCreateRasterizer(); if (rast == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "RASTERIZER_ERROR", NULL); goto cleanAST; @@ -596,14 +593,14 @@ RasterizeSVG( /* Tk Ticket [822330269b] Check potential int overflow in following ckalloc */ wh = (Tcl_WideUInt)w * (Tcl_WideUInt)h; if ( w < 0 || h < 0 || wh > INT_MAX / 4) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("image size overflow", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("image size overflow", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "IMAGE_SIZE_OVERFLOW", NULL); goto cleanRAST; } imgData = (unsigned char *)attemptckalloc(wh * 4); if (imgData == NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto cleanRAST; } @@ -752,7 +749,7 @@ GetCachePtr( static int CacheSVG( Tcl_Interp *interp, - ClientData dataOrChan, + void *dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts) @@ -793,7 +790,7 @@ CacheSVG( static NSVGimage * GetCachedSVG( Tcl_Interp *interp, - ClientData dataOrChan, + void *dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts) { @@ -866,10 +863,9 @@ CleanCache(Tcl_Interp *interp) */ static void -FreeCache(ClientData clientData, Tcl_Interp *interp) +FreeCache(void *clientData, TCL_UNUSED(Tcl_Interp *)) { 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 e1b9c38..856fe25 100644 --- a/generic/tkImgUtil.c +++ b/generic/tkImgUtil.c @@ -11,7 +11,9 @@ #include "tkInt.h" #include "xbytes.h" - +#ifdef _WIN32 +# include "tkWinInt.h" +#endif /* *---------------------------------------------------------------------- diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 8c7df20..d41bece 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -393,21 +393,21 @@ static int ConfigureListboxItem(Tcl_Interp *interp, static int ListboxDeleteSubCmd(Listbox *listPtr, int first, int last); static void DestroyListbox(void *memPtr); -static void DestroyListboxOptionTables(ClientData clientData, +static void DestroyListboxOptionTables(void *clientData, Tcl_Interp *interp); -static void DisplayListbox(ClientData clientData); +static void DisplayListbox(void *clientData); static int GetListboxIndex(Tcl_Interp *interp, Listbox *listPtr, Tcl_Obj *index, int endIsSize, int *indexPtr); static int ListboxInsertSubCmd(Listbox *listPtr, int index, int objc, Tcl_Obj *const objv[]); -static void ListboxCmdDeletedProc(ClientData clientData); +static void ListboxCmdDeletedProc(void *clientData); static void ListboxComputeGeometry(Listbox *listPtr, int fontChanged, int maxIsStale, int updateGrid); -static void ListboxEventProc(ClientData clientData, +static void ListboxEventProc(void *clientData, XEvent *eventPtr); -static Tcl_Size ListboxFetchSelection(ClientData clientData, +static Tcl_Size ListboxFetchSelection(void *clientData, Tcl_Size offset, char *buffer, Tcl_Size maxBytes); -static void ListboxLostSelection(ClientData clientData); +static void ListboxLostSelection(void *clientData); static void GenerateListboxSelectEvent(Listbox *listPtr); static void EventuallyRedrawRange(Listbox *listPtr, Tcl_Size first, Tcl_Size last); @@ -416,7 +416,7 @@ static int ListboxSelect(Listbox *listPtr, int first, int last, int select); static void ListboxUpdateHScrollbar(Listbox *listPtr); static void ListboxUpdateVScrollbar(Listbox *listPtr); -static int ListboxWidgetObjCmd(ClientData clientData, +static int ListboxWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int ListboxBboxSubCmd(Tcl_Interp *interp, @@ -429,9 +429,9 @@ static int ListboxYviewSubCmd(Tcl_Interp *interp, Listbox *listPtr, int objc, Tcl_Obj *const objv[]); static ItemAttr * ListboxGetItemAttributes(Tcl_Interp *interp, Listbox *listPtr, int index); -static void ListboxWorldChanged(ClientData instanceData); +static void ListboxWorldChanged(void *instanceData); static int NearestListboxElement(Listbox *listPtr, int y); -static char * ListboxListVarProc(ClientData clientData, +static char * ListboxListVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static void MigrateHashEntries(Tcl_HashTable *table, @@ -469,7 +469,7 @@ static const Tk_ClassProcs listboxClass = { int Tk_ListboxObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -477,7 +477,6 @@ Tk_ListboxObjCmd( Listbox *listPtr; Tk_Window tkwin; ListboxOptionTables *optionTables; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -494,7 +493,7 @@ Tk_ListboxObjCmd( if (optionTables == NULL) { /* * We haven't created the option tables for this widget class yet. Do - * it now and save the a pointer to them as the ClientData for the + * it now and save the a pointer to them as the void *for the * command, so future invocations will have access to it. */ @@ -599,7 +598,7 @@ Tk_ListboxObjCmd( static int ListboxWidgetObjCmd( - ClientData clientData, /* Information about listbox widget. */ + void *clientData, /* Information about listbox widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Arguments as Tcl_Obj's. */ @@ -1523,11 +1522,9 @@ DestroyListbox( static void DestroyListboxOptionTables( - ClientData clientData, /* Pointer to the OptionTables struct */ - Tcl_Interp *dummy) /* Pointer to the calling interp */ + void *clientData, /* Pointer to the OptionTables struct */ + TCL_UNUSED(Tcl_Interp *)) /* Pointer to the calling interp */ { - (void)dummy; - ckfree(clientData); return; } @@ -1761,7 +1758,7 @@ ConfigureListboxItem( static void ListboxWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc; @@ -1835,7 +1832,7 @@ ListboxWorldChanged( static void DisplayListbox( - ClientData clientData) /* Information about window. */ + void *clientData) /* Information about window. */ { Listbox *listPtr = (Listbox *)clientData; Tk_Window tkwin = listPtr->tkwin; @@ -2611,7 +2608,7 @@ ListboxDeleteSubCmd( static void ListboxEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Listbox *listPtr = (Listbox *)clientData; @@ -2687,7 +2684,7 @@ ListboxEventProc( static void ListboxCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { Listbox *listPtr = (Listbox *)clientData; @@ -3110,7 +3107,7 @@ ListboxSelect( static Tcl_Size ListboxFetchSelection( - ClientData clientData, /* Information about listbox widget. */ + void *clientData, /* Information about listbox widget. */ Tcl_Size offset, /* Offset within selection of first byte to be * returned. */ char *buffer, /* Location in which to place selection. */ @@ -3193,7 +3190,7 @@ ListboxFetchSelection( static void ListboxLostSelection( - ClientData clientData) /* Information about listbox widget. */ + void *clientData) /* Information about listbox widget. */ { Listbox *listPtr = (Listbox *)clientData; @@ -3323,12 +3320,12 @@ ListboxUpdateVScrollbar( interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, listPtr->yScrollCmd, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, firstStr, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, lastStr, -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&buf, listPtr->yScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, @@ -3395,12 +3392,12 @@ ListboxUpdateHScrollbar( interp = listPtr->interp; Tcl_Preserve(interp); Tcl_DStringInit(&buf); - Tcl_DStringAppend(&buf, listPtr->xScrollCmd, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, firstStr, -1); - Tcl_DStringAppend(&buf, " ", -1); - Tcl_DStringAppend(&buf, lastStr, -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&buf, listPtr->xScrollCmd, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, firstStr, TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, " ", TCL_INDEX_NONE); + Tcl_DStringAppend(&buf, lastStr, TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, @@ -3428,18 +3425,16 @@ ListboxUpdateHScrollbar( static char * ListboxListVarProc( - ClientData clientData, /* Information about button. */ + void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Not used. */ - const char *name2, /* Not used. */ + TCL_UNUSED(const char *), + TCL_UNUSED(const char *), int flags) /* Information about what happened. */ { Listbox *listPtr = (Listbox *)clientData; Tcl_Obj *oldListObj, *varListObj; Tcl_Size oldLength, i; Tcl_HashEntry *entry; - (void)name1; - (void)name2; /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! @@ -3590,7 +3585,7 @@ MigrateHashEntries( { int i, isNew; Tcl_HashEntry *entry; - ClientData clientData; + void *clientData; if (offset == 0) { return; diff --git a/generic/tkMain.c b/generic/tkMain.c index fe2c395..ad122d9 100644 --- a/generic/tkMain.c +++ b/generic/tkMain.c @@ -16,7 +16,7 @@ #include "tkInt.h" -extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); +extern int TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); /* * The default prompt used when the user has not overridden it. @@ -66,14 +66,16 @@ NewNativeObj( { Tcl_Obj *obj; Tcl_DString ds; + const char *str; #if defined(_WIN32) && defined(UNICODE) Tcl_DStringInit(&ds); Tcl_WCharToUtfDString(string, wcslen(string), &ds); + str = Tcl_DStringValue(&ds); #else - (void)Tcl_ExternalToUtfDString(NULL, (char *)string, -1, &ds); + str = Tcl_ExternalToUtfDString(NULL, (char *)string, strlen(string), &ds); #endif - obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); + obj = Tcl_NewStringObj(str, Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); return obj; } @@ -137,7 +139,7 @@ typedef struct { */ static void Prompt(Tcl_Interp *interp, InteractiveState *isPtr); -static void StdinProc(ClientData clientData, int mask); +static void StdinProc(void *clientData, int mask); /* *---------------------------------------------------------------------- @@ -289,7 +291,7 @@ Tk_MainEx( } Tcl_SetVar2Ex(interp, "argv0", NULL, appName, TCL_GLOBAL_ONLY); - Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY); + Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj((Tcl_WideInt)argc), TCL_GLOBAL_ONLY); argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { @@ -411,19 +413,19 @@ Tk_MainEx( static void StdinProc( - ClientData clientData, /* The state of interactive cmd line */ + void *clientData, /* The state of interactive cmd line */ TCL_UNUSED(int) /*mask*/) { char *cmd; int code; - int length; + Tcl_Size length; InteractiveState *isPtr = (InteractiveState *)clientData; Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; length = Tcl_Gets(chan, &isPtr->line); - if ((length < 0) && !isPtr->gotPartial) { + if ((length == TCL_INDEX_NONE) && !isPtr->gotPartial) { if (isPtr->tty) { /* * Would be better to find a way to exit the mainLoop? Or perhaps @@ -437,8 +439,8 @@ StdinProc( return; } - Tcl_DStringAppend(&isPtr->command, Tcl_DStringValue(&isPtr->line), -1); - cmd = Tcl_DStringAppend(&isPtr->command, "\n", -1); + Tcl_DStringAppend(&isPtr->command, Tcl_DStringValue(&isPtr->line), TCL_INDEX_NONE); + cmd = Tcl_DStringAppend(&isPtr->command, "\n", TCL_INDEX_NONE); Tcl_DStringFree(&isPtr->line); if (!Tcl_CommandComplete(cmd)) { isPtr->gotPartial = 1; diff --git a/generic/tkMenu.c b/generic/tkMenu.c index d94ba5b..c5d2bf5 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -324,14 +324,13 @@ static int CloneMenu(TkMenu *menuPtr, Tcl_Obj *newMenuName, Tcl_Obj *newMenuTypeString); static int ConfigureMenu(Tcl_Interp *interp, TkMenu *menuPtr, int objc, Tcl_Obj *const objv[]); -static int ConfigureMenuCloneEntries(Tcl_Interp *interp, - TkMenu *menuPtr, int index, +static int ConfigureMenuCloneEntries(TkMenu *menuPtr, int index, int objc, Tcl_Obj *const objv[]); static int ConfigureMenuEntry(TkMenuEntry *mePtr, int objc, Tcl_Obj *const objv[]); static void DeleteMenuCloneEntries(TkMenu *menuPtr, int first, int last); -static void DestroyMenuHashTable(ClientData clientData, +static void DestroyMenuHashTable(void *clientData, Tcl_Interp *interp); static void DestroyMenuInstance(TkMenu *menuPtr); static void DestroyMenuEntry(void *memPtr); @@ -345,19 +344,19 @@ static int MenuDoXPosition(Tcl_Interp *interp, static int MenuAddOrInsert(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc, Tcl_Obj *const objv[]); -static void MenuCmdDeletedProc(ClientData clientData); +static void MenuCmdDeletedProc(void *clientData); static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, Tcl_Size index, int type); -static char * MenuVarProc(ClientData clientData, +static char * MenuVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int MenuWidgetObjCmd(ClientData clientData, +static int MenuWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void MenuWorldChanged(ClientData instanceData); +static void MenuWorldChanged(void *instanceData); static int PostProcessEntry(TkMenuEntry *mePtr); static void RecursivelyDeleteMenu(TkMenu *menuPtr); static void UnhookCascadeEntry(TkMenuEntry *mePtr); -static void MenuCleanup(ClientData unused); +static void MenuCleanup(void *unused); static int GetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr, int lastOK, Tcl_Size *indexPtr); @@ -393,7 +392,7 @@ static const Tk_ClassProcs menuClass = { int Tk_MenuObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -519,7 +518,7 @@ Tk_MenuObjCmd( || ((menuPtr->mainMenuPtr == menuPtr) && ((cascadeListPtr->menuPtr->mainMenuPtr == cascadeListPtr->menuPtr)))) { - newObjv[0] = Tcl_NewStringObj("-menu", -1); + newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin),-1); Tcl_IncrRefCount(newObjv[0]); Tcl_IncrRefCount(newObjv[1]); @@ -527,9 +526,9 @@ Tk_MenuObjCmd( Tcl_DecrRefCount(newObjv[0]); Tcl_DecrRefCount(newObjv[1]); } else { - Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", -1); + Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); Tcl_Obj *windowNamePtr = Tcl_NewStringObj( - Tk_PathName(cascadeListPtr->menuPtr->tkwin), -1); + Tk_PathName(cascadeListPtr->menuPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(normalPtr); Tcl_IncrRefCount(windowNamePtr); @@ -543,7 +542,7 @@ Tk_MenuObjCmd( * entry of the parent's instance. */ - newObjv[0] = Tcl_NewStringObj("-menu", -1); + newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = newMenuName; Tcl_IncrRefCount(newObjv[0]); ConfigureMenuEntry(cascadeListPtr, 2, newObjv); @@ -606,7 +605,7 @@ Tk_MenuObjCmd( static int MenuWidgetObjCmd( - ClientData clientData, /* Information about menu widget. */ + void *clientData, /* Information about menu widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -816,7 +815,7 @@ MenuWidgetObjCmd( Tcl_SetObjResult(interp, resultPtr); } } else { - result = ConfigureMenuCloneEntries(interp, menuPtr, index, + result = ConfigureMenuCloneEntries(menuPtr, index, objc-3, objv+3); } Tcl_Release(mePtr); @@ -939,7 +938,7 @@ MenuWidgetObjCmd( } else { typeStr = menuEntryTypeStrings[menuPtr->entries[index]->type]; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, TCL_INDEX_NONE)); break; } case MENU_UNPOST: @@ -1015,9 +1014,9 @@ TkInvokeMenu( Tcl_DString ds; Tcl_DStringInit(&ds); - Tcl_DStringAppend(&ds, "tk::TearOffMenu ", -1); - Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), -1); - result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), -1, TCL_EVAL_GLOBAL); + Tcl_DStringAppend(&ds, "tk::TearOffMenu ", TCL_INDEX_NONE); + Tcl_DStringAppend(&ds, Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); + result = Tcl_EvalEx(interp, Tcl_DStringValue(&ds), TCL_INDEX_NONE, TCL_EVAL_GLOBAL); Tcl_DStringFree(&ds); } else if ((mePtr->type == CHECK_BUTTON_ENTRY) && (mePtr->namePtr != NULL)) { @@ -1131,7 +1130,7 @@ DestroyMenuInstance( nextCascadePtr = cascadePtr->nextCascadePtr; if (menuPtr->mainMenuPtr != menuPtr) { - Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1); + Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); parentMainMenuPtr = cascadePtr->menuPtr->mainMenuPtr; parentMainEntryPtr = @@ -1482,7 +1481,7 @@ DestroyMenuEntry( static void MenuWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { TkMenu *menuPtr = (TkMenu *)instanceData; Tcl_Size i; @@ -1951,8 +1950,7 @@ ConfigureMenuEntry( * Calls ConfigureMenuEntry for each menu in the clone chain. * * Results: - * The return value is a standard Tcl result. If TCL_ERROR is returned, - * then the interp's result contains an error message. + * The return value is a standard Tcl result. * * Side effects: * Configuration information such as label and accelerator get set for @@ -1963,7 +1961,6 @@ ConfigureMenuEntry( static int ConfigureMenuCloneEntries( - Tcl_Interp *dummy, /* Used for error reporting. */ TkMenu *menuPtr, /* Information about whole menu. */ int index, /* Index of mePtr within menuPtr's entries. */ int objc, /* Number of valid entries in argv. */ @@ -1975,7 +1972,6 @@ ConfigureMenuCloneEntries( TkMenuReferences *oldCascadeMenuRefPtr, *cascadeMenuRefPtr = NULL; Tcl_Obj *oldCascadePtr = NULL; const char *newCascadeName; - (void)dummy; /* * Cascades are kind of tricky here. This is special case #3 in the @@ -2056,9 +2052,9 @@ ConfigureMenuCloneEntries( Tcl_Obj *newObjv[2]; Tcl_Obj *newCloneNamePtr; Tcl_Obj *pathNamePtr = Tcl_NewStringObj( - Tk_PathName(menuListPtr->tkwin), -1); - Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", -1); - Tcl_Obj *menuObjPtr = Tcl_NewStringObj("-menu", -1); + Tk_PathName(menuListPtr->tkwin), TCL_INDEX_NONE); + Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); + Tcl_Obj *menuObjPtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); Tcl_IncrRefCount(pathNamePtr); newCloneNamePtr = TkNewMenuName(menuPtr->interp, @@ -2196,7 +2192,7 @@ GetMenuIndex( static void MenuCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { TkMenu *menuPtr = (TkMenu *)clientData; Tk_Window tkwin = menuPtr->tkwin; @@ -2424,10 +2420,10 @@ MenuAddOrInsert( TkMenu *cascadeMenuPtr = mePtr->childMenuRefPtr->menuPtr->mainMenuPtr; Tcl_Obj *newCascadePtr, *newObjv[2]; - Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", -1); + Tcl_Obj *menuNamePtr = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); Tcl_Obj *windowNamePtr = - Tcl_NewStringObj(Tk_PathName(menuListPtr->tkwin), -1); - Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", -1); + Tcl_NewStringObj(Tk_PathName(menuListPtr->tkwin), TCL_INDEX_NONE); + Tcl_Obj *normalPtr = Tcl_NewStringObj("normal", TCL_INDEX_NONE); TkMenuReferences *menuRefPtr; Tcl_IncrRefCount(windowNamePtr); @@ -2477,18 +2473,16 @@ MenuAddOrInsert( static char * MenuVarProc( - ClientData clientData, /* Information about menu entry. */ + void *clientData, /* Information about menu entry. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* First part of variable's name. */ - const char *name2, /* Second part of variable's name. */ + TCL_UNUSED(const char *), /* First part of variable's name. */ + TCL_UNUSED(const char *), /* Second part of variable's name. */ int flags) /* Describes what just happened. */ { TkMenuEntry *mePtr = (TkMenuEntry *)clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; - (void)name1; - (void)name2; if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) { /* @@ -2705,11 +2699,11 @@ CloneMenu( } } - menuDupCommandArray[0] = Tcl_NewStringObj("tk::MenuDup", -1); - menuDupCommandArray[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), -1); + menuDupCommandArray[0] = Tcl_NewStringObj("tk::MenuDup", TCL_INDEX_NONE); + menuDupCommandArray[1] = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); menuDupCommandArray[2] = newMenuNamePtr; if (newMenuTypePtr == NULL) { - menuDupCommandArray[3] = Tcl_NewStringObj("normal", -1); + menuDupCommandArray[3] = Tcl_NewStringObj("normal", TCL_INDEX_NONE); } else { menuDupCommandArray[3] = newMenuTypePtr; } @@ -2758,8 +2752,8 @@ CloneMenu( * structure. */ - newObjv[0] = Tcl_NewStringObj("bindtags", -1); - newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), -1); + newObjv[0] = Tcl_NewStringObj("bindtags", TCL_INDEX_NONE); + newObjv[1] = Tcl_NewStringObj(Tk_PathName(newMenuPtr->tkwin), TCL_INDEX_NONE); Tcl_IncrRefCount(newObjv[0]); Tcl_IncrRefCount(newObjv[1]); if (Tk_BindtagsObjCmd(newMenuPtr->tkwin, newMenuPtr->interp, 2, @@ -2778,7 +2772,7 @@ CloneMenu( if (strcmp(windowName, Tk_PathName(newMenuPtr->tkwin)) == 0) { Tcl_Obj *newElementPtr = Tcl_NewStringObj( - Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), -1); + Tk_PathName(newMenuPtr->mainMenuPtr->tkwin), TCL_INDEX_NONE); /* * The newElementPtr will have its refCount incremented @@ -2826,7 +2820,7 @@ CloneMenu( Tcl_IncrRefCount(newCascadePtr); CloneMenu(oldCascadePtr, newCascadePtr, NULL); - newObjv[0] = Tcl_NewStringObj("-menu", -1); + newObjv[0] = Tcl_NewStringObj("-menu", TCL_INDEX_NONE); newObjv[1] = newCascadePtr; Tcl_IncrRefCount(newObjv[0]); ConfigureMenuEntry(newMenuPtr->entries[i], 2, newObjv); @@ -3088,7 +3082,7 @@ TkNewMenuName( doDot = parentName[strlen(parentName) - 1] != '.'; - childPtr = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), -1); + childPtr = Tcl_NewStringObj(Tk_PathName(menuPtr->tkwin), TCL_INDEX_NONE); for (destString = Tcl_GetString(childPtr); *destString != '\0'; destString++) { if (*destString == '.') { @@ -3100,7 +3094,7 @@ TkNewMenuName( if (i == 0) { resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { - Tcl_AppendToObj(resultPtr, ".", -1); + Tcl_AppendToObj(resultPtr, ".", TCL_INDEX_NONE); } Tcl_AppendObjToObj(resultPtr, childPtr); } else { @@ -3109,7 +3103,7 @@ TkNewMenuName( Tcl_DecrRefCount(resultPtr); resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { - Tcl_AppendToObj(resultPtr, ".", -1); + Tcl_AppendToObj(resultPtr, ".", TCL_INDEX_NONE); } Tcl_AppendObjToObj(resultPtr, childPtr); intPtr = Tcl_NewWideIntObj(i); @@ -3237,7 +3231,7 @@ Tk_SetWindowMenubar( Tcl_Obj *newObjv[4]; Tcl_Obj *windowNamePtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); - Tcl_Obj *menubarPtr = Tcl_NewStringObj("menubar", -1); + Tcl_Obj *menubarPtr = Tcl_NewStringObj("menubar", TCL_INDEX_NONE); /* * Clone the menu and all of the cascades underneath it. @@ -3253,7 +3247,7 @@ Tk_SetWindowMenubar( cloneMenuRefPtr = TkFindMenuReferencesObj(interp, cloneMenuPtr); if ((cloneMenuRefPtr != NULL) && (cloneMenuRefPtr->menuPtr != NULL)) { - Tcl_Obj *cursorPtr = Tcl_NewStringObj("-cursor", -1); + Tcl_Obj *cursorPtr = Tcl_NewStringObj("-cursor", TCL_INDEX_NONE); Tcl_Obj *nullPtr = Tcl_NewObj(); cloneMenuRefPtr->menuPtr->parentTopLevelPtr = tkwin; @@ -3310,11 +3304,9 @@ Tk_SetWindowMenubar( static void DestroyMenuHashTable( - ClientData clientData, /* The menu hash table we are destroying. */ - Tcl_Interp *dummy) /* The interpreter we are destroying. */ + void *clientData, /* The menu hash table we are destroying. */ + TCL_UNUSED(Tcl_Interp *)) /* The interpreter we are destroying. */ { - (void)dummy; - Tcl_DeleteHashTable((Tcl_HashTable *)clientData); ckfree(clientData); } @@ -3570,10 +3562,8 @@ DeleteMenuCloneEntries( static void MenuCleanup( - ClientData dummy) + TCL_UNUSED(void *)) { - (void)dummy; - menusInitialized = 0; } diff --git a/generic/tkMenuDraw.c b/generic/tkMenuDraw.c index da8ae39..62ab105 100644 --- a/generic/tkMenuDraw.c +++ b/generic/tkMenuDraw.c @@ -19,8 +19,8 @@ static void AdjustMenuCoords(TkMenu *menuPtr, TkMenuEntry *mePtr, int *xPtr, int *yPtr); -static void ComputeMenuGeometry(ClientData clientData); -static void DisplayMenu(ClientData clientData); +static void ComputeMenuGeometry(void *clientData); +static void DisplayMenu(void *clientData); /* *---------------------------------------------------------------------- @@ -315,7 +315,7 @@ TkMenuConfigureEntryDrawOptions( } } else { if (index == menuPtr->active) { - TkActivateMenuEntry(menuPtr, -1); + TkActivateMenuEntry(menuPtr, TCL_INDEX_NONE); } } @@ -528,7 +528,7 @@ TkEventuallyRedrawMenu( static void ComputeMenuGeometry( - ClientData clientData) /* Structure describing menu. */ + void *clientData) /* Structure describing menu. */ { TkMenu *menuPtr = (TkMenu *)clientData; @@ -579,20 +579,15 @@ ComputeMenuGeometry( void TkMenuSelectImageProc( - ClientData clientData, /* Pointer to widget record. */ - int x, int y, /* Upper left pixel (within image) that must - * be redisplayed. */ - int width, int height, /* Dimensions of area to redisplay (may be - * <=0). */ - int imgWidth, int imgHeight)/* New dimensions of image. */ + void *clientData, /* Pointer to widget record. */ + TCL_UNUSED(int), /* Upper left pixel (within image) that must */ + TCL_UNUSED(int), /* be redisplayed. */ + TCL_UNUSED(int), /* Dimensions of area to redisplay (may be */ + TCL_UNUSED(int), /* <= 0). */ + TCL_UNUSED(int), + TCL_UNUSED(int))/* New dimensions of image. */ { 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)) { @@ -619,7 +614,7 @@ TkMenuSelectImageProc( static void DisplayMenu( - ClientData clientData) /* Information about widget. */ + void *clientData) /* Information about widget. */ { TkMenu *menuPtr = (TkMenu *)clientData; TkMenuEntry *mePtr; @@ -763,7 +758,7 @@ DisplayMenu( void TkMenuEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkMenu *menuPtr = (TkMenu *)clientData; @@ -824,20 +819,15 @@ TkMenuEventProc( void TkMenuImageProc( - ClientData clientData, /* Pointer to widget record. */ - int x, int y, /* Upper left pixel (within image) that must - * be redisplayed. */ - int width, int height, /* Dimensions of area to redisplay (may be - * <=0). */ - int imgWidth, int imgHeight)/* New dimensions of image. */ + void *clientData,/* Pointer to widget record. */ + TCL_UNUSED(int), /* Upper left pixel (within image) that must */ + TCL_UNUSED(int), /* * be redisplayed. */ + TCL_UNUSED(int), /* Dimensions of area to redisplay (may be */ + TCL_UNUSED(int), /* <=0). */ + TCL_UNUSED(int), /* New dimensions of image. */ + TCL_UNUSED(int)) { 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; @@ -924,7 +914,7 @@ TkPostSubmenu( */ subary[0] = menuPtr->postedCascade->namePtr; - subary[1] = Tcl_NewStringObj("unpost", -1); + subary[1] = Tcl_NewStringObj("unpost", TCL_INDEX_NONE); Tcl_IncrRefCount(subary[1]); TkEventuallyRedrawMenu(menuPtr, NULL); result = Tcl_EvalObjv(interp, 2, subary, 0); @@ -953,7 +943,7 @@ TkPostSubmenu( menuPtr->postedCascade = mePtr; subary[0] = mePtr->namePtr; - subary[1] = Tcl_NewStringObj("post", -1); + subary[1] = Tcl_NewStringObj("post", TCL_INDEX_NONE); subary[2] = Tcl_NewWideIntObj(x); subary[3] = Tcl_NewWideIntObj(y); Tcl_IncrRefCount(subary[1]); diff --git a/generic/tkMessage.c b/generic/tkMessage.c index a5c3a2f..5b89f7f 100644 --- a/generic/tkMessage.c +++ b/generic/tkMessage.c @@ -167,21 +167,21 @@ static const Tk_OptionSpec optionSpecs[] = { * Forward declarations for functions defined later in this file: */ -static void MessageCmdDeletedProc(ClientData clientData); -static void MessageEventProc(ClientData clientData, +static void MessageCmdDeletedProc(void *clientData); +static void MessageEventProc(void *clientData, XEvent *eventPtr); -static char * MessageTextVarProc(ClientData clientData, +static char * MessageTextVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int MessageWidgetObjCmd(ClientData clientData, +static int MessageWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void MessageWorldChanged(ClientData instanceData); +static void MessageWorldChanged(void *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(void *memPtr); -static void DisplayMessage(ClientData clientData); +static void DisplayMessage(void *clientData); /* * The structure below defines message class behavior by means of functions @@ -214,7 +214,7 @@ static const Tk_ClassProcs messageClass = { int Tk_MessageObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -222,7 +222,6 @@ Tk_MessageObjCmd( Message *msgPtr; Tk_OptionTable optionTable; Tk_Window tkwin; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -302,7 +301,7 @@ Tk_MessageObjCmd( static int MessageWidgetObjCmd( - ClientData clientData, /* Information about message widget. */ + void *clientData, /* Information about message widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -442,10 +441,9 @@ ConfigureMessage( * 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. */ + TCL_UNUSED(int)) /* Flags to pass to Tk_ConfigureWidget. */ { Tk_SavedOptions savedOptions; - (void)flags; /* * Eliminate any existing trace on a variable monitored by the message. @@ -493,7 +491,7 @@ ConfigureMessage( * be specified to Tk_ConfigureWidget. */ - msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, -1); + msgPtr->numChars = Tcl_NumUtfChars(msgPtr->string, TCL_INDEX_NONE); if (msgPtr->highlightWidth < 0) { msgPtr->highlightWidth = 0; @@ -524,7 +522,7 @@ ConfigureMessage( static void MessageWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc = NULL; @@ -666,7 +664,7 @@ ComputeMessageGeometry( static void DisplayMessage( - ClientData clientData) /* Information about window. */ + void *clientData) /* Information about window. */ { Message *msgPtr = (Message *)clientData; Tk_Window tkwin = msgPtr->tkwin; @@ -741,7 +739,7 @@ DisplayMessage( static void MessageEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Message *msgPtr = (Message *)clientData; @@ -795,7 +793,7 @@ MessageEventProc( static void MessageCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { Message *msgPtr = (Message *)clientData; @@ -830,16 +828,14 @@ MessageCmdDeletedProc( static char * MessageTextVarProc( - ClientData clientData, /* Information about message. */ + void *clientData, /* Information about message. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Name of variable. */ - const char *name2, /* Second part of variable name. */ + TCL_UNUSED(const char *), /* Name of variable. */ + TCL_UNUSED(const char *), /* Second part of variable name. */ int flags) /* Information about what happened. */ { Message *msgPtr = (Message *)clientData; const char *value; - (void)name1; - (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -884,7 +880,7 @@ MessageTextVarProc( if (msgPtr->string != NULL) { ckfree(msgPtr->string); } - msgPtr->numChars = Tcl_NumUtfChars(value, -1); + msgPtr->numChars = Tcl_NumUtfChars(value, TCL_INDEX_NONE); msgPtr->string = (char *)ckalloc(strlen(value) + 1); strcpy(msgPtr->string, value); ComputeMessageGeometry(msgPtr); diff --git a/generic/tkObj.c b/generic/tkObj.c index 47e593f..2df8838 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -1077,7 +1077,7 @@ Tcl_Obj * Tk_NewWindowObj( Tk_Window tkwin) { - Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); + Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), TCL_INDEX_NONE); TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr; WindowRep *winPtr; @@ -1152,7 +1152,7 @@ TkParsePadAmount( } if (objc != 1 && objc != 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "wrong number of parts to pad specification", -1)); + "wrong number of parts to pad specification", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "PADDING", "PARTS", NULL); return TCL_ERROR; } diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c index 3230300..e887154 100644 --- a/generic/tkOldConfig.c +++ b/generic/tkOldConfig.c @@ -45,7 +45,7 @@ static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, const Tk_ConfigSpec *staticSpecs); -static void DeleteSpecCacheTable(ClientData clientData, +static void DeleteSpecCacheTable(void *clientData, Tcl_Interp *interp); /* @@ -98,7 +98,7 @@ Tk_ConfigureWidget( * we're on our way out of the application */ - Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", NULL); return TCL_ERROR; } @@ -648,7 +648,7 @@ Tk_ConfigureInfo( return TCL_ERROR; } list = FormatConfigInfo(interp, tkwin, specPtr, widgRec); - Tcl_SetObjResult(interp, Tcl_NewStringObj(list, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(list, TCL_INDEX_NONE)); ckfree(list); return TCL_OK; } @@ -955,7 +955,7 @@ Tk_ConfigureValue( } result = FormatConfigValue(interp, tkwin, specPtr, widgRec, buffer, &freeProc); - Tcl_SetObjResult(interp, Tcl_NewStringObj(result, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(result, TCL_INDEX_NONE)); if (freeProc != NULL) { if ((freeProc == TCL_DYNAMIC) || (freeProc == (Tcl_FreeProc *) free)) { ckfree((char *) result); @@ -1174,7 +1174,7 @@ GetCachedSpecs( static void DeleteSpecCacheTable( - ClientData clientData, + void *clientData, TCL_UNUSED(Tcl_Interp *)) { Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData; diff --git a/generic/tkOption.c b/generic/tkOption.c index ca940db..b1a8d07 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -219,7 +219,7 @@ static void ExtendStacks(ElArray *arrayPtr, int leaf); static int GetDefaultOptions(Tcl_Interp *interp, TkWindow *winPtr); static ElArray * NewArray(int numEls); -static void OptionThreadExitProc(ClientData clientData); +static void OptionThreadExitProc(void *clientData); static void OptionInit(TkMainInfo *mainPtr); static int ParsePriority(Tcl_Interp *interp, const char *string); static int ReadOptionFile(Tcl_Interp *interp, Tk_Window tkwin, @@ -610,7 +610,7 @@ Tk_GetOption( int Tk_OptionObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of Tcl_Obj arguments. */ Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */ @@ -690,7 +690,7 @@ Tk_OptionObjCmd( value = Tk_GetOption(window, Tcl_GetString(objv[3]), Tcl_GetString(objv[4])); if (value != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(value, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(value, TCL_INDEX_NONE)); } break; } @@ -1095,7 +1095,7 @@ ReadOptionFile( if (Tcl_IsSafe(interp)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't read options from a file in a safe interpreter", -1)); + "can't read options from a file in a safe interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "OPTION_FILE", NULL); return TCL_ERROR; } @@ -1115,7 +1115,7 @@ ReadOptionFile( buffer = Tcl_NewObj(); Tcl_IncrRefCount(buffer); Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8"); - bufferSize = Tcl_ReadChars(chan, buffer, -1, 0); + bufferSize = Tcl_ReadChars(chan, buffer, TCL_INDEX_NONE, 0); if (bufferSize == TCL_IO_FAILURE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading file \"%s\": %s", diff --git a/generic/tkPack.c b/generic/tkPack.c index b7ba555..38797a5 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -103,8 +103,8 @@ typedef struct Packer { * The following structure is the official type record for the packer: */ -static void PackReqProc(ClientData clientData, Tk_Window tkwin); -static void PackLostContentProc(ClientData clientData, +static void PackReqProc(void *clientData, Tk_Window tkwin); +static void PackLostContentProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr packerType = { @@ -117,7 +117,7 @@ static const Tk_GeomMgr packerType = { * Forward declarations for functions defined later in this file: */ -static void ArrangePacking(ClientData clientData); +static void ArrangePacking(void *clientData); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyPacker(void *memPtr); @@ -126,7 +126,7 @@ static Packer * GetPacker(Tk_Window tkwin); static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, Packer *containerPtr, int objc,Tcl_Obj *const objv[]); #endif /* !TK_NO_DEPRECATED */ -static void PackStructureProc(ClientData clientData, +static void PackStructureProc(void *clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); static int XExpansion(Packer *contentPtr, int cavityWidth); @@ -162,12 +162,12 @@ TkAppendPadAmount( Tcl_Obj *padding[2]; if (halfSpace*2 == allSpace) { - Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), + Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, TCL_INDEX_NONE), Tcl_NewWideIntObj(halfSpace)); } else { padding[0] = Tcl_NewWideIntObj(halfSpace); padding[1] = Tcl_NewWideIntObj(allSpace - halfSpace); - Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), + Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, TCL_INDEX_NONE), Tcl_NewListObj(2, padding)); } } @@ -191,7 +191,7 @@ TkAppendPadAmount( int Tk_PackObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -356,36 +356,36 @@ Tk_PackObjCmd( } infoObj = Tcl_NewObj(); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", TCL_INDEX_NONE), Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", -1), - Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), -1)); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", -1), + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-anchor", TCL_INDEX_NONE), + Tcl_NewStringObj(Tk_NameOfAnchor(contentPtr->anchor), TCL_INDEX_NONE)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-expand", TCL_INDEX_NONE), Tcl_NewBooleanObj(contentPtr->flags & EXPAND)); switch (contentPtr->flags & (FILLX|FILLY)) { case 0: - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), - Tcl_NewStringObj("none", -1)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), + Tcl_NewStringObj("none", TCL_INDEX_NONE)); break; case FILLX: - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), - Tcl_NewStringObj("x", -1)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), + Tcl_NewStringObj("x", TCL_INDEX_NONE)); break; case FILLY: - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), - Tcl_NewStringObj("y", -1)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), + Tcl_NewStringObj("y", TCL_INDEX_NONE)); break; case FILLX|FILLY: - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", -1), - Tcl_NewStringObj("both", -1)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-fill", TCL_INDEX_NONE), + Tcl_NewStringObj("both", TCL_INDEX_NONE)); break; } TkAppendPadAmount(infoObj, "-ipadx", contentPtr->iPadX/2, contentPtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", contentPtr->iPadY/2, contentPtr->iPadY); TkAppendPadAmount(infoObj, "-padx", contentPtr->padLeft,contentPtr->padX); TkAppendPadAmount(infoObj, "-pady", contentPtr->padTop, contentPtr->padY); - Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", -1), - Tcl_NewStringObj(sideNames[contentPtr->side], -1)); + Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-side", TCL_INDEX_NONE), + Tcl_NewStringObj(sideNames[contentPtr->side], TCL_INDEX_NONE)); Tcl_SetObjResult(interp, infoObj); break; } @@ -517,7 +517,7 @@ Tk_PackObjCmd( static void PackReqProc( - ClientData clientData, /* Packer's information about window that got + void *clientData, /* Packer's information about window that got * new preferred geometry. */ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the * window. */ @@ -584,7 +584,7 @@ PackLostContentProc( static void ArrangePacking( - ClientData clientData) /* Structure describing container whose content + void *clientData) /* Structure describing container whose content * are to be re-layed out. */ { Packer *containerPtr = (Packer *)clientData; @@ -1241,7 +1241,7 @@ PackAfter( if (optionCount <= (index+1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" - " option must be followed by anchor point", -1)); + " option must be followed by anchor point", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", NULL); return TCL_ERROR; @@ -1435,7 +1435,7 @@ DestroyPacker( static void PackStructureProc( - ClientData clientData, /* Our information about window referred to by + void *clientData, /* Our information about window referred to by * eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { diff --git a/generic/tkPanedWindow.c b/generic/tkPanedWindow.c index 7698e82..64e26c5 100644 --- a/generic/tkPanedWindow.c +++ b/generic/tkPanedWindow.c @@ -675,7 +675,7 @@ PanedWindowWidgetObjCmd( if (resultObj == NULL) { if (i == pwPtr->numPanes) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "not managed by this window", -1)); + "not managed by this window", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "PANEDWINDOW", "UNMANAGED", NULL); } @@ -1129,7 +1129,7 @@ PanedWindowSashCommand( if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid sash index", -1)); + "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } @@ -1152,7 +1152,7 @@ PanedWindowSashCommand( if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid sash index", -1)); + "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } @@ -1188,7 +1188,7 @@ PanedWindowSashCommand( if (!ValidSashIndex(pwPtr, sash)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "invalid sash index", -1)); + "invalid sash index", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } @@ -2421,7 +2421,7 @@ GetSticky( } *p = '\0'; - return Tcl_NewStringObj(buffer, -1); + return Tcl_NewStringObj(buffer, TCL_INDEX_NONE); } /* @@ -3146,7 +3146,7 @@ PanedWindowIdentifyCoords( Tcl_Obj *list[2]; list[0] = Tcl_NewWideIntObj(found); - list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), -1); + list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), TCL_INDEX_NONE); Tcl_SetObjResult(interp, Tcl_NewListObj(2, list)); } return TCL_OK; diff --git a/generic/tkPlace.c b/generic/tkPlace.c index 276ee13..503e8c1 100644 --- a/generic/tkPlace.c +++ b/generic/tkPlace.c @@ -137,9 +137,9 @@ typedef struct Container { * The following structure is the official type record for the placer: */ -static void PlaceRequestProc(ClientData clientData, +static void PlaceRequestProc(void *clientData, Tk_Window tkwin); -static void PlaceLostContentProc(ClientData clientData, +static void PlaceLostContentProc(void *clientData, Tk_Window tkwin); static const Tk_GeomMgr placerType = { @@ -152,7 +152,7 @@ static const Tk_GeomMgr placerType = { * Forward declarations for functions defined later in this file: */ -static void ContentStructureProc(ClientData clientData, +static void ContentStructureProc(void *clientData, XEvent *eventPtr); static int ConfigureContent(Tcl_Interp *interp, Tk_Window tkwin, Tk_OptionTable table, int objc, @@ -163,9 +163,9 @@ static void FreeContent(Content *contentPtr); static Content * FindContent(Tk_Window tkwin); static Container * CreateContainer(Tk_Window tkwin); static Container * FindContainer(Tk_Window tkwin); -static void PlaceStructureProc(ClientData clientData, +static void PlaceStructureProc(void *clientData, XEvent *eventPtr); -static void RecomputePlacement(ClientData clientData); +static void RecomputePlacement(void *clientData); static void UnlinkContent(Content *contentPtr); /* @@ -187,7 +187,7 @@ static void UnlinkContent(Content *contentPtr); int Tk_PlaceObjCmd( - ClientData clientData, /* Interpreter main window. */ + void *clientData, /* Interpreter main window. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -786,10 +786,10 @@ PlaceInfoCommand( } infoObj = Tcl_NewObj(); if (contentPtr->containerPtr != NULL) { - Tcl_AppendToObj(infoObj, "-in", -1); + Tcl_AppendToObj(infoObj, "-in", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, infoObj, Tk_NewWindowObj(contentPtr->containerPtr->tkwin)); - Tcl_AppendToObj(infoObj, " ", -1); + Tcl_AppendToObj(infoObj, " ", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(infoObj, "-x %d -relx %.4g -y %d -rely %.4g", @@ -797,24 +797,24 @@ PlaceInfoCommand( if (contentPtr->widthPtr) { Tcl_AppendPrintfToObj(infoObj, " -width %d", contentPtr->width); } else { - Tcl_AppendToObj(infoObj, " -width {}", -1); + Tcl_AppendToObj(infoObj, " -width {}", TCL_INDEX_NONE); } if (contentPtr->relWidthPtr) { Tcl_AppendPrintfToObj(infoObj, " -relwidth %.4g", contentPtr->relWidth); } else { - Tcl_AppendToObj(infoObj, " -relwidth {}", -1); + Tcl_AppendToObj(infoObj, " -relwidth {}", TCL_INDEX_NONE); } if (contentPtr->heightPtr) { Tcl_AppendPrintfToObj(infoObj, " -height %d", contentPtr->height); } else { - Tcl_AppendToObj(infoObj, " -height {}", -1); + Tcl_AppendToObj(infoObj, " -height {}", TCL_INDEX_NONE); } if (contentPtr->relHeightPtr) { Tcl_AppendPrintfToObj(infoObj, " -relheight %.4g", contentPtr->relHeight); } else { - Tcl_AppendToObj(infoObj, " -relheight {}", -1); + Tcl_AppendToObj(infoObj, " -relheight {}", TCL_INDEX_NONE); } Tcl_AppendPrintfToObj(infoObj, " -anchor %s -bordermode %s", @@ -843,7 +843,7 @@ PlaceInfoCommand( static void RecomputePlacement( - ClientData clientData) /* Pointer to Container record. */ + void *clientData) /* Pointer to Container record. */ { Container *containerPtr = (Container *)clientData; Content *contentPtr; @@ -1062,7 +1062,7 @@ RecomputePlacement( static void PlaceStructureProc( - ClientData clientData, /* Pointer to Container structure for window + void *clientData, /* Pointer to Container structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { @@ -1141,7 +1141,7 @@ PlaceStructureProc( static void ContentStructureProc( - ClientData clientData, /* Pointer to Content structure for window + void *clientData, /* Pointer to Content structure for window * referred to by eventPtr. */ XEvent *eventPtr) /* Describes what just happened. */ { @@ -1178,7 +1178,7 @@ ContentStructureProc( static void PlaceRequestProc( - ClientData clientData, /* Pointer to our record for content. */ + void *clientData, /* Pointer to our record for content. */ TCL_UNUSED(Tk_Window)) /* Window that changed its desired size. */ { Content *contentPtr = (Content *)clientData; @@ -1223,7 +1223,7 @@ PlaceRequestProc( static void PlaceLostContentProc( - ClientData clientData, /* Content structure for content window that was + void *clientData, /* Content structure for content window that was * stolen away. */ Tk_Window tkwin) /* Tk's handle for the content window. */ { diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index e0d591c..ba770ee 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -574,12 +574,11 @@ ConfigureRectOval( static void DeleteRectOval( - Tk_Canvas canvas, /* Info about overall widget. */ + TCL_UNUSED(Tk_Canvas), /* Info about overall widget. */ Tk_Item *itemPtr, /* Item that is being deleted. */ Display *display) /* Display containing window for canvas. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; - (void)canvas; Tk_DeleteOutline(display, &(rectOvalPtr->outline)); if (rectOvalPtr->fillColor != NULL) { @@ -744,18 +743,15 @@ DisplayRectOval( Tk_Item *itemPtr, /* Item to be displayed. */ Display *display, /* Display on which to draw item. */ Drawable drawable, /* Pixmap or window in which to draw item. */ - int x, int y, int width, int height) - /* Describes region of canvas that must be - * redisplayed (not used). */ + TCL_UNUSED(int),/* Describes region of canvas that must be */ + TCL_UNUSED(int),/* redisplayed (not used). */ + TCL_UNUSED(int), + TCL_UNUSED(int)) { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; 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 @@ -1434,7 +1430,7 @@ RectOvalToPostscript( Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Canvas canvas, /* Information about overall canvas. */ Tk_Item *itemPtr, /* Item for which Postscript is wanted. */ - int prepass) /* 1 means this is a prepass to collect font + TCL_UNUSED(int)) /* 1 means this is a prepass to collect font * information; 0 means final Postscript is * being created. */ { @@ -1446,7 +1442,6 @@ 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]); @@ -1525,16 +1520,16 @@ RectOvalToPostscript( Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (fillStipple != None) { - Tcl_AppendToObj(psObj, "clip ", -1); + Tcl_AppendToObj(psObj, "clip ", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsStipple(interp, canvas, fillStipple); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); if (color != NULL) { - Tcl_AppendToObj(psObj, "grestore gsave\n", -1); + Tcl_AppendToObj(psObj, "grestore gsave\n", TCL_INDEX_NONE); } } else { - Tcl_AppendToObj(psObj, "fill\n", -1); + Tcl_AppendToObj(psObj, "fill\n", TCL_INDEX_NONE); } } @@ -1544,7 +1539,7 @@ RectOvalToPostscript( if (color != NULL) { Tcl_AppendObjToObj(psObj, pathObj); - Tcl_AppendToObj(psObj, "0 setlinejoin 2 setlinecap\n", -1); + Tcl_AppendToObj(psObj, "0 setlinejoin 2 setlinecap\n", TCL_INDEX_NONE); Tcl_ResetResult(interp); Tk_CanvasPsOutline(canvas, itemPtr, &rectOvalPtr->outline); diff --git a/generic/tkScale.c b/generic/tkScale.c index 82d9a20..e61b943 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -155,16 +155,16 @@ static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, static void DestroyScale(void *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); -static void ScaleCmdDeletedProc(ClientData clientData); -static void ScaleEventProc(ClientData clientData, +static void ScaleCmdDeletedProc(void *clientData); +static void ScaleEventProc(void *clientData, XEvent *eventPtr); -static char * ScaleVarProc(ClientData clientData, +static char * ScaleVarProc(void *clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); -static int ScaleWidgetObjCmd(ClientData clientData, +static int ScaleWidgetObjCmd(void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static void ScaleWorldChanged(ClientData instanceData); +static void ScaleWorldChanged(void *instanceData); static void ScaleSetVariable(TkScale *scalePtr); /* @@ -239,7 +239,7 @@ ScaleRound( int Tk_ScaleObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ @@ -247,7 +247,6 @@ Tk_ScaleObjCmd( TkScale *scalePtr; Tk_OptionTable optionTable; Tk_Window tkwin; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -372,7 +371,7 @@ Tk_ScaleObjCmd( static int ScaleWidgetObjCmd( - ClientData clientData, /* Information about scale widget. */ + void *clientData, /* Information about scale widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -485,7 +484,7 @@ ScaleWidgetObjCmd( case SLIDER: zone = "slider"; break; case TROUGH2: zone = "trough2"; break; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); break; } case COMMAND_SET: { @@ -755,7 +754,7 @@ ConfigureScale( static void ScaleWorldChanged( - ClientData instanceData) /* Information about widget. */ + void *instanceData) /* Information about widget. */ { XGCValues gcValues; GC gc; @@ -1150,7 +1149,7 @@ ComputeScaleGeometry( static void ScaleEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScale *scalePtr = (TkScale *)clientData; @@ -1199,7 +1198,7 @@ ScaleEventProc( static void ScaleCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { TkScale *scalePtr = (TkScale *)clientData; Tk_Window tkwin = scalePtr->tkwin; @@ -1329,10 +1328,10 @@ TkRoundIntervalToResolution( static char * ScaleVarProc( - ClientData clientData, /* Information about button. */ + void *clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ - const char *name1, /* Name of variable. */ - const char *name2, /* Second part of variable name. */ + TCL_UNUSED(const char *), /* Name of variable. */ + TCL_UNUSED(const char *), /* Second part of variable name. */ int flags) /* Information about what happened. */ { TkScale *scalePtr = (TkScale *)clientData; @@ -1340,8 +1339,6 @@ ScaleVarProc( double value; Tcl_Obj *valuePtr; int result; - (void)name1; - (void)name2; /* * If the variable is unset, then immediately recreate it unless the whole @@ -1501,7 +1498,7 @@ ScaleSetVariable( } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, - Tcl_NewStringObj(string, -1), TCL_GLOBAL_ONLY); + Tcl_NewStringObj(string, TCL_INDEX_NONE), TCL_GLOBAL_ONLY); scalePtr->flags &= ~SETTING_VAR; } } diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 48e6de1..4fb8b3c 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -99,8 +99,8 @@ static const Tk_ConfigSpec configSpecs[] = { static int ConfigureScrollbar(Tcl_Interp *interp, TkScrollbar *scrollPtr, int objc, Tcl_Obj *const objv[], int flags); -static void ScrollbarCmdDeletedProc(ClientData clientData); -static int ScrollbarWidgetObjCmd(ClientData clientData, +static void ScrollbarCmdDeletedProc(void *clientData); +static int ScrollbarWidgetObjCmd(void *clientData, Tcl_Interp *, int objc, Tcl_Obj *const objv[]); /* @@ -122,7 +122,7 @@ static int ScrollbarWidgetObjCmd(ClientData clientData, int Tk_ScrollbarObjCmd( - ClientData clientData, /* Main window associated with interpreter. */ + void *clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -220,7 +220,7 @@ Tk_ScrollbarObjCmd( static int ScrollbarWidgetObjCmd( - ClientData clientData, /* Information about scrollbar widget. */ + void *clientData, /* Information about scrollbar widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -264,7 +264,7 @@ ScrollbarWidgetObjCmd( case SLIDER: zone = "slider"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); goto done; } if (objc != 3) { @@ -413,7 +413,7 @@ ScrollbarWidgetObjCmd( case BOTTOM_GAP: zone = "trough2"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, TCL_INDEX_NONE)); break; } case COMMAND_SET: { @@ -584,7 +584,7 @@ ConfigureScrollbar( void TkScrollbarEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; @@ -650,7 +650,7 @@ TkScrollbarEventProc( static void ScrollbarCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { TkScrollbar *scrollPtr = (TkScrollbar *)clientData; Tk_Window tkwin = scrollPtr->tkwin; diff --git a/generic/tkSelect.c b/generic/tkSelect.c index 8cd774f..f83c386 100644 --- a/generic/tkSelect.c +++ b/generic/tkSelect.c @@ -1297,7 +1297,7 @@ SelGetProc( * used). */ const char *portion) /* New information to be appended. */ { - Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1); + Tcl_DStringAppend((Tcl_DString *)clientData, portion, TCL_INDEX_NONE); return TCL_OK; } @@ -1401,7 +1401,7 @@ HandleTclCommand( if (cmdInfoPtr->interp != NULL) { if (length <= maxBytes) { - cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, -1); + cmdInfoPtr->charOffset += Tcl_NumUtfChars(string, TCL_INDEX_NONE); cmdInfoPtr->buffer[0] = '\0'; } else { Tcl_UniChar ch = 0; @@ -1496,7 +1496,7 @@ TkSelDefaultSelection( } Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, - "MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW", -1); + "MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW", TCL_INDEX_NONE); for (selPtr = winPtr->selHandlerList; selPtr != NULL; selPtr = selPtr->nextPtr) { if ((selPtr->selection == infoPtr->selection) diff --git a/generic/tkSquare.c b/generic/tkSquare.c index c78edc7..a05ee70 100644 --- a/generic/tkSquare.c +++ b/generic/tkSquare.c @@ -96,14 +96,14 @@ static const Tk_OptionSpec optionSpecs[] = { * Forward declarations for procedures defined later in this file: */ -static void SquareDeletedProc(ClientData clientData); +static void SquareDeletedProc(void *clientData); static int SquareConfigure(Tcl_Interp *interp, Square *squarePtr); static void SquareDestroy(void *memPtr); -static void SquareDisplay(ClientData clientData); +static void SquareDisplay(void *clientData); static void KeepInWindow(Square *squarePtr); -static void SquareObjEventProc(ClientData clientData, +static void SquareObjEventProc(void *clientData, XEvent *eventPtr); -static int SquareWidgetObjCmd(ClientData clientData, +static int SquareWidgetObjCmd(void *clientData, Tcl_Interp *, int objc, Tcl_Obj * const objv[]); /* @@ -125,7 +125,7 @@ static int SquareWidgetObjCmd(ClientData clientData, int SquareObjCmd( - ClientData dummy, /* NULL. */ + TCL_UNUSED(void *), Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -133,7 +133,6 @@ SquareObjCmd( Square *squarePtr; Tk_Window tkwin; Tk_OptionTable optionTable; - (void)dummy; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); @@ -191,7 +190,7 @@ SquareObjCmd( } Tcl_SetObjResult(interp, - Tcl_NewStringObj(Tk_PathName(squarePtr->tkwin), -1)); + Tcl_NewStringObj(Tk_PathName(squarePtr->tkwin), TCL_INDEX_NONE)); return TCL_OK; error: @@ -219,7 +218,7 @@ SquareObjCmd( static int SquareWidgetObjCmd( - ClientData clientData, /* Information about square widget. */ + void *clientData, /* Information about square widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ @@ -319,13 +318,12 @@ SquareWidgetObjCmd( static int SquareConfigure( - Tcl_Interp *dummy, /* Used for error reporting. */ + TCL_UNUSED(Tcl_Interp *), /* 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 @@ -382,7 +380,7 @@ SquareConfigure( static void SquareObjEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { Square *squarePtr = (Square *)clientData; @@ -436,7 +434,7 @@ SquareObjEventProc( static void SquareDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; @@ -473,7 +471,7 @@ SquareDeletedProc( static void SquareDisplay( - ClientData clientData) /* Information about window. */ + void *clientData) /* Information about window. */ { Square *squarePtr = (Square *)clientData; Tk_Window tkwin = squarePtr->tkwin; diff --git a/generic/tkTest.c b/generic/tkTest.c index 08c211e..dd3764e 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -93,15 +93,15 @@ typedef struct TImageInstance { static int ImageCreate(Tcl_Interp *interp, const char *name, Tcl_Size objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageModel model, - ClientData *clientDataPtr); -static ClientData ImageGet(Tk_Window tkwin, ClientData clientData); -static void ImageDisplay(ClientData clientData, + void **clientDataPtr); +static ClientData ImageGet(Tk_Window tkwin, void *clientData); +static void ImageDisplay(void *clientData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); -static void ImageFree(ClientData clientData, Display *display); -static void ImageDelete(ClientData clientData); +static void ImageFree(void *clientData, Display *display); +static void ImageDelete(void *clientData); static Tk_ImageType imageType = { "test", /* name */ @@ -155,65 +155,65 @@ typedef struct TrivialCommandHeader { * Forward declarations for functions defined later in this file: */ -static int ImageObjCmd(ClientData dummy, +static int ImageObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestbitmapObjCmd(ClientData dummy, +static int TestbitmapObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestborderObjCmd(ClientData dummy, +static int TestborderObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestcolorObjCmd(ClientData dummy, +static int TestcolorObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestcursorObjCmd(ClientData dummy, +static int TestcursorObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestdeleteappsObjCmd(ClientData dummy, +static int TestdeleteappsObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestfontObjCmd(ClientData dummy, +static int TestfontObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); -static int TestmakeexistObjCmd(ClientData dummy, +static int TestmakeexistObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) -static int TestmenubarObjCmd(ClientData dummy, +static int TestmenubarObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #endif #if defined(_WIN32) -static int TestmetricsObjCmd(ClientData dummy, +static int TestmetricsObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #endif -static int TestobjconfigObjCmd(ClientData dummy, +static int TestobjconfigObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static Tk_CustomOptionSetProc CustomOptionSet; static Tk_CustomOptionGetProc CustomOptionGet; static Tk_CustomOptionRestoreProc CustomOptionRestore; static Tk_CustomOptionFreeProc CustomOptionFree; -static int TestpropObjCmd(ClientData dummy, +static int TestpropObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static int TestprintfObjCmd(ClientData dummy, +static int TestprintfObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) -static int TestwrapperObjCmd(ClientData dummy, +static int TestwrapperObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #endif -static void TrivialCmdDeletedProc(ClientData clientData); -static int TrivialConfigObjCmd(ClientData dummy, +static void TrivialCmdDeletedProc(void *clientData); +static int TrivialConfigObjCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); -static void TrivialEventProc(ClientData clientData, +static void TrivialEventProc(void *clientData, XEvent *eventPtr); -static int TestPhotoStringMatchCmd(ClientData dummy, +static int TestPhotoStringMatchCmd(void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); @@ -507,7 +507,7 @@ TestdeleteappsObjCmd( static int TestobjconfigObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1050,7 +1050,7 @@ TestobjconfigObjCmd( offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; - Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1); + Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", TCL_INDEX_NONE); Tk_OptionTable optionTable; record.fooObjPtr = NULL; @@ -1144,7 +1144,7 @@ TestobjconfigObjCmd( static int TrivialConfigObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1251,7 +1251,7 @@ TrivialConfigObjCmd( static void TrivialCmdDeletedProc( - ClientData clientData) /* Pointer to widget record for widget. */ + void *clientData) /* Pointer to widget record for widget. */ { TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; Tk_Window tkwin = headerPtr->tkwin; @@ -1289,7 +1289,7 @@ TrivialCmdDeletedProc( static void TrivialEventProc( - ClientData clientData, /* Information about window. */ + void *clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TrivialCommandHeader *headerPtr = (TrivialCommandHeader *)clientData; @@ -1326,7 +1326,7 @@ TrivialEventProc( static int TestfontObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ @@ -1394,7 +1394,7 @@ ImageCreate( TCL_UNUSED(const Tk_ImageType *), /* Pointer to our type record (not used). */ Tk_ImageModel model, /* Token for image, to be used by us in later * callbacks. */ - ClientData *clientDataPtr) /* Store manager's token for image here; it + void **clientDataPtr) /* Store manager's token for image here; it * will be returned in later callbacks. */ { TImageModel *timPtr; @@ -1450,7 +1450,7 @@ ImageCreate( static int ImageObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1508,7 +1508,7 @@ static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ - ClientData clientData) /* Pointer to TImageModel for image. */ + void *clientData) /* Pointer to TImageModel for image. */ { TImageModel *timPtr = (TImageModel *)clientData; TImageInstance *instPtr; @@ -1548,7 +1548,7 @@ ImageGet( static void ImageDisplay( - ClientData clientData, /* Pointer to TImageInstance for image. */ + void *clientData, /* Pointer to TImageInstance for image. */ Display *display, /* Display to use for drawing. */ Drawable drawable, /* Where to redraw image. */ int imageX, int imageY, /* Origin of area to redraw, relative to @@ -1639,7 +1639,7 @@ ImageDisplay( static void ImageFree( - ClientData clientData, /* Pointer to TImageInstance for instance. */ + void *clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { TImageInstance *instPtr = (TImageInstance *)clientData; @@ -1672,7 +1672,7 @@ ImageFree( static void ImageDelete( - ClientData clientData) /* Pointer to TImageModel for image. When + void *clientData) /* Pointer to TImageModel for image. When * this function is called, no more instances * exist. */ { @@ -1709,7 +1709,7 @@ ImageDelete( static int TestmakeexistObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1750,7 +1750,7 @@ TestmakeexistObjCmd( #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestmenubarObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1863,7 +1863,7 @@ TestmetricsObjCmd( static int TestpropObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1896,7 +1896,7 @@ TestpropObjCmd( *p = '\n'; } } - Tcl_SetObjResult(interp, Tcl_NewStringObj((/*!unsigned*/char*)property, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj((/*!unsigned*/char*)property, TCL_INDEX_NONE)); } else { for (p = property; length > 0; length--) { if (actualFormat == 32) { @@ -1990,7 +1990,7 @@ TestprintfObjCmd( static int TestwrapperObjCmd( - ClientData clientData, /* Main window for application. */ + void *clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -2014,7 +2014,7 @@ TestwrapperObjCmd( char buf[TCL_INTEGER_SPACE]; TkpPrintWindowId(buf, Tk_WindowId(wrapperPtr)); - Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, TCL_INDEX_NONE)); } return TCL_OK; } @@ -2087,7 +2087,7 @@ CustomOptionSet( string = Tcl_GetString(*value); Tcl_UtfToUpper(string); if (strcmp(string, "BAD") == 0) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("expected good value, got \"BAD\"", TCL_INDEX_NONE)); return TCL_ERROR; } } @@ -2113,7 +2113,7 @@ CustomOptionGet( char *recordPtr, Tcl_Size internalOffset) { - return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), -1)); + return (Tcl_NewStringObj(*(char **)(recordPtr + internalOffset), TCL_INDEX_NONE)); } static void @@ -2160,7 +2160,7 @@ CustomOptionFree( static int TestPhotoStringMatchCmd( - ClientData clientData, /* Main window for application. */ + TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -2168,7 +2168,6 @@ 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/tkUtil.c b/generic/tkUtil.c index 01a566e..4b39219 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -93,15 +93,15 @@ TkStateParseProc( msgObj = Tcl_ObjPrintf("bad %s value \"%s\": must be normal", ((flags & 4) ? "-default" : "state"), value); if (flags & 1) { - Tcl_AppendToObj(msgObj, ", active", -1); + Tcl_AppendToObj(msgObj, ", active", TCL_INDEX_NONE); } if (flags & 2) { - Tcl_AppendToObj(msgObj, ", hidden", -1); + Tcl_AppendToObj(msgObj, ", hidden", TCL_INDEX_NONE); } if (flags & 3) { - Tcl_AppendToObj(msgObj, ",", -1); + Tcl_AppendToObj(msgObj, ",", TCL_INDEX_NONE); } - Tcl_AppendToObj(msgObj, " or disabled", -1); + Tcl_AppendToObj(msgObj, " or disabled", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "VALUE", "STATE", NULL); *statePtr = TK_STATE_NORMAL; @@ -389,12 +389,12 @@ TkOffsetParseProc( badTSOffset: msgObj = Tcl_ObjPrintf("bad offset \"%s\": expected \"x,y\"", value); if (PTR2INT(clientData) & TK_OFFSET_RELATIVE) { - Tcl_AppendToObj(msgObj, ", \"#x,y\"", -1); + Tcl_AppendToObj(msgObj, ", \"#x,y\"", TCL_INDEX_NONE); } if (PTR2INT(clientData) & TK_OFFSET_INDEX) { - Tcl_AppendToObj(msgObj, ", ", -1); + Tcl_AppendToObj(msgObj, ", ", TCL_INDEX_NONE); } - Tcl_AppendToObj(msgObj, ", n, ne, e, se, s, sw, w, nw, or center", -1); + Tcl_AppendToObj(msgObj, ", n, ne, e, se, s, sw, w, nw, or center", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "VALUE", "OFFSET", NULL); return TCL_ERROR; @@ -1129,7 +1129,7 @@ TkMakeEnsemble( } } - nameObj = Tcl_NewStringObj(name, -1); + nameObj = Tcl_NewStringObj(name, TCL_INDEX_NONE); ensemble = Tcl_FindEnsemble(interp, nameObj, 0); Tcl_DecrRefCount(nameObj); if (ensemble == NULL) { @@ -1141,17 +1141,17 @@ TkMakeEnsemble( } Tcl_DStringSetLength(&ds, 0); - Tcl_DStringAppend(&ds, namesp, -1); + Tcl_DStringAppend(&ds, namesp, TCL_INDEX_NONE); if (!(strlen(namesp) == 2 && namesp[1] == ':')) { - Tcl_DStringAppend(&ds, "::", -1); + Tcl_DStringAppend(&ds, "::", TCL_INDEX_NONE); } - Tcl_DStringAppend(&ds, name, -1); + Tcl_DStringAppend(&ds, name, TCL_INDEX_NONE); dictObj = Tcl_NewObj(); for (i = 0; map[i].name != NULL ; ++i) { Tcl_Obj *fqdnObj; - nameObj = Tcl_NewStringObj(map[i].name, -1); + nameObj = Tcl_NewStringObj(map[i].name, TCL_INDEX_NONE); fqdnObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_AppendStringsToObj(fqdnObj, "::", map[i].name, NULL); diff --git a/generic/tkVisual.c b/generic/tkVisual.c index 09d1fa1..799cdbf 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -208,7 +208,7 @@ Tk_GetVisual( for (dictPtr = visualNames; dictPtr->minLength; dictPtr++) { Tcl_AppendPrintfToObj(msgObj, "%s, ", dictPtr->name); } - Tcl_AppendToObj(msgObj, "or default", -1); + Tcl_AppendToObj(msgObj, "or default", TCL_INDEX_NONE); Tcl_SetObjResult(interp, msgObj); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "VISUAL", string, NULL); return NULL; @@ -239,7 +239,7 @@ Tk_GetVisual( &numVisuals); if (visInfoList == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "couldn't find an appropriate visual", -1)); + "couldn't find an appropriate visual", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "VISUAL", "INAPPROPRIATE", NULL); return NULL; } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 2f63436..fef3c55 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -435,7 +435,7 @@ GetScreen( screenName = TkGetDefaultScreenName(interp, screenName); if (screenName == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no display name and no $DISPLAY environment variable", -1)); + "no display name and no $DISPLAY environment variable", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_DISPLAY", NULL); return NULL; } @@ -446,8 +446,8 @@ GetScreen( p--; } if ((*p == '.') && (p[1] != '\0')) { - length = p - screenName; - screenId = strtoul(p+1, NULL, 10); + length = (size_t)(p - screenName); + screenId = (int)strtoul(p+1, NULL, 10); } /* @@ -956,7 +956,7 @@ TkCreateMainWindow( mainPtr->tclUpdateObjProc2 = cmdInfo.objProc2; } else #endif - if (!cmdInfo.objClientData ) { + if (!cmdInfo.objClientData) { mainPtr->tclUpdateObjProc = cmdInfo.objProc; } } @@ -1106,13 +1106,13 @@ Tk_CreateWindow( if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't create window: parent has been destroyed", -1)); + "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (parentPtr->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: its parent has -container = yes", - -1)); + TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } else if (screenName == NULL) { @@ -1170,13 +1170,13 @@ Tk_CreateAnonymousWindow( if (parentPtr) { if (parentPtr->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't create window: parent has been destroyed", -1)); + "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (parentPtr->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "can't create window: its parent has -container = yes", - -1)); + TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } else if (screenName == NULL) { @@ -1258,7 +1258,7 @@ Tk_CreateWindowFromPath( Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } - numChars = p-pathName; + numChars = (size_t)(p - pathName); if (numChars > FIXED_SPACE) { p = (char *)ckalloc(numChars + 1); } else { @@ -1285,12 +1285,12 @@ Tk_CreateWindowFromPath( } if (((TkWindow *) parent)->flags & TK_ALREADY_DEAD) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't create window: parent has been destroyed", -1)); + "can't create window: parent has been destroyed", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "DEAD_PARENT", NULL); return NULL; } else if (((TkWindow *) parent)->flags & TK_CONTAINER) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "can't create window: its parent has -container = yes", -1)); + "can't create window: its parent has -container = yes", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "CREATE", "CONTAINER", NULL); return NULL; } @@ -1999,8 +1999,8 @@ Tk_ResizeWindow( { TkWindow *winPtr = (TkWindow *) tkwin; - winPtr->changes.width = (unsigned) width; - winPtr->changes.height = (unsigned) height; + winPtr->changes.width = width; + winPtr->changes.height = height; if (winPtr->window != None) { XResizeWindow(winPtr->display, winPtr->window, (unsigned) width, (unsigned) height); @@ -2021,8 +2021,8 @@ Tk_MoveResizeWindow( winPtr->changes.x = x; winPtr->changes.y = y; - winPtr->changes.width = (unsigned) width; - winPtr->changes.height = (unsigned) height; + winPtr->changes.width = width; + winPtr->changes.height = height; if (winPtr->window != None) { XMoveResizeWindow(winPtr->display, winPtr->window, x, y, (unsigned) width, (unsigned) height); @@ -2421,7 +2421,7 @@ Tk_NameToWindow( */ if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window",-1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj("NULL main window",TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", NULL); } return NULL; @@ -2751,7 +2751,7 @@ Tk_MainWindow( } } Tcl_SetObjResult(interp, Tcl_NewStringObj( - "this isn't a Tk application", -1)); + "this isn't a Tk application", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "NO_MAIN_WINDOW", NULL); return NULL; } @@ -2956,10 +2956,11 @@ static HMODULE tkcygwindll = NULL; * This means that the system encoding is utf-8, so we don't have to do any * encoding conversions. */ +extern int TkCygwinMainEx(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); int TkCygwinMainEx( - int argc, /* Number of arguments. */ + Tcl_Size argc, /* Number of arguments. */ char **argv, /* Array of argument strings. */ Tcl_AppInitProc *appInitProc, /* Application-specific initialization @@ -2969,7 +2970,7 @@ TkCygwinMainEx( { WCHAR name[MAX_PATH]; size_t len; - void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *); + void (*tkmainex)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *); /* construct "/libtk8.?.dll", from "/tk8?.dll" */ len = GetModuleFileNameW((HINSTANCE)Tk_GetHINSTANCE(), name, MAX_PATH); @@ -2983,7 +2984,7 @@ TkCygwinMainEx( /* dll is not present */ return 0; } - tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *)) + tkmainex = (void (*)(Tcl_Size, char **, Tcl_AppInitProc *, Tcl_Interp *)) (void *)GetProcAddress(tkcygwindll, "Tk_MainEx"); if (!tkmainex) { return 0; @@ -3221,7 +3222,7 @@ Initialize( parent = Tcl_GetParent(parent); if (parent == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( - "no controlling parent interpreter", -1)); + "no controlling parent interpreter", TCL_INDEX_NONE)); Tcl_SetErrorCode(interp, "TK", "SAFE", "NO_PARENT", NULL); return TCL_ERROR; } @@ -3242,7 +3243,7 @@ Initialize( cmd = Tcl_NewListObj(2, NULL); Tcl_ListObjAppendElement(NULL, cmd, - Tcl_NewStringObj("::safe::TkInit", -1)); + Tcl_NewStringObj("::safe::TkInit", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, Tcl_GetObjResult(parent)); /* @@ -3294,7 +3295,7 @@ Initialize( Tcl_SetVar2Ex(interp, "argv", NULL, Tcl_NewListObj(objc-1, rest+1), TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "argc", NULL, - Tcl_NewWideIntObj(objc-1), TCL_GLOBAL_ONLY); + Tcl_NewWideIntObj((Tcl_WideInt)objc-1), TCL_GLOBAL_ONLY); ckfree(rest); } Tcl_DecrRefCount(parseList); @@ -3340,13 +3341,13 @@ Initialize( * information parsed from argv, if any. */ - cmd = Tcl_NewStringObj("toplevel . -class", -1); + cmd = Tcl_NewStringObj("toplevel . -class", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, cmd, classObj); classObj = NULL; if (displayObj) { - Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-screen", -1)); + Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-screen", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, displayObj); /* @@ -3361,17 +3362,17 @@ Initialize( displayObj = NULL; } if (colorMapObj) { - Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-colormap", -1)); + Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-colormap", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, colorMapObj); colorMapObj = NULL; } if (useObj) { - Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-use", -1)); + Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-use", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, useObj); useObj = NULL; } if (visualObj) { - Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-visual", -1)); + Tcl_ListObjAppendElement(NULL, cmd, Tcl_NewStringObj("-visual", TCL_INDEX_NONE)); Tcl_ListObjAppendElement(NULL, cmd, visualObj); visualObj = NULL; } @@ -3397,7 +3398,7 @@ Initialize( Tcl_SetVar2Ex(interp, "geometry", NULL, geometryObj, TCL_GLOBAL_ONLY); - cmd = Tcl_NewStringObj("wm geometry .", -1); + cmd = Tcl_NewStringObj("wm geometry .", TCL_INDEX_NONE); Tcl_ListObjAppendElement(NULL, cmd, geometryObj); Tcl_IncrRefCount(cmd); code = Tcl_EvalObjEx(interp, cmd, 0); @@ -3467,7 +3468,7 @@ Initialize( tcl_findLibrary tk $tk_version $tk_patchLevel tk.tcl TK_LIBRARY tk_library\n\ }\n\ }\n\ -tkInit", -1, TCL_EVAL_GLOBAL); +tkInit", TCL_INDEX_NONE, TCL_EVAL_GLOBAL); } if (code == TCL_OK) { /* -- cgit v0.12