From 978ebdabc724269d5559757507f87bd121953099 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sun, 30 Oct 2022 19:40:32 +0000 Subject: more int -> Tcl_Size (making use of the increased range in Tcl 9.0) --- generic/tkFileFilter.c | 5 ++-- generic/tkImgGIF.c | 3 +- generic/tkImgPhoto.c | 8 +++--- generic/tkImgSVGnano.c | 2 +- generic/tkInt.decls | 12 ++++---- generic/tkInt.h | 2 +- generic/tkIntDecls.h | 12 ++++---- generic/tkIntPlatDecls.h | 24 ++++++++-------- generic/tkListbox.c | 72 +++++++++++++++++++++++------------------------ generic/tkStubInit.c | 4 +-- generic/tkTest.c | 27 ++++++++---------- generic/tkText.c | 4 +-- generic/tkText.h | 14 ++++----- generic/tkTextDisp.c | 13 ++++----- generic/tkTextImage.c | 2 +- generic/tkTextMark.c | 4 +-- generic/tkTextTag.c | 2 +- generic/tkTextWind.c | 2 +- generic/tkUtil.c | 5 ++-- generic/ttk/ttkEntry.c | 14 ++++----- generic/ttk/ttkImage.c | 6 ++-- generic/ttk/ttkScroll.c | 2 +- generic/ttk/ttkState.c | 11 ++++---- generic/ttk/ttkTagSet.c | 4 +-- generic/ttk/ttkTheme.c | 2 +- generic/ttk/ttkTheme.h | 2 +- generic/ttk/ttkTreeview.c | 37 ++++++++++++------------ generic/ttk/ttkWidget.h | 4 +-- macosx/tkMacOSXDialog.c | 7 +++-- macosx/tkMacOSXEmbed.c | 4 +-- macosx/tkMacOSXWm.c | 8 ++++-- macosx/tkMacOSXWm.h | 2 +- unix/tkUnixEmbed.c | 4 +-- unix/tkUnixSend.c | 4 +-- win/tkWinDialog.c | 2 +- win/tkWinEmbed.c | 4 +-- win/tkWinWm.c | 9 +++--- win/ttkWinXPTheme.c | 7 +++-- 38 files changed, 174 insertions(+), 176 deletions(-) diff --git a/generic/tkFileFilter.c b/generic/tkFileFilter.c index 809f036..26b5af6 100644 --- a/generic/tkFileFilter.c +++ b/generic/tkFileFilter.c @@ -79,9 +79,8 @@ TkGetFileFilters( Tcl_Obj *types, /* Value of the -filetypes option. */ int isWindows) /* True if we are running on Windows. */ { - int listObjc; + Tcl_Size i, listObjc; Tcl_Obj ** listObjv = NULL; - int i; if (types == NULL) { return TCL_OK; @@ -110,7 +109,7 @@ TkGetFileFilters( * third is the Mac OSType ID, but we don't care about them here. */ - int count; + Tcl_Size count; FileFilter *filterPtr; Tcl_Obj **typeInfo; diff --git a/generic/tkImgGIF.c b/generic/tkImgGIF.c index f9f2ea6..b577fd8 100644 --- a/generic/tkImgGIF.c +++ b/generic/tkImgGIF.c @@ -423,7 +423,8 @@ FileReadGIF( { int fileWidth, fileHeight, imageWidth, imageHeight; unsigned int nBytes; - int index = 0, argc = 0, i, result = TCL_ERROR; + int index = 0, result = TCL_ERROR; + Tcl_Size argc = 0, i; Tcl_Obj **objv; unsigned char buf[100]; unsigned char *trashBuffer = NULL; diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 5bb10f8..4bbc205 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -2105,7 +2105,7 @@ ImgPhotoConfigureModel( * Take also empty metadatas as this may be a sign to replace * existing metadata. */ - int dictSize; + Tcl_Size dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataInObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -2271,7 +2271,7 @@ ImgPhotoConfigureModel( * Merge driver returned metadata and master metadata */ if (metadataOutObj != NULL) { - int dictSize; + Tcl_Size dictSize; if (TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "driver metadata not a dict", -1)); @@ -2881,7 +2881,7 @@ if (formatPtr == NULL) { */ if (metadataOutObj != NULL) { - int dictSize; + Tcl_Size dictSize; if (Tcl_IsShared(metadataOutObj) || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { @@ -3083,7 +3083,7 @@ MatchStringFormat( */ if (metadataOutObj != NULL) { - int dictSize; + Tcl_Size dictSize; if (Tcl_IsShared(metadataOutObj) || TCL_OK != Tcl_DictObjSize(interp,metadataOutObj, &dictSize) || dictSize > 0) { diff --git a/generic/tkImgSVGnano.c b/generic/tkImgSVGnano.c index 338b078..edf6609 100644 --- a/generic/tkImgSVGnano.c +++ b/generic/tkImgSVGnano.c @@ -388,7 +388,7 @@ ParseSVGWithOptions( RastOpts *ropts) { Tcl_Obj **objv = NULL; - int objc = 0; + Tcl_Size objc = 0; double dpi = 96.0; char *inputCopy = NULL; NSVGimage *nsvgImage; diff --git a/generic/tkInt.decls b/generic/tkInt.decls index a67afa4..25a5be1 100644 --- a/generic/tkInt.decls +++ b/generic/tkInt.decls @@ -506,11 +506,11 @@ declare 154 { # entries needed only by tktest: declare 156 { - int TkpTestembedCmd(void *clientData, Tcl_Interp *interp, int objc, + int TkpTestembedCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 157 { - int TkpTesttextCmd(void *dummy, Tcl_Interp *interp, int objc, + int TkpTesttextCmd(void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 158 { @@ -547,7 +547,7 @@ declare 164 { } declare 165 { int TkTextXviewCmd(struct TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]) + Tcl_Size objc, Tcl_Obj *const objv[]) } declare 166 { void TkTextChanged(struct TkSharedText *sharedTextPtr, @@ -695,7 +695,7 @@ declare 12 x11 { } # only needed by tktest: declare 13 x11 { - int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, int objc, + int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 38 x11 { @@ -721,7 +721,7 @@ declare 44 x11 { } # only needed by tktest: declare 45 x11 { - int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, int objc, + int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } @@ -878,7 +878,7 @@ declare 44 win { } # only needed by tktest: declare 45 win { - int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, int objc, + int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]) } declare 47 win { diff --git a/generic/tkInt.h b/generic/tkInt.h index 5d00c5a..662bab5 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -1391,7 +1391,7 @@ MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, Window *parentPtr, Tk_Window tkParent, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, - int objc, Tcl_Obj *const *objv, int flags); + Tcl_Size objc, Tcl_Obj *const *objv, int flags); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, void *clientData, const TkEnsemble *map); diff --git a/generic/tkIntDecls.h b/generic/tkIntDecls.h index 4926470..868f79c 100644 --- a/generic/tkIntDecls.h +++ b/generic/tkIntDecls.h @@ -442,10 +442,10 @@ EXTERN void TkDeleteThreadExitHandler(Tcl_ExitProc *proc, /* Slot 155 is reserved */ /* 156 */ EXTERN int TkpTestembedCmd(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); /* 157 */ EXTERN int TkpTesttextCmd(void *dummy, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); /* 158 */ EXTERN int TkSelGetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, @@ -476,7 +476,7 @@ EXTERN struct TkTextSegment * TkTextSetMark(struct TkText *textPtr, struct TkTextIndex *indexPtr); /* 165 */ EXTERN int TkTextXviewCmd(struct TkText *textPtr, - Tcl_Interp *interp, int objc, + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 166 */ EXTERN void TkTextChanged(struct TkSharedText *sharedTextPtr, @@ -760,8 +760,8 @@ typedef struct TkIntStubs { void (*tkCreateThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 153 */ void (*tkDeleteThreadExitHandler) (Tcl_ExitProc *proc, void *clientData); /* 154 */ void (*reserved155)(void); - int (*tkpTestembedCmd) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 156 */ - int (*tkpTesttextCmd) (void *dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 157 */ + int (*tkpTestembedCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 156 */ + int (*tkpTesttextCmd) (void *dummy, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 157 */ int (*tkSelGetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, void *clientData); /* 158 */ int (*tkTextGetIndex) (Tcl_Interp *interp, struct TkText *textPtr, const char *string, struct TkTextIndex *indexPtr); /* 159 */ int (*tkTextIndexBackBytes) (const struct TkText *textPtr, const struct TkTextIndex *srcPtr, int count, struct TkTextIndex *dstPtr); /* 160 */ @@ -769,7 +769,7 @@ typedef struct TkIntStubs { struct TkTextIndex * (*tkTextMakeByteIndex) (TkTextBTree tree, const struct TkText *textPtr, int lineIndex, int byteIndex, struct TkTextIndex *indexPtr); /* 162 */ Tcl_Size (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */ struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */ - int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 165 */ + int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 165 */ void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */ int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */ void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */ diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h index 3560c5e..7a00bf1 100644 --- a/generic/tkIntPlatDecls.h +++ b/generic/tkIntPlatDecls.h @@ -140,7 +140,7 @@ EXTERN void TkWmCleanup(TkDisplay *dispPtr); EXTERN void TkSendCleanup(TkDisplay *dispPtr); /* 45 */ EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); /* Slot 46 is reserved */ /* 47 */ EXTERN Tk_Window TkpGetCapture(void); @@ -287,8 +287,8 @@ EXTERN void TkSendCleanup(TkDisplay *dispPtr); /* 12 */ EXTERN int TkpWmSetState(TkWindow *winPtr, int state); /* 13 */ -EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +EXTERN int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, + Tcl_Size objc, Tcl_Obj *const objv[]); /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ @@ -328,8 +328,8 @@ EXTERN void TkWmCleanup_(TkDisplay *dispPtr); /* 44 */ EXTERN void TkSendCleanup_(TkDisplay *dispPtr); /* 45 */ -EXTERN int TkpTestsendCmd_(void *clientData, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); +EXTERN int TkpTestsendCmd(void *clientData, Tcl_Interp *interp, + Tcl_Size objc, Tcl_Obj *const objv[]); #endif /* X11 */ typedef struct TkIntPlatStubs { @@ -382,7 +382,7 @@ typedef struct TkIntPlatStubs { void (*tkUnixSetMenubar) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ void (*tkWmCleanup) (TkDisplay *dispPtr); /* 43 */ void (*tkSendCleanup) (TkDisplay *dispPtr); /* 44 */ - int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 45 */ + int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 45 */ void (*reserved46)(void); Tk_Window (*tkpGetCapture) (void); /* 47 */ #endif /* WIN */ @@ -458,7 +458,7 @@ typedef struct TkIntPlatStubs { void (*tkSendCleanup) (TkDisplay *dispPtr); /* 10 */ void (*reserved11)(void); int (*tkpWmSetState) (TkWindow *winPtr, int state); /* 12 */ - int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 13 */ + int (*tkpTestsendCmd_) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 13 */ void (*reserved14)(void); void (*reserved15)(void); void (*reserved16)(void); @@ -490,7 +490,7 @@ typedef struct TkIntPlatStubs { void (*tkUnixSetMenubar_) (Tk_Window tkwin, Tk_Window menubar); /* 42 */ void (*tkWmCleanup_) (TkDisplay *dispPtr); /* 43 */ void (*tkSendCleanup_) (TkDisplay *dispPtr); /* 44 */ - int (*tkpTestsendCmd_) (void *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 45 */ + int (*tkpTestsendCmd) (void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[]); /* 45 */ #endif /* X11 */ } TkIntPlatStubs; @@ -731,8 +731,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; /* Slot 11 is reserved */ #define TkpWmSetState \ (tkIntPlatStubsPtr->tkpWmSetState) /* 12 */ -#define TkpTestsendCmd \ - (tkIntPlatStubsPtr->tkpTestsendCmd) /* 13 */ +#define TkpTestsendCmd_ \ + (tkIntPlatStubsPtr->tkpTestsendCmd_) /* 13 */ /* Slot 14 is reserved */ /* Slot 15 is reserved */ /* Slot 16 is reserved */ @@ -771,8 +771,8 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr; (tkIntPlatStubsPtr->tkWmCleanup_) /* 43 */ #define TkSendCleanup_ \ (tkIntPlatStubsPtr->tkSendCleanup_) /* 44 */ -#define TkpTestsendCmd_ \ - (tkIntPlatStubsPtr->tkpTestsendCmd_) /* 45 */ +#define TkpTestsendCmd \ + (tkIntPlatStubsPtr->tkpTestsendCmd) /* 45 */ #endif /* X11 */ #endif /* defined(USE_TK_STUBS) */ diff --git a/generic/tkListbox.c b/generic/tkListbox.c index 7994dab..8c7df20 100644 --- a/generic/tkListbox.c +++ b/generic/tkListbox.c @@ -50,7 +50,7 @@ typedef struct { * available for listbox items. */ char *listVarName; /* List variable name */ Tcl_Obj *listObj; /* Pointer to the list object being used */ - int nElements; /* Holds the current count of elements */ + Tcl_Size nElements; /* Holds the current count of elements */ Tcl_HashTable *selection; /* Tracks selection */ Tcl_HashTable *itemAttrTable; /* Tracks item attributes */ @@ -410,7 +410,7 @@ static Tcl_Size ListboxFetchSelection(ClientData clientData, static void ListboxLostSelection(ClientData clientData); static void GenerateListboxSelectEvent(Listbox *listPtr); static void EventuallyRedrawRange(Listbox *listPtr, - int first, int last); + Tcl_Size first, Tcl_Size last); static void ListboxScanTo(Listbox *listPtr, int x, int y); static int ListboxSelect(Listbox *listPtr, int first, int last, int select); @@ -647,7 +647,7 @@ ListboxWidgetObjCmd( break; } - if (index >= listPtr->nElements) { + if (index >= (int)listPtr->nElements) { index = listPtr->nElements-1; } if (index < 0) { @@ -723,7 +723,7 @@ ListboxWidgetObjCmd( */ objPtr = Tcl_NewObj(); - for (i = 0; i < listPtr->nElements; i++) { + for (i = 0; i < (int)listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(i)); } @@ -751,7 +751,7 @@ ListboxWidgetObjCmd( break; } - if (first < listPtr->nElements) { + if (first < (int)listPtr->nElements) { /* * if a "last index" was given, get it now; otherwise, use the * first index as the last index. @@ -765,7 +765,7 @@ ListboxWidgetObjCmd( } else { last = first; } - if (last >= listPtr->nElements) { + if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } result = ListboxDeleteSubCmd(listPtr, first, last); @@ -776,7 +776,8 @@ ListboxWidgetObjCmd( } case COMMAND_GET: { - int first, last, listLen; + int first, last; + Tcl_Size listLen; Tcl_Obj **elemPtrs; if (objc != 3 && objc != 4) { @@ -795,11 +796,11 @@ ListboxWidgetObjCmd( break; } } - if (first >= listPtr->nElements) { + if (first >= (int)listPtr->nElements) { result = TCL_OK; break; } - if (last >= listPtr->nElements) { + if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } if (first < 0) { @@ -875,7 +876,7 @@ ListboxWidgetObjCmd( break; } - if (index < 0 || index >= listPtr->nElements) { + if (index < 0 || index >= (int)listPtr->nElements) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item number \"%s\" out of range", Tcl_GetString(objv[2]))); @@ -912,7 +913,7 @@ ListboxWidgetObjCmd( break; } - if (index < 0 || index >= listPtr->nElements) { + if (index < 0 || index >= (int)listPtr->nElements) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item number \"%s\" out of range", Tcl_GetString(objv[2]))); @@ -1005,7 +1006,7 @@ ListboxWidgetObjCmd( if (result != TCL_OK) { break; } - if (index >= listPtr->nElements) { + if (index >= (int)listPtr->nElements) { index = listPtr->nElements - 1; } if (index < 0) { @@ -1088,7 +1089,7 @@ ListboxBboxSubCmd( lastVisibleIndex = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine; - if (listPtr->nElements < lastVisibleIndex) { + if ((int)listPtr->nElements < lastVisibleIndex) { lastVisibleIndex = listPtr->nElements; } @@ -1199,7 +1200,7 @@ ListboxSelectionSubCmd( Tcl_WrongNumArgs(interp, 3, objv, "index"); return TCL_ERROR; } - if (first >= listPtr->nElements) { + if (first >= (int)listPtr->nElements) { first = listPtr->nElements - 1; } if (first < 0) { @@ -1637,7 +1638,7 @@ ConfigureListbox( if (listPtr->listVarName != NULL) { Tcl_Obj *listVarObj = Tcl_GetVar2Ex(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY); - int dummy; + Tcl_Size dummy; if (listVarObj == NULL) { listVarObj = (oldListObj ? oldListObj : Tcl_NewObj()); @@ -1906,7 +1907,7 @@ DisplayListbox( */ limit = listPtr->topIndex + listPtr->fullLines + listPtr->partialLine - 1; - if (limit >= listPtr->nElements) { + if (limit >= (int)listPtr->nElements) { limit = listPtr->nElements-1; } left = right = 0; @@ -2022,7 +2023,7 @@ DisplayListbox( 1, 1, 1, TK_RELIEF_RAISED); } /* Draw bottom bevel */ - if (i + 1 == listPtr->nElements || + if (i + 1 == (int)listPtr->nElements || !Tcl_FindHashEntry(listPtr->selection, KEY(i + 1))) { Tk_3DHorizontalBevel(tkwin, pixmap, selectedBg, x-left, y + listPtr->lineHeight - listPtr->selBorderWidth, @@ -2248,7 +2249,7 @@ ListboxComputeGeometry( listPtr->xScrollUnit = 1; } listPtr->maxWidth = 0; - for (i = 0; i < listPtr->nElements; i++) { + for (i = 0; i < (int)listPtr->nElements; i++) { /* * Compute the pixel width of the current element. */ @@ -2281,7 +2282,7 @@ ListboxComputeGeometry( + 2*listPtr->selBorderWidth; height = listPtr->height; if (listPtr->height <= 0) { - height = listPtr->nElements; + height = (int)listPtr->nElements; if (height < 1) { height = 1; } @@ -2402,8 +2403,8 @@ ListboxInsertSubCmd( } if (index <= listPtr->active) { listPtr->active += objc; - if ((listPtr->active >= listPtr->nElements) && - (listPtr->nElements > 0)) { + if ((listPtr->active >= (int)listPtr->nElements) && + ((int)listPtr->nElements > 0)) { listPtr->active = listPtr->nElements-1; } } @@ -2453,7 +2454,7 @@ ListboxDeleteSubCmd( if (first < 0) { first = 0; } - if (last >= listPtr->nElements) { + if (last >= (int)listPtr->nElements) { last = listPtr->nElements-1; } count = last + 1 - first; @@ -2566,7 +2567,7 @@ ListboxDeleteSubCmd( listPtr->topIndex = first; } } - if (listPtr->topIndex > (listPtr->nElements - listPtr->fullLines)) { + if (listPtr->topIndex > ((int)listPtr->nElements - listPtr->fullLines)) { listPtr->topIndex = listPtr->nElements - listPtr->fullLines; if (listPtr->topIndex < 0) { listPtr->topIndex = 0; @@ -2576,8 +2577,8 @@ ListboxDeleteSubCmd( listPtr->active -= count; } else if (listPtr->active >= first) { listPtr->active = first; - if ((listPtr->active >= listPtr->nElements) && - (listPtr->nElements > 0)) { + if ((listPtr->active >= (int)listPtr->nElements) && + ((int)listPtr->nElements > 0)) { listPtr->active = listPtr->nElements-1; } } @@ -2829,7 +2830,7 @@ ChangeListboxView( int index) /* Index of element in listPtr that should now * appear at the top of the listbox. */ { - if (index >= (listPtr->nElements - listPtr->fullLines)) { + if (index >= ((int)listPtr->nElements - listPtr->fullLines)) { index = listPtr->nElements - listPtr->fullLines; } if (index < 0) { @@ -2988,7 +2989,7 @@ NearestListboxElement( index = 0; } index += listPtr->topIndex; - if (index >= listPtr->nElements) { + if (index >= (int)listPtr->nElements) { index = listPtr->nElements-1; } return index; @@ -3032,13 +3033,13 @@ ListboxSelect( first = last; last = i; } - if ((last < 0) || (first >= listPtr->nElements)) { + if ((last < 0) || (first >= (int)listPtr->nElements)) { return TCL_OK; } if (first < 0) { first = 0; } - if (last >= listPtr->nElements) { + if (last >= (int)listPtr->nElements) { last = listPtr->nElements - 1; } oldCount = listPtr->numSelected; @@ -3135,7 +3136,7 @@ ListboxFetchSelection( needNewline = 0; Tcl_DStringInit(&selection); - for (i = 0; i < listPtr->nElements; i++) { + for (i = 0; i < (int)listPtr->nElements; i++) { entry = Tcl_FindHashEntry(listPtr->selection, KEY(i)); if (entry != NULL) { if (needNewline) { @@ -3247,15 +3248,12 @@ GenerateListboxSelectEvent( static void EventuallyRedrawRange( Listbox *listPtr, /* Information about widget. */ - int first, /* Index of first element in list that needs + TCL_UNUSED(Tcl_Size), /* Index of first element in list that needs * to be redrawn. */ - int last) /* Index of last element in list that needs to + TCL_UNUSED(Tcl_Size)) /* Index of last element in list that needs to * be redrawn. May be less than first; these * just bracket a range. */ { - (void)first; - (void)last; - /* * We don't have to register a redraw callback if one is already pending, * or if the window doesn't exist, or if the window isn't mapped. @@ -3438,7 +3436,7 @@ ListboxListVarProc( { Listbox *listPtr = (Listbox *)clientData; Tcl_Obj *oldListObj, *varListObj; - int oldLength, i; + Tcl_Size oldLength, i; Tcl_HashEntry *entry; (void)name1; (void)name2; @@ -3542,7 +3540,7 @@ ListboxListVarProc( if (oldLength != listPtr->nElements) { listPtr->flags |= UPDATE_V_SCROLLBAR; - if (listPtr->topIndex > (listPtr->nElements - listPtr->fullLines)) { + if (listPtr->topIndex > ((int)listPtr->nElements - listPtr->fullLines)) { listPtr->topIndex = listPtr->nElements - listPtr->fullLines; if (listPtr->topIndex < 0) { listPtr->topIndex = 0; diff --git a/generic/tkStubInit.c b/generic/tkStubInit.c index 8970646..309f162 100644 --- a/generic/tkStubInit.c +++ b/generic/tkStubInit.c @@ -638,7 +638,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkSendCleanup, /* 10 */ 0, /* 11 */ TkpWmSetState, /* 12 */ - TkpTestsendCmd, /* 13 */ + TkpTestsendCmd_, /* 13 */ 0, /* 14 */ 0, /* 15 */ 0, /* 16 */ @@ -670,7 +670,7 @@ static const TkIntPlatStubs tkIntPlatStubs = { TkUnixSetMenubar_, /* 42 */ TkWmCleanup_, /* 43 */ TkSendCleanup_, /* 44 */ - TkpTestsendCmd_, /* 45 */ + TkpTestsendCmd, /* 45 */ #endif /* X11 */ }; diff --git a/generic/tkTest.c b/generic/tkTest.c index a165dec..158ab7c 100644 --- a/generic/tkTest.c +++ b/generic/tkTest.c @@ -56,6 +56,10 @@ EXTERN int Tktest_Init(Tcl_Interp *interp); } #endif +#if TCL_MAJOR_VERSION < 9 +# undef Tcl_CreateObjCommand2 +# define Tcl_CreateObjCommand2 Tcl_CreateObjCommand +#endif /* * The following data structure represents the model for a test image: */ @@ -262,7 +266,7 @@ Tktest_Init( Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testdeleteapps", TestdeleteappsObjCmd, Tk_MainWindow(interp), NULL); - Tcl_CreateObjCommand(interp, "testembed", TkpTestembedCmd, + Tcl_CreateObjCommand2(interp, "testembed", TkpTestembedCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testobjconfig", TestobjconfigObjCmd, Tk_MainWindow(interp), NULL); @@ -273,7 +277,7 @@ Tktest_Init( Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL); - Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd, + Tcl_CreateObjCommand2(interp, "testtext", TkpTesttextCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testphotostringmatch", TestPhotoStringMatchCmd, Tk_MainWindow(interp), @@ -285,7 +289,7 @@ Tktest_Init( #elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK) Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd, Tk_MainWindow(interp), NULL); - Tcl_CreateObjCommand(interp, "testsend", TkpTestsendCmd, + Tcl_CreateObjCommand2(interp, "testsend", TkpTestsendCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwrapper", TestwrapperObjCmd, Tk_MainWindow(interp), NULL); @@ -1935,7 +1939,7 @@ TestpropObjCmd( static int TestprintfObjCmd( - ClientData dummy, /* Not used */ + TCL_UNUSED(void *), /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ @@ -1943,7 +1947,6 @@ TestprintfObjCmd( char buffer[256]; Tcl_WideInt wideInt; long long longLongInt; - (void)dummy; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "wideint"); @@ -2115,27 +2118,21 @@ CustomOptionGet( static void CustomOptionRestore( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr, char *saveInternalPtr) { - (void)dummy; - (void)tkwin; - *(char **)internalPtr = *(char **)saveInternalPtr; return; } static void CustomOptionFree( - ClientData dummy, - Tk_Window tkwin, + TCL_UNUSED(void *), + TCL_UNUSED(Tk_Window), char *internalPtr) { - (void)dummy; - (void)tkwin; - if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } diff --git a/generic/tkText.c b/generic/tkText.c index b2e7969..cf820bd 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -6918,7 +6918,7 @@ int TkpTesttextCmd( TCL_UNUSED(void *), /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; @@ -6928,7 +6928,7 @@ TkpTesttextCmd( char buf[64]; Tcl_CmdInfo info; - if (objc < 3) { + if (objc + 1 < 4) { return TCL_ERROR; } diff --git a/generic/tkText.h b/generic/tkText.h index 9b4bdba..877d991 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -1122,7 +1122,7 @@ MODULE_SCOPE int TkTextUpdateOneLine(TkText *textPtr, TkTextLine *linePtr, int pixelHeight, TkTextIndex *indexPtr, int partialCalc); MODULE_SCOPE int TkTextMarkCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextMarkNameToIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE void TkTextMarkSegToIndex(TkText *textPtr, @@ -1142,25 +1142,25 @@ MODULE_SCOPE void TkTextRedrawTag(TkSharedText *sharedTextPtr, int withTag); MODULE_SCOPE void TkTextRelayoutWindow(TkText *textPtr, int mask); MODULE_SCOPE int TkTextScanCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextSeeCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextSegToOffset(const TkTextSegment *segPtr, const TkTextLine *linePtr); MODULE_SCOPE void TkTextSetYView(TkText *textPtr, TkTextIndex *indexPtr, int pickPlace); MODULE_SCOPE int TkTextTagCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextImageCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextImageIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextWindowCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkTextWindowIndex(TkText *textPtr, const char *name, TkTextIndex *indexPtr); MODULE_SCOPE int TkTextYviewCmd(TkText *textPtr, Tcl_Interp *interp, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkTextWinFreeClient(Tcl_HashEntry *hPtr, TkTextEmbWindowClient *client); MODULE_SCOPE void TkTextRunAfterSyncCmd(void *clientData); diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 5bdbe3e..68ff8ef 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -5733,7 +5733,7 @@ int TkTextSeeCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "see". */ @@ -5869,7 +5869,7 @@ int TkTextXviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "xview". */ @@ -6170,7 +6170,7 @@ int TkTextYviewCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "yview". */ @@ -6377,7 +6377,7 @@ int TkTextScanCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "scan". */ @@ -6385,7 +6385,7 @@ TkTextScanCmd( TextDInfo *dInfoPtr = textPtr->dInfoPtr; TkTextIndex index; int c, x, y, totalScroll, gain=10; - size_t length; + Tcl_Size length; if ((objc != 5) && (objc != 6)) { Tcl_WrongNumArgs(interp, 2, objv, "mark x y"); @@ -6406,8 +6406,7 @@ TkTextScanCmd( if ((objc == 6) && (Tcl_GetIntFromObj(interp, objv[5], &gain) != TCL_OK)) { return TCL_ERROR; } - c = Tcl_GetString(objv[2])[0]; - length = strlen(Tcl_GetString(objv[2])); + c = Tcl_GetStringFromObj(objv[2], &length)[0]; if (c=='d' && strncmp(Tcl_GetString(objv[2]), "dragto", length)==0) { int newX, maxX; diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index cd65bf9..4172a54 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.c @@ -119,7 +119,7 @@ int TkTextImageCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "image". */ diff --git a/generic/tkTextMark.c b/generic/tkTextMark.c index ec66d6c..5e81257 100644 --- a/generic/tkTextMark.c +++ b/generic/tkTextMark.c @@ -95,7 +95,7 @@ int TkTextMarkCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "mark". */ @@ -114,7 +114,7 @@ TkTextMarkCmd( MARK_UNSET }; - if (objc < 3) { + if (objc + 1 < 4) { Tcl_WrongNumArgs(interp, 2, objv, "option ?arg ...?"); return TCL_ERROR; } diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index f38365f..10b6e1c 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -117,7 +117,7 @@ int TkTextTagCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "tag". */ diff --git a/generic/tkTextWind.c b/generic/tkTextWind.c index be0a46f..9627f5a 100644 --- a/generic/tkTextWind.c +++ b/generic/tkTextWind.c @@ -135,7 +135,7 @@ int TkTextWindowCmd( TkText *textPtr, /* Information about text widget. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "window". */ diff --git a/generic/tkUtil.c b/generic/tkUtil.c index 34bf739..7a7c5cf 100644 --- a/generic/tkUtil.c +++ b/generic/tkUtil.c @@ -1040,12 +1040,13 @@ TkFindStateNumObj( int TkBackgroundEvalObjv( Tcl_Interp *interp, - int objc, + Tcl_Size objc, Tcl_Obj *const *objv, int flags) { Tcl_InterpState state; - int n, r = TCL_OK; + int r = TCL_OK; + Tcl_Size n; /* * Record the state of the interpreter. diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index eaa583f..9e4780e 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -1822,7 +1822,7 @@ static int ComboboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Combobox *cbPtr = (Combobox *)recordPtr; - int unused; + Tcl_Size unused; /* Make sure -values is a valid list: */ @@ -1844,7 +1844,7 @@ static int ComboboxCurrentCommand( Combobox *cbPtr = (Combobox *)recordPtr; Tcl_Size currentIndex = cbPtr->combobox.currentIndex; const char *currentValue = cbPtr->entry.string; - int nValues; + Tcl_Size nValues; Tcl_Obj **values; Tcl_ListObjGetElements(interp, cbPtr->combobox.valuesObj, &nValues, &values); @@ -1853,18 +1853,18 @@ static int ComboboxCurrentCommand( /* Check if currentIndex still valid: */ if (currentIndex == TCL_INDEX_NONE - || currentIndex >= (Tcl_Size)nValues + || currentIndex >= nValues || strcmp(currentValue,Tcl_GetString(values[currentIndex])) ) { /* Not valid. Check current value against each element in -values: */ - for (currentIndex = 0; currentIndex < (Tcl_Size)nValues; ++currentIndex) { + for (currentIndex = 0; currentIndex < nValues; ++currentIndex) { if (!strcmp(currentValue,Tcl_GetString(values[currentIndex]))) { break; } } - if (currentIndex >= (Tcl_Size)nValues) { + if (currentIndex >= nValues) { /* Not found */ currentIndex = TCL_INDEX_NONE; } @@ -1876,7 +1876,7 @@ static int ComboboxCurrentCommand( Tcl_Size idx; if (TCL_OK == TkGetIntForIndex(objv[2], nValues - 1, 0, &idx)) { - if (idx == TCL_INDEX_NONE || idx >= (Tcl_Size)nValues) { + if (idx == TCL_INDEX_NONE || idx >= nValues) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "index \"%s\" out of range", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_RANGE", NULL); @@ -2007,7 +2007,7 @@ static int SpinboxConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Spinbox *sb = (Spinbox *)recordPtr; - int unused; + Tcl_Size unused; /* Make sure -values is a valid list: */ diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 621591e..44c2752 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -354,7 +354,7 @@ Ttk_CreateImageElement( void *dummy, Ttk_Theme theme, const char *elementName, - int objc, Tcl_Obj *const objv[]) + Tcl_Size objc, Tcl_Obj *const objv[]) { static const char *const optionStrings[] = { "-border","-height","-padding","-sticky","-width",NULL }; @@ -363,10 +363,10 @@ Ttk_CreateImageElement( Ttk_ImageSpec *imageSpec = 0; ImageData *imageData = 0; int padding_specified = 0; - int i; + Tcl_Size i; (void)dummy; - if (objc <= 0) { + if (objc + 1 < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Must supply a base image", -1)); Tcl_SetErrorCode(interp, "TTK", "IMAGE", "BASE", NULL); diff --git a/generic/ttk/ttkScroll.c b/generic/ttk/ttkScroll.c index 1febcea..40a5bf0 100644 --- a/generic/ttk/ttkScroll.c +++ b/generic/ttk/ttkScroll.c @@ -206,7 +206,7 @@ void TtkUpdateScrollInfo(ScrollHandle h) * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h) + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; int newFirst; diff --git a/generic/ttk/ttkState.c b/generic/ttk/ttkState.c index 3da9531..18f0198 100644 --- a/generic/ttk/ttkState.c +++ b/generic/ttk/ttkState.c @@ -69,9 +69,8 @@ static void StateSpecDupIntRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr) static int StateSpecSetFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr) { int status; - int objc; + Tcl_Size i, objc; Tcl_Obj **objv; - int i; unsigned int onbits = 0, offbits = 0; status = Tcl_ListObjGetElements(interp, objPtr, &objc, &objv); @@ -200,8 +199,8 @@ Tcl_Obj *Ttk_StateMapLookup( Ttk_State state) /* State to look up */ { Tcl_Obj **specs; - int nSpecs; - int j, status; + Tcl_Size j, nSpecs; + int status; status = Tcl_ListObjGetElements(interp, map, &nSpecs, &specs); if (status != TCL_OK) @@ -232,8 +231,8 @@ Ttk_StateMap Ttk_GetStateMapFromObj( Tcl_Obj *mapObj) /* State map */ { Tcl_Obj **specs; - int nSpecs; - int j, status; + Tcl_Size j, nSpecs; + int status; status = Tcl_ListObjGetElements(interp, mapObj, &nSpecs, &specs); if (status != TCL_OK) diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index 57666cf..6ec68a6 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -126,7 +126,7 @@ Ttk_TagSet Ttk_GetTagSetFromObj( { Ttk_TagSet tagset = (Ttk_TagSet)ckalloc(sizeof(*tagset)); Tcl_Obj **objv; - int i, objc; + Tcl_Size i, objc; if (objPtr == NULL) { tagset->tags = NULL; @@ -288,7 +288,7 @@ int Ttk_ConfigureTag( Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag, - int objc, Tcl_Obj *const objv[]) + Tcl_Size objc, Tcl_Obj *const objv[]) { return Tk_SetOptions( interp, tag->tagRecord, tagTable->optionTable, diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index ebf600e..b4aa887 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -829,7 +829,7 @@ int Ttk_RegisterElementFactory( static int Ttk_CloneElement( Tcl_Interp *interp, TCL_UNUSED(void *), Ttk_Theme theme, const char *elementName, - int objc, Tcl_Obj *const objv[]) + Tcl_Size objc, Tcl_Obj *const objv[]) { Ttk_Theme fromTheme; Ttk_ElementClass *fromElement; diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 1cfa42b..cd1bef9 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -223,7 +223,7 @@ typedef struct Ttk_ElementSpec { typedef int (*Ttk_ElementFactory) (Tcl_Interp *, void *clientData, - Ttk_Theme, const char *elementName, int objc, Tcl_Obj *const objv[]); + Ttk_Theme, const char *elementName, Tcl_Size objc, Tcl_Obj *const objv[]); /* * Null element implementation: diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index f709d48..f784d36 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -400,7 +400,7 @@ static int GetEnumSetFromObj( unsigned *resultPtr) { unsigned result = 0; - int i, objc; + Tcl_Size i, objc; Tcl_Obj **objv; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) @@ -797,7 +797,7 @@ static void TreeviewFreeColumns(Treeview *tv) static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **columns; - int i, ncols; + Tcl_Size i, ncols; if (Tcl_ListObjGetElements( interp, tv->tree.columnsObj, &ncols, &columns) != TCL_OK) @@ -849,7 +849,7 @@ static int TreeviewInitColumns(Tcl_Interp *interp, Treeview *tv) static int TreeviewInitDisplayColumns(Tcl_Interp *interp, Treeview *tv) { Tcl_Obj **dcolumns; - int index, ndcols; + Tcl_Size index, ndcols; TreeColumn **displayColumns = 0; if (Tcl_ListObjGetElements(interp, @@ -1072,7 +1072,7 @@ static int GetCellFromObj( int displayColumnOnly, int *displayColumn, TreeCell *cell) { - int nElements; + Tcl_Size nElements; Tcl_Obj **elements; if (Tcl_ListObjGetElements(interp, obj, &nElements, &elements) != TCL_OK) { @@ -1130,8 +1130,7 @@ static TreeCell *GetCellListFromObj( TreeCell cell; Tcl_Obj **elements; Tcl_Obj *oneCell; - Tcl_Size i; - int n; + Tcl_Size i, n; if (Tcl_ListObjGetElements(interp, objPtr, &n, &elements) != TCL_OK) { return NULL; @@ -1150,7 +1149,7 @@ static TreeCell *GetCellListFromObj( } cells = (TreeCell *) ckalloc(n * sizeof(TreeCell)); - for (i = 0; i < (Tcl_Size)n; ++i) { + for (i = 0; i < n; ++i) { if (GetCellFromObj(interp, tv, elements[i], 0, NULL, &cells[i]) != TCL_OK) { ckfree(cells); return NULL; @@ -1440,7 +1439,7 @@ static int ConfigureItem( /* Make sure that -values is a valid list: */ if (item->valuesObj) { - int unused; + Tcl_Size unused; if (Tcl_ListObjLength(interp, item->valuesObj, &unused) != TCL_OK) goto error; } @@ -2119,8 +2118,7 @@ static void PrepareItem( static void PrepareCells( Treeview *tv, TreeItem *item) { - Tcl_Size i; - int nValues = 0; + Tcl_Size i, nValues = 0; Tcl_Obj **values = NULL; TreeColumn *column; @@ -2128,7 +2126,7 @@ static void PrepareCells( Tcl_ListObjGetElements(NULL, item->valuesObj, &nValues, &values); } for (i = 0; i < tv->tree.nColumns; ++i) { - tv->tree.columns[i].data = (i < (Tcl_Size)nValues) ? values[i] : 0; + tv->tree.columns[i].data = (i < nValues) ? values[i] : 0; tv->tree.columns[i].selected = 0; tv->tree.columns[i].tagset = NULL; } @@ -2138,7 +2136,7 @@ static void PrepareCells( if (item->selObj != NULL) { Tcl_ListObjGetElements(NULL, item->selObj, &nValues, &values); - for (i = 0; i < (Tcl_Size)nValues; ++i) { + for (i = 0; i < nValues; ++i) { column = FindColumn(NULL, tv, values[i]); /* Just in case. It should not be possible for column to be NULL */ if (column != NULL) { @@ -3096,14 +3094,14 @@ static int TreeviewSetCommand( Tcl_SetObjResult(interp, result); return TCL_OK; } else { /* set column */ - int length; + Tcl_Size length; item->valuesObj = unshareObj(item->valuesObj); /* Make sure -values is fully populated: */ Tcl_ListObjLength(interp, item->valuesObj, &length); - while ((Tcl_Size)length < tv->tree.nColumns) { + while (length < tv->tree.nColumns) { Tcl_Obj *empty = Tcl_NewStringObj("",0); Tcl_ListObjAppendElement(interp, item->valuesObj, empty); ++length; @@ -3289,7 +3287,7 @@ static int TreeviewDeleteCommand( if (items[i]->state & TTK_STATE_SELECTED) { selChange = 1; } else if (items[i]->selObj != NULL) { - int length; + Tcl_Size length; Tcl_ListObjLength(interp, items[i]->selObj, &length); if (length > 0) { selChange = 1; @@ -3637,7 +3635,8 @@ static int SelObjChangeElement( Treeview *tv, Tcl_Obj *listPtr, Tcl_Obj *elemPtr, int add, TCL_UNUSED(int) /*remove*/, int toggle) { - int i, nElements, anyChange = 0; + Tcl_Size i, nElements; + int anyChange = 0; TreeColumn *column, *elemColumn; Tcl_Obj **elements; @@ -3670,7 +3669,8 @@ static int CellSelectionRange( TreeCell cellFrom, cellTo; TreeItem *item; Tcl_Obj *columns, **elements; - int colno, nElements, i, fromNo, toNo, anyChange = 0; + int colno, fromNo, toNo, anyChange = 0; + Tcl_Size i, nElements; int set = !(add || remove || toggle); if (GetCellFromObj(interp, tv, fromCell, 1, &fromNo, &cellFrom) @@ -3773,8 +3773,7 @@ static int TreeviewCellSelectionCommand( Tcl_Obj *result = Tcl_NewListObj(0,0); for (item = tv->tree.root->children; item; item = NextPreorder(item)) { if (item->selObj != NULL) { - int n; - Tcl_Size elemc; + Tcl_Size n, elemc; Tcl_Obj **elemv; Tcl_ListObjGetElements(interp, item->selObj, &n, &elemv); diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index c1d576a..4359e20 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -190,7 +190,7 @@ MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( - Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle); + Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], ScrollHandle); MODULE_SCOPE void TtkUpdateScrollInfo(ScrollHandle h); MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst, int updateScrollInfo); @@ -227,7 +227,7 @@ MODULE_SCOPE void Ttk_DeleteTagFromTable(Ttk_TagTable, Ttk_Tag); MODULE_SCOPE int Ttk_ConfigureTag( Tcl_Interp *interp, Ttk_TagTable tagTable, Ttk_Tag tag, - int objc, Tcl_Obj *const objv[]); + Tcl_Size objc, Tcl_Obj *const objv[]); MODULE_SCOPE Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Interp *interp, Ttk_TagTable, Tcl_Obj *objPtr); diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c index 4674649..a646478 100644 --- a/macosx/tkMacOSXDialog.c +++ b/macosx/tkMacOSXDialog.c @@ -262,7 +262,7 @@ getFileURL( } if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; - int objc, result = Tcl_ListObjGetElements(callbackInfo->interp, + Tcl_Size objc, result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { @@ -294,7 +294,7 @@ getFileURL( if (callbackInfo->cmdObj) { Tcl_Obj **objv, **tmpv; - int objc, result = Tcl_ListObjGetElements(callbackInfo->interp, + Tcl_Size objc, result = Tcl_ListObjGetElements(callbackInfo->interp, callbackInfo->cmdObj, &objc, &objv); if (result == TCL_OK && objc) { @@ -1706,7 +1706,8 @@ FontchooserEvent( fontPanelFont, fontPanelFontAttributes); if (fontObj) { if (fcdPtr->cmdObj) { - int objc, result; + Tcl_Size objc; + int result; Tcl_Obj **objv, **tmpv; result = Tcl_ListObjGetElements(fontchooserInterp, diff --git a/macosx/tkMacOSXEmbed.c b/macosx/tkMacOSXEmbed.c index 3f5d0a4..88e4219 100644 --- a/macosx/tkMacOSXEmbed.c +++ b/macosx/tkMacOSXEmbed.c @@ -520,9 +520,9 @@ TkpClaimFocus( int TkpTestembedCmd( - ClientData dummy, /* Main window for application. */ + void *dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index e26a240..272ff82 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1722,7 +1722,8 @@ WmColormapwindowsCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2; - int i, windowObjc, gotToplevel = 0; + Tcl_Size i, windowObjc; + int gotToplevel = 0; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { @@ -5844,7 +5845,8 @@ WmWinStyle( { NULL, 0 } }; - int index, i; + int index; + Tcl_Size i; WmInfo *wmPtr = winPtr->wmInfoPtr; if (objc == 3) { @@ -5884,7 +5886,7 @@ WmWinStyle( Tcl_ListObjAppendElement(NULL, newResult, attributeList); Tcl_SetObjResult(interp, newResult); } else { - int attrObjc; + Tcl_Size attrObjc; Tcl_Obj **attrObjv = NULL; WindowClass macClass; UInt64 oldAttributes = wmPtr->attributes; diff --git a/macosx/tkMacOSXWm.h b/macosx/tkMacOSXWm.h index 6b0ee69..12c4e8f 100644 --- a/macosx/tkMacOSXWm.h +++ b/macosx/tkMacOSXWm.h @@ -171,7 +171,7 @@ typedef struct TkWmInfo { */ TkWindow **cmapList; /* Array of window with private colormaps. */ - int cmapCount; /* Number of windows in array. */ + Tcl_Size cmapCount; /* Number of windows in array. */ /* * Miscellaneous information. diff --git a/unix/tkUnixEmbed.c b/unix/tkUnixEmbed.c index 3057729..0417a50 100644 --- a/unix/tkUnixEmbed.c +++ b/unix/tkUnixEmbed.c @@ -874,9 +874,9 @@ TkpClaimFocus( int TkpTestembedCmd( - ClientData dummy, /* Main window for application. */ + void *dummy, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; diff --git a/unix/tkUnixSend.c b/unix/tkUnixSend.c index de9eadf..2f99625 100644 --- a/unix/tkUnixSend.c +++ b/unix/tkUnixSend.c @@ -1956,7 +1956,7 @@ int TkpTestsendCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ - int objc, /* Number of arguments. */ + Tcl_Size objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { enum { @@ -1969,7 +1969,7 @@ TkpTestsendCmd( Tk_ErrorHandler handler; int index; - if (objc < 2) { + if (objc + 1 < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; diff --git a/win/tkWinDialog.c b/win/tkWinDialog.c index e1a3831..c957229 100644 --- a/win/tkWinDialog.c +++ b/win/tkWinDialog.c @@ -3052,7 +3052,7 @@ ApplyLogfont( HDC hdc, LOGFONTW *logfontPtr) { - int objc; + Tcl_Size objc; Tcl_Obj **objv, **tmpv; Tcl_ListObjGetElements(NULL, cmdObj, &objc, &objv); diff --git a/win/tkWinEmbed.c b/win/tkWinEmbed.c index 7a10795..a583801 100644 --- a/win/tkWinEmbed.c +++ b/win/tkWinEmbed.c @@ -98,9 +98,9 @@ TkWinCleanupContainerList(void) int TkpTestembedCmd( - ClientData dummy, + void *dummy, Tcl_Interp *interp, - int objc, + Tcl_Size objc, Tcl_Obj *const objv[]) { (void)dummy; diff --git a/win/tkWinWm.c b/win/tkWinWm.c index 992aa08..1954f49 100644 --- a/win/tkWinWm.c +++ b/win/tkWinWm.c @@ -211,7 +211,7 @@ typedef struct TkWmInfo { */ TkWindow **cmapList; /* Array of window with private colormaps. */ - int cmapCount; /* Number of windows in array. */ + Tcl_Size cmapCount; /* Number of windows in array. */ /* * Miscellaneous information. @@ -3282,7 +3282,8 @@ WmColormapwindowsCmd( { WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow **cmapList, *winPtr2, **winPtr2Ptr = &winPtr2; - int i, windowObjc, gotToplevel; + Tcl_Size i, windowObjc; + int gotToplevel; Tcl_Obj **windowObjv, *resultObj; if ((objc != 3) && (objc != 4)) { @@ -7296,7 +7297,7 @@ InstallColormaps( * WM_QUERYNEWPALETTE */ int isForemost) /* 1 if window is foremost, else 0 */ { - int i; + Tcl_Size i; HDC dc; HPALETTE oldPalette; TkWindow *winPtr = GetTopLevel(hwnd); @@ -7405,7 +7406,7 @@ RefreshColormap( TkDisplay *dispPtr) { WmInfo *wmPtr; - int i; + Tcl_Size i; for (wmPtr = dispPtr->firstWmPtr; wmPtr != NULL; wmPtr = wmPtr->nextPtr) { if (wmPtr->cmapCount > 0) { diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index 5d3e1ce..0d5c06f 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1109,7 +1109,7 @@ Ttk_CreateVsapiElement( void *clientData, Ttk_Theme theme, const char *elementName, - int objc, + Tcl_Size objc, Tcl_Obj *const objv[]) { XPThemeData *themeData = (XPThemeData *)clientData; @@ -1132,7 +1132,7 @@ Ttk_CreateVsapiElement( enum { O_HALFHEIGHT, O_HALFWIDTH, O_HEIGHT, O_MARGINS, O_PADDING, O_SYSSIZE, O_WIDTH }; - if (objc < 2) { + if (objc + 1 < 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing required arguments 'class' and/or 'partId'", -1)); Tcl_SetErrorCode(interp, "TTK", "VSAPI", "REQUIRED", NULL); @@ -1148,7 +1148,8 @@ Ttk_CreateVsapiElement( /* flags or padding */ if (objc > 3) { - int i = 3, option = 0; + Tcl_Size i = 3; + int option = 0; for (i = 3; i < objc; i += 2) { int tmp = 0; if (i == objc -1) { -- cgit v0.12