From 90ab1c4c1f9fc8102d10a15c4abc19aa24fb843d Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Sat, 23 Mar 2024 21:15:59 +0000 Subject: [PATCH] Allow more tags in ttk (when compiled against Tcl 9.0) --- generic/ttk/ttkTagSet.c | 19 ++++++++++--------- generic/ttk/ttkWidget.h | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/generic/ttk/ttkTagSet.c b/generic/ttk/ttkTagSet.c index 6ec68a6a9..1cc22c5a9 100644 --- a/generic/ttk/ttkTagSet.c +++ b/generic/ttk/ttkTagSet.c @@ -12,7 +12,7 @@ * +++ Internal data structures. */ struct TtkTag { - int priority; /* 1=>highest */ + Tcl_Size priority; /* 1=>highest */ const char *tagName; /* Back-pointer to hash table entry */ void *tagRecord; /* User data */ }; @@ -21,8 +21,8 @@ struct TtkTagTable { Tk_Window tkwin; /* owner window */ const Tk_OptionSpec *optionSpecs; /* ... */ Tk_OptionTable optionTable; /* ... */ - int recordSize; /* size of tag record */ - int nTags; /* #tags defined so far */ + Tcl_Size recordSize; /* size of tag record */ + Tcl_Size nTags; /* #tags defined so far */ Tcl_HashTable tags; /* defined tags */ }; @@ -155,7 +155,7 @@ Ttk_TagSet Ttk_GetTagSetFromObj( Tcl_Obj *Ttk_NewTagSetObj(Ttk_TagSet tagset) { Tcl_Obj *result = Tcl_NewListObj(0,0); - int i; + Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { Tcl_ListObjAppendElement( @@ -174,7 +174,7 @@ void Ttk_FreeTagSet(Ttk_TagSet tagset) */ int Ttk_TagSetContains(Ttk_TagSet tagset, Ttk_Tag tag) { - int i; + Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 1; @@ -190,7 +190,7 @@ int Ttk_TagSetContains(Ttk_TagSet tagset, Ttk_Tag tag) */ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) { - int i; + Tcl_Size i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; @@ -209,7 +209,8 @@ int Ttk_TagSetAdd(Ttk_TagSet tagset, Ttk_Tag tag) */ int Ttk_TagSetAddSet(Ttk_TagSet tagset, Ttk_TagSet tagsetFrom) { - int i, j, result = 0, found, total, nTags = tagset->nTags; + Tcl_Size i, j, total, nTags = tagset->nTags; + int result = 0, found; Ttk_Tag tag; total = tagsetFrom->nTags + tagset->nTags; @@ -238,7 +239,7 @@ int Ttk_TagSetAddSet(Ttk_TagSet tagset, Ttk_TagSet tagsetFrom) */ int Ttk_TagSetRemove(Ttk_TagSet tagset, Ttk_Tag tag) { - int i = 0, j = 0; + Tcl_Size i = 0, j = 0; while (i < tagset->nTags) { if ((tagset->tags[j] = tagset->tags[i]) != tag) { ++j; @@ -317,7 +318,7 @@ void Ttk_TagSetDefaults(Ttk_TagTable tagTable, Ttk_Style style, void *record) void Ttk_TagSetValues(Ttk_TagTable tagTable, Ttk_TagSet tagSet, void *record) { const int LOWEST_PRIORITY = 0x7FFFFFFF; - int i, j; + Tcl_Size i, j; for (i = 0; tagTable->optionSpecs[i].type != TK_OPTION_END; ++i) { const Tk_OptionSpec *optionSpec = tagTable->optionSpecs + i; diff --git a/generic/ttk/ttkWidget.h b/generic/ttk/ttkWidget.h index 3f2042655..d9664b150 100644 --- a/generic/ttk/ttkWidget.h +++ b/generic/ttk/ttkWidget.h @@ -210,7 +210,7 @@ typedef struct TtkTag *Ttk_Tag; typedef struct TtkTagTable *Ttk_TagTable; typedef struct TtkTagSet { /* TODO: make opaque */ Ttk_Tag *tags; - int nTags; + Tcl_Size nTags; } *Ttk_TagSet; MODULE_SCOPE Ttk_TagTable Ttk_CreateTagTable(