diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-31 15:01:06 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-01-31 15:01:06 (GMT) |
commit | 212e57435023aa44299d05a59e46796a94d16ec2 (patch) | |
tree | afeac1e26ff9ff97b8865852a2204dba8cfb802c | |
parent | ae793ce8de5e08f9f0c6d3dd1bd52899fc188e56 (diff) | |
download | tk-212e57435023aa44299d05a59e46796a94d16ec2.zip tk-212e57435023aa44299d05a59e46796a94d16ec2.tar.gz tk-212e57435023aa44299d05a59e46796a94d16ec2.tar.bz2 |
Use TIP #616 API (WIP)
-rw-r--r-- | generic/tk.h | 4 | ||||
-rw-r--r-- | generic/tkCanvas.c | 5 | ||||
-rw-r--r-- | generic/tkCmds.c | 6 | ||||
-rw-r--r-- | generic/tkEntry.c | 4 | ||||
-rw-r--r-- | generic/tkFont.c | 3 | ||||
-rw-r--r-- | generic/tkFrame.c | 2 | ||||
-rw-r--r-- | generic/tkGrid.c | 5 | ||||
-rw-r--r-- | generic/tkInt.h | 2 | ||||
-rw-r--r-- | generic/tkMenu.c | 7 | ||||
-rw-r--r-- | generic/tkObj.c | 2 | ||||
-rw-r--r-- | generic/tkPack.c | 9 | ||||
-rw-r--r-- | generic/tkText.c | 15 | ||||
-rw-r--r-- | generic/tkText.h | 2 | ||||
-rw-r--r-- | generic/tkTextBTree.c | 2 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 3 | ||||
-rw-r--r-- | generic/tkTextTag.c | 16 | ||||
-rw-r--r-- | generic/tkWindow.c | 2 | ||||
-rw-r--r-- | generic/ttk/ttkTreeview.c | 2 |
18 files changed, 52 insertions, 39 deletions
diff --git a/generic/tk.h b/generic/tk.h index 3f87a43..1e548b9 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -835,7 +835,11 @@ typedef struct Tk_FakeWin { XIC dummy9; /* inputContext */ #endif /* TK_USE_INPUT_METHODS */ ClientData *dummy10; /* tagPtr */ +#if TCL_MAJOR_VERSION > 8 + size_t dummy11; /* numTags */ +#else int dummy11; /* numTags */ +#endif int dummy12; /* optionLevel */ char *dummy13; /* selHandlerList */ char *dummy14; /* geomMgrPtr */ diff --git a/generic/tkCanvas.c b/generic/tkCanvas.c index 829d65a..0ca3596 100644 --- a/generic/tkCanvas.c +++ b/generic/tkCanvas.c @@ -598,7 +598,8 @@ DefaultRotateImplementation( double y, double angleRadians) { - int objc, i, ok = 1; + TkSizeT i, objc; + int ok = 1; Tcl_Obj **objv, **newObjv; double *coordv; double s = sin(angleRadians); @@ -2382,7 +2383,7 @@ ConfigureCanvas( canvasPtr->scrollX2 = 0; canvasPtr->scrollY2 = 0; if (canvasPtr->regionString != NULL) { - int argc2; + TkSizeT argc2; const char **argv2; if (Tcl_SplitList(canvasPtr->interp, canvasPtr->regionString, diff --git a/generic/tkCmds.c b/generic/tkCmds.c index 36981af..b745a96 100644 --- a/generic/tkCmds.c +++ b/generic/tkCmds.c @@ -269,7 +269,7 @@ TkBindEventProc( #define MAX_OBJS 20 ClientData objects[MAX_OBJS], *objPtr; TkWindow *topLevPtr; - int i, count; + TkSizeT i, count; const char *p; Tcl_HashEntry *hPtr; @@ -349,7 +349,7 @@ Tk_BindtagsObjCmd( { Tk_Window tkwin = (Tk_Window)clientData; TkWindow *winPtr, *winPtr2; - int i, length; + TkSizeT i, length; const char *p; Tcl_Obj *listPtr, **tags; @@ -444,7 +444,7 @@ void TkFreeBindingTags( TkWindow *winPtr) /* Window whose tags are to be released. */ { - int i; + TkSizeT i; const char *p; for (i = 0; i < winPtr->numTags; i++) { diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 20173c6..36edab5 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -1261,7 +1261,7 @@ ConfigureEntry( sbPtr->listObj = NULL; if (sbPtr->valueStr != NULL) { Tcl_Obj *newObjPtr; - int nelems; + TkSizeT nelems; newObjPtr = Tcl_NewStringObj(sbPtr->valueStr, -1); if (Tcl_ListObjLength(interp, newObjPtr, &nelems) @@ -4426,7 +4426,7 @@ SpinboxInvoke( * there. If not, move to the first element of the list. */ - int i, listc; + TkSizeT i, listc; TkSizeT elemLen, length = entryPtr->numChars; const char *bytes; Tcl_Obj **listv; diff --git a/generic/tkFont.c b/generic/tkFont.c index 18821df..a225dea 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -3671,7 +3671,8 @@ ParseFontNameObj( * default values. */ { const char *dash; - int objc, result, i, n; + int result, n; + TkSizeT objc, i; Tcl_Obj **objv; const char *string; diff --git a/generic/tkFrame.c b/generic/tkFrame.c index 9dbee48..2766064 100644 --- a/generic/tkFrame.c +++ b/generic/tkFrame.c @@ -489,7 +489,7 @@ TkListCreateFrame( * Gives the base name to use for the new * application. */ { - int objc; + TkSizeT objc; Tcl_Obj **objv; if (TCL_OK != Tcl_ListObjGetElements(interp, listObj, &objc, &objv)) { diff --git a/generic/tkGrid.c b/generic/tkGrid.c index 1ca3fa7..3ec3597 100644 --- a/generic/tkGrid.c +++ b/generic/tkGrid.c @@ -983,10 +983,11 @@ GridRowColumnConfigureCommand( int slot; /* the column or row number */ int slotType; /* COLUMN or ROW */ int size; /* the configuration value */ - int lObjc; /* Number of items in index list */ + TkSizeT lObjc; /* Number of items in index list */ Tcl_Obj **lObjv; /* array of indices */ int ok; /* temporary TCL result code */ - int i, j, first, last; + int i, first, last; + TkSizeT j; const char *string; static const char *const optionStrings[] = { "-minsize", "-pad", "-uniform", "-weight", NULL diff --git a/generic/tkInt.h b/generic/tkInt.h index 058eee3..2542680 100644 --- a/generic/tkInt.h +++ b/generic/tkInt.h @@ -838,7 +838,7 @@ typedef struct TkWindow { ClientData *tagPtr; /* Points to array of tags used for bindings * on this window. Each tag is a Tk_Uid. * Malloc'ed. NULL means no tags. */ - int numTags; /* Number of tags at *tagPtr. */ + TkSizeT numTags; /* Number of tags at *tagPtr. */ /* * Information used by tkOption.c to manage options for the window. diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 174736a..d5a6b55 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -2701,7 +2701,8 @@ CloneMenu( * menubar, or a tearoff? */ { int returnResult; - int menuType, i; + int menuType; + TkSizeT i; TkMenuReferences *menuRefPtr; Tcl_Obj *menuDupCommandArray[4]; @@ -2741,7 +2742,7 @@ CloneMenu( && (menuPtr->numEntries == menuRefPtr->menuPtr->numEntries)) { TkMenu *newMenuPtr = menuRefPtr->menuPtr; Tcl_Obj *newObjv[3]; - int numElements; + TkSizeT numElements; /* * Now put this newly created menu into the parent menu's instance @@ -2812,7 +2813,7 @@ CloneMenu( * Clone all of the cascade menus that this menu points to. */ - for (i = 0; i < (int)menuPtr->numEntries; i++) { + for (i = 0; i < menuPtr->numEntries; i++) { TkMenuReferences *cascadeRefPtr; TkMenu *oldCascadePtr; diff --git a/generic/tkObj.c b/generic/tkObj.c index 28e0be3..1577be9 100644 --- a/generic/tkObj.c +++ b/generic/tkObj.c @@ -1116,7 +1116,7 @@ TkParsePadAmount( int *allPtr) /* Write the total padding here */ { int firstInt, secondInt; /* The two components of the padding */ - int objc; /* The length of the list (should be 1 or 2) */ + TkSizeT objc; /* The length of the list (should be 1 or 2) */ Tcl_Obj **objv; /* The objects in the list */ /* diff --git a/generic/tkPack.c b/generic/tkPack.c index dd8977c..8398674 100644 --- a/generic/tkPack.c +++ b/generic/tkPack.c @@ -1111,7 +1111,8 @@ PackAfter( Packer *packPtr; Tk_Window tkwin, ancestor, parent; Tcl_Obj **options; - int index, optionCount, c; + int c; + TkSizeT index, optionCount; /* * Iterate over all of the window specifiers, each consisting of two @@ -1206,7 +1207,7 @@ PackAfter( } else if ((length == 5) && (strcmp(curOpt, "filly")) == 0) { packPtr->flags |= FILLY; } else if ((c == 'p') && (strcmp(curOpt, "padx")) == 0) { - if (optionCount < (index+2)) { + if (optionCount <= (index+1)) { missingPad: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # args: \"%s\" option must be" @@ -1224,7 +1225,7 @@ PackAfter( packPtr->iPadX = 0; index++; } else if ((c == 'p') && (strcmp(curOpt, "pady")) == 0) { - if (optionCount < (index+2)) { + if (optionCount <= (index+1)) { goto missingPad; } if (TkParsePadAmount(interp, tkwin, options[index+1], @@ -1237,7 +1238,7 @@ PackAfter( index++; } else if ((c == 'f') && (length > 1) && (strncmp(curOpt, "frame", length) == 0)) { - if (optionCount < (index+2)) { + if (optionCount <= (index+1)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" " option must be followed by anchor point", -1)); diff --git a/generic/tkText.c b/generic/tkText.c index d46c542..7f5f3d1 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -2966,7 +2966,8 @@ TextUndoRedoCallback( * shared text data structure. */ { TkSharedText *sharedPtr = (TkSharedText *)clientData; - int res, objc; + int res; + TkSizeT objc; Tcl_Obj **objv; TkText *textPtr; @@ -3131,7 +3132,7 @@ DeleteIndexRange( int pixels[2*PIXEL_CLIENTS]; Tcl_HashSearch search; Tcl_HashEntry *hPtr; - int i; + TkSizeT i; if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; @@ -3177,7 +3178,7 @@ DeleteIndexRange( line2 = TkBTreeLinesTo(textPtr, index2.linePtr); if (line2 == TkBTreeNumLines(sharedTextPtr->tree, textPtr)) { TkTextTag **arrayPtr; - int arraySize; + TkSizeT arraySize; TkTextIndex oldIndex2; oldIndex2 = index2; @@ -3739,12 +3740,12 @@ TextInsertCmd( if (objc > (j+1)) { Tcl_Obj **tagNamePtrs; TkTextTag **oldTagArrayPtr; - int numTags; + TkSizeT numTags; TkTextIndexForwBytes(textPtr, &index1, length, &index2); oldTagArrayPtr = TkBTreeGetTags(&index1, NULL, &numTags); if (oldTagArrayPtr != NULL) { - int i; + TkSizeT i; for (i = 0; i < numTags; i++) { TkBTreeTag(&index1, &index2, oldTagArrayPtr[i], 0); @@ -3755,7 +3756,7 @@ TextInsertCmd( &tagNamePtrs) != TCL_OK) { return TCL_ERROR; } else { - int i; + TkSizeT i; for (i = 0; i < numTags; i++) { const char *strTag = Tcl_GetString(tagNamePtrs[i]); @@ -4501,7 +4502,7 @@ TkTextGetTabs( Tcl_Obj *stringPtr) /* Description of the tab stops. See the text * manual entry for details. */ { - int objc, i, count; + TkSizeT objc, i, count; Tcl_Obj **objv; TkTextTabArray *tabArrayPtr; TkTextTab *tabPtr; diff --git a/generic/tkText.h b/generic/tkText.h index faa6014..4535823 100644 --- a/generic/tkText.h +++ b/generic/tkText.h @@ -1024,7 +1024,7 @@ MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree, const TkText *textPtr, int pixels, int *pixelOffset); MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr, - const TkText *textPtr, int *numTagsPtr); + const TkText *textPtr, TkSizeT *numTagsPtr); MODULE_SCOPE void TkBTreeInsertChars(TkTextBTree tree, TkTextIndex *indexPtr, const char *string); MODULE_SCOPE int TkBTreeLinesTo(const TkText *textPtr, diff --git a/generic/tkTextBTree.c b/generic/tkTextBTree.c index 5988db7..7565295 100644 --- a/generic/tkTextBTree.c +++ b/generic/tkTextBTree.c @@ -3361,7 +3361,7 @@ TkBTreeGetTags( const TkText *textPtr, /* If non-NULL, then only return tags for this * text widget (when there are peer * widgets). */ - int *numTagsPtr) /* Store number of tags found at this + TkSizeT *numTagsPtr) /* Store number of tags found at this * location. */ { Node *nodePtr; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index ee56ba3..d8534d2 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -777,7 +777,8 @@ GetStyle( StyleValues styleValues; TextStyle *stylePtr; Tcl_HashEntry *hPtr; - int numTags, isNew, i; + TkSizeT numTags, i; + int isNew; int isSelected; XGCValues gcValues; unsigned long mask; diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index 66ad677..d412dc4 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -153,7 +153,8 @@ TkTextTagCmd( TAG_NAMES, TAG_NEXTRANGE, TAG_PREVRANGE, TAG_RAISE, TAG_RANGES, TAG_REMOVE }; - int optionIndex, i; + int optionIndex; + TkSizeT i; TkTextTag *tagPtr; TkTextIndex index1, index2; @@ -191,12 +192,12 @@ TkTextTagCmd( */ textPtr->sharedTextPtr->stateEpoch++; } - for (i = 4; i < objc; i += 2) { + for (i = 4; i < (TkSizeT)objc; i += 2) { if (TkTextGetObjIndex(interp, textPtr, objv[i], &index1) != TCL_OK) { return TCL_ERROR; } - if (objc > (i+1)) { + if ((TkSizeT)objc > (i+1)) { if (TkTextGetObjIndex(interp, textPtr, objv[i+1], &index2) != TCL_OK) { return TCL_ERROR; @@ -575,7 +576,7 @@ TkTextTagCmd( Tcl_WrongNumArgs(interp, 3, objv, "tagName ?tagName ...?"); return TCL_ERROR; } - for (i = 3; i < objc; i++) { + for (i = 3; i < (TkSizeT)objc; i++) { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(objv[i])); if (hPtr == NULL) { @@ -637,7 +638,7 @@ TkTextTagCmd( } case TAG_NAMES: { TkTextTag **arrayPtr; - int arraySize; + TkSizeT arraySize; Tcl_Obj *listObj; if ((objc != 3) && (objc != 4)) { @@ -1502,7 +1503,7 @@ TkTextBindProc( TkTextIndex index; TkTextTag** tagArrayPtr; - int numTags; + TkSizeT numTags; TkTextMarkNameToIndex(textPtr, "insert", &index); tagArrayPtr = TkBTreeGetTags(&index, textPtr, &numTags); @@ -1563,7 +1564,8 @@ TkTextPickCurrent( TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ - int numOldTags, numNewTags, i, j, nearby; + int numOldTags, i, nearby; + TkSizeT numNewTags, j; size_t size; XEvent event; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index bc2921a..f122c85 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -3248,7 +3248,7 @@ Initialize( } if (value) { - int objc; + TkSizeT objc; Tcl_Obj **objv, **rest; Tcl_Obj *parseList = Tcl_NewListObj(1, NULL); diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index b5b0a90..bfab6af 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -602,7 +602,7 @@ static TreeItem **GetItemListFromObj( { TreeItem **items; Tcl_Obj **elements; - int i, nElements; + TkSizeT i, nElements; if (Tcl_ListObjGetElements(interp,objPtr,&nElements,&elements) != TCL_OK) { return NULL; |