summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-24 14:03:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-24 14:03:35 (GMT)
commit60091ce863fdbfbf444d6970d44fb50166ccd6fe (patch)
tree01d9762601541ddc55b930c28b3d547c496b3d67
parente59d11829980b85d1a4c263d108f0a601fce5e5b (diff)
parent5a024656faa09acb77aa34603e41b1cd5e38fbe5 (diff)
downloadtk-60091ce863fdbfbf444d6970d44fb50166ccd6fe.zip
tk-60091ce863fdbfbf444d6970d44fb50166ccd6fe.tar.gz
tk-60091ce863fdbfbf444d6970d44fb50166ccd6fe.tar.bz2
Merge 8.6. Change macro names
-rw-r--r--.fossil-settings/encoding-glob6
-rw-r--r--.gitattributes4
-rw-r--r--.travis.yml30
-rw-r--r--doc/grid.n6
-rw-r--r--doc/pack.n2
-rw-r--r--doc/place.n2
-rw-r--r--doc/selection.n2
-rw-r--r--generic/tkBind.c80
-rw-r--r--generic/tkBusy.c34
-rw-r--r--generic/tkClipboard.c25
-rw-r--r--generic/tkCmds.c81
-rw-r--r--generic/tkConfig.c28
-rw-r--r--generic/tkConsole.c68
-rw-r--r--generic/tkEvent.c72
-rw-r--r--generic/tkFont.c61
-rw-r--r--generic/tkGet.c8
-rw-r--r--generic/tkGrab.c39
-rw-r--r--generic/tkImgBmap.c2
-rw-r--r--generic/tkImgPNG.c4
-rw-r--r--generic/tkImgPPM.c4
-rw-r--r--generic/tkInt.h13
-rw-r--r--generic/tkIntPlatDecls.h2
-rw-r--r--generic/tkMain.c8
-rw-r--r--generic/tkObj.c40
-rw-r--r--generic/tkOldConfig.c29
-rw-r--r--generic/tkOption.c78
-rw-r--r--generic/tkPointer.c2
-rw-r--r--generic/tkSelect.c67
-rw-r--r--generic/tkStyle.c73
-rw-r--r--generic/tkText.c141
-rw-r--r--generic/tkText.h4
-rw-r--r--generic/tkTextDisp.c126
-rw-r--r--library/demos/arrow.tcl8
-rw-r--r--library/demos/bind.tcl16
-rw-r--r--library/demos/colors.tcl2
-rw-r--r--library/demos/cscroll.tcl44
-rw-r--r--library/demos/ctext.tcl6
-rw-r--r--library/demos/entry3.tcl2
-rw-r--r--library/demos/floor.tcl15
-rw-r--r--library/demos/image2.tcl2
-rw-r--r--library/demos/items.tcl27
-rw-r--r--library/demos/ixset4
-rw-r--r--library/demos/knightstour.tcl10
-rw-r--r--library/demos/pendulum.tcl2
-rw-r--r--library/demos/plot.tcl6
-rw-r--r--library/demos/ruler.tcl6
-rw-r--r--library/demos/square2
-rw-r--r--library/demos/tcolor4
-rw-r--r--library/demos/twind.tcl6
-rw-r--r--library/fontchooser.tcl2
-rw-r--r--library/iconlist.tcl4
-rw-r--r--library/megawidget.tcl2
-rw-r--r--library/safetk.tcl2
-rw-r--r--library/spinbox.tcl4
-rw-r--r--library/tearoff.tcl4
-rw-r--r--library/text.tcl7
-rw-r--r--library/ttk/fonts.tcl2
-rw-r--r--macosx/tkMacOSXHLEvents.c44
-rw-r--r--macosx/tkMacOSXInit.c122
-rw-r--r--macosx/tkMacOSXMouseEvent.c26
-rw-r--r--macosx/tkMacOSXSubwindows.c28
-rw-r--r--macosx/tkMacOSXTest.c30
-rw-r--r--macosx/tkMacOSXWindowEvent.c1
-rw-r--r--macosx/tkMacOSXWm.c8
-rw-r--r--macosx/ttkMacOSXTheme.c78
-rw-r--r--tests/all.tcl5
-rw-r--r--tests/busy.test2
-rw-r--r--tests/canvMoveto.test4
-rw-r--r--tests/canvas.test2
-rw-r--r--tests/color.test4
-rw-r--r--tests/constraints.tcl4
-rw-r--r--tests/filebox.test4
-rw-r--r--tests/fontchooser.test2
-rw-r--r--tests/imgBmap.test4
-rw-r--r--tests/imgPhoto.test4
-rw-r--r--tests/safePrimarySelection.test86
-rw-r--r--tests/scrollbar.test26
-rw-r--r--tests/send.test2
-rw-r--r--tests/textDisp.test16
-rw-r--r--tests/textIndex.test4
-rw-r--r--tests/textWind.test2
-rw-r--r--tests/tk.test2
-rw-r--r--tests/ttk/all.tcl4
-rw-r--r--tests/ttk/checkbutton.test3
-rw-r--r--tests/ttk/combobox.test5
-rw-r--r--tests/ttk/entry.test5
-rw-r--r--tests/ttk/image.test5
-rw-r--r--tests/ttk/labelframe.test5
-rw-r--r--tests/ttk/layout.test5
-rw-r--r--tests/ttk/notebook.test5
-rw-r--r--tests/ttk/panedwindow.test5
-rw-r--r--tests/ttk/progressbar.test5
-rw-r--r--tests/ttk/radiobutton.test3
-rw-r--r--tests/ttk/scrollbar.test5
-rw-r--r--tests/ttk/spinbox.test3
-rw-r--r--tests/ttk/treetags.test3
-rw-r--r--tests/ttk/treeview.test5
-rw-r--r--tests/ttk/ttk.test5
-rw-r--r--tests/ttk/validate.test4
-rw-r--r--tests/ttk/vsapi.test7
-rw-r--r--tests/unixEmbed.test2
-rw-r--r--tests/unixFont.test2
-rw-r--r--tests/winSend.test2
-rw-r--r--tests/wm.test8
-rw-r--r--unix/tkUnixWm.c4
-rw-r--r--win/tkWinFont.c35
-rw-r--r--win/tkWinWm.c4
107 files changed, 1096 insertions, 883 deletions
diff --git a/.fossil-settings/encoding-glob b/.fossil-settings/encoding-glob
index d1fd9fc..d0ad4b9 100644
--- a/.fossil-settings/encoding-glob
+++ b/.fossil-settings/encoding-glob
@@ -2,4 +2,10 @@ win/buildall.vc.bat
win/makefile.vc
win/mkd.bat
win/rmd.bat
+win/rules-ext.vc
win/rules.vc
+win/targets.vc
+win/rc/*.bmp
+win/rc/*.cur
+win/rc/*.ico
+win/rc/*.rc
diff --git a/.gitattributes b/.gitattributes
index e9a67c8..fe89ab8 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -22,15 +22,19 @@
# Declare files that will always have CRLF line endings on checkout.
*.bat eol=crlf
+*.rc eol=crlf
*.sln eol=crlf
*.vc eol=crlf
# Denote all files that are truly binary and should not be modified.
*.a binary
+*.bmp binary
+*.cur binary
*.dll binary
*.exe binary
*.gif binary
*.gz binary
+*.ico binary
*.jpg binary
*.lib binary
*.pdf binary
diff --git a/.travis.yml b/.travis.yml
index bac76c1..67708b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,8 +9,9 @@ addons:
- gcc-mingw-w64-i686
- gcc-mingw-w64-x86-64
- gcc-multilib
- - tcl-dev
+ - tcl8.6-dev
- libx11-dev
+ - xvfb
homebrew:
packages:
- tcl-tk
@@ -22,16 +23,43 @@ jobs:
- name: "Linux/GCC/Shared"
os: linux
dist: focal
+ services:
+ - xvfb
compiler: gcc
env:
- BUILD_DIR=unix
+ script: &x11gui
+ - make binaries libraries tktest
+ - make install
+ - make test
- name: "Linux/GCC/Shared/no-xft"
os: linux
dist: focal
+ services:
+ - xvfb
compiler: gcc
env:
- BUILD_DIR=unix
- CFGOPT="--disable-xft"
+ script: *x11gui
+ - name: "Linux/GCC/Shared/bionic"
+ os: linux
+ dist: bionic
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script: *x11gui
+ - name: "Linux/GCC/Shared/xenial"
+ os: linux
+ dist: xenial
+ services:
+ - xvfb
+ compiler: gcc
+ env:
+ - BUILD_DIR=unix
+ script: *x11gui
- name: "Linux/GCC/Static"
os: linux
dist: focal
diff --git a/doc/grid.n b/doc/grid.n
index b4f7699..5a175c7 100644
--- a/doc/grid.n
+++ b/doc/grid.n
@@ -285,15 +285,15 @@ The size is determined either by the \fIcontent\fR occupying the largest
row or column, or the largest column or row with a \fB\-minsize\fR,
\fB\-weight\fR, or \fB\-pad\fR that is non-zero.
.TP
-\fBgrid slaves \window\fR ?\fI\-option value\fR?
+\fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
.
-If no options are supplied, a list of all of the content in \window\fR
+If no options are supplied, a list of all of the content in \fIwindow\fR
are returned, most recently managed first.
\fIOption\fR can be either \fB\-row\fR or \fB\-column\fR which
causes only the content in the row (or column) specified by \fIvalue\fR
to be returned.
-.TP
.VS "TIP 581"
+.TP
\fBgrid content \fIwindow\fR ?\fI\-option value\fR?
.
Synonym for . \fBgrid slaves \fIwindow\fR ?\fI\-option value\fR?
diff --git a/doc/pack.n b/doc/pack.n
index f60bdb2..3ee14dd 100644
--- a/doc/pack.n
+++ b/doc/pack.n
@@ -155,8 +155,8 @@ Returns a list of all of the content windows in the packing order for \fIwindow\
The order of the content windows in the list is the same as their order in
the packing order.
If \fIwindow\fR has no content then an empty string is returned.
-.TP
.VS "TIP 581"
+.TP
\fBpack content \fIwindow\fR
.
Synonym for . \fBpack slaves \fIwindow\fR
diff --git a/doc/place.n b/doc/place.n
index f52ec53..6a30c55 100644
--- a/doc/place.n
+++ b/doc/place.n
@@ -194,8 +194,8 @@ command.
\fBplace slaves \fIwindow\fR
Returns a list of all the content windows for which \fIwindow\fR is the container.
If there is no content for \fIwindow\fR then an empty string is returned.
-.TP
.VS "TIP 581"
+.TP
\fBplace content \fIwindow\fR
.
Synonym for . \fBplace slaves \fIwindow\fR
diff --git a/doc/selection.n b/doc/selection.n
index bb4cf09..a2c5ae5 100644
--- a/doc/selection.n
+++ b/doc/selection.n
@@ -150,7 +150,7 @@ A GUI event, for example \fB<<PasteSelection>>\fR, can copy the \fBPRIMARY\fR se
.PP
On X11, the \fBPRIMARY\fR selection is a system-wide feature of the X server, allowing communication between different processes that are X11 clients.
.PP
-On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its unsafe child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its unsafe childs.
+On Windows, the \fBPRIMARY\fR selection is not provided by the system, but only by Tk, and so it is shared only between windows of a parent interpreter and its child interpreters. It is not shared between interpreters in different processes or different threads. Each parent interpreter has a separate \fBPRIMARY\fR selection that is shared only with its child interpreters which are not safe interpreters.
.PP
.SH SECURITY
.PP
diff --git a/generic/tkBind.c b/generic/tkBind.c
index bdc1f45..979d61e 100644
--- a/generic/tkBind.c
+++ b/generic/tkBind.c
@@ -790,7 +790,7 @@ GetButtonNumber(
}
static Time
-CurrentTimeInMilliSecs()
+CurrentTimeInMilliSecs(void)
{
Tcl_Time now;
Tcl_GetTime(&now);
@@ -942,7 +942,7 @@ ClearList(
static PSEntry *
FreePatSeqEntry(
- PSList *pool,
+ TCL_UNUSED(PSList *),
PSEntry *entry)
{
PSEntry *next = PSList_Next(entry);
@@ -1043,7 +1043,7 @@ MakeListEntry(
assert(TEST_PSENTRY(psPtr));
if (PSList_IsEmpty(pool)) {
- newEntry = ckalloc(sizeof(PSEntry));
+ newEntry = (PSEntry *)ckalloc(sizeof(PSEntry));
newEntry->lastModMaskArr = NULL;
DEBUG(countEntryItems += 1;)
} else {
@@ -1120,7 +1120,7 @@ GetLookupForEvent(
key.object = object;
key.type = eventPtr->xev.type;
hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key);
- return hPtr ? Tcl_GetHashValue(hPtr) : NULL;
+ return hPtr ? (PSList *)Tcl_GetHashValue(hPtr) : NULL;
}
/*
@@ -1158,13 +1158,13 @@ ClearLookupTable(
nextPtr = Tcl_NextHashEntry(&search);
if (object) {
- const PatternTableKey *key = Tcl_GetHashKey(&lookupTables->listTable, hPtr);
+ const PatternTableKey *key = (const PatternTableKey *)Tcl_GetHashKey(&lookupTables->listTable, hPtr);
if (key->object != object) {
continue;
}
}
- psList = Tcl_GetHashValue(hPtr);
+ psList = (PSList *)Tcl_GetHashValue(hPtr);
PSList_Move(pool, psList);
ckfree(psList);
DEBUG(countListItems -= 1;)
@@ -1375,7 +1375,7 @@ TkBindInit(
mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp);
- bindInfoPtr = ckalloc(sizeof(BindInfo));
+ bindInfoPtr = (BindInfo *)ckalloc(sizeof(BindInfo));
InitVirtualEventTable(&bindInfoPtr->virtualEventTable);
bindInfoPtr->screenInfo.curDispPtr = NULL;
bindInfoPtr->screenInfo.curScreenIndex = -1;
@@ -1451,7 +1451,7 @@ Tk_CreateBindingTable(
Tcl_Interp *interp) /* Interpreter to associate with the binding table: commands are
* executed in this interpreter. */
{
- BindingTable *bindPtr = ckalloc(sizeof(BindingTable));
+ BindingTable *bindPtr = (BindingTable *)ckalloc(sizeof(BindingTable));
unsigned i;
assert(interp);
@@ -1510,7 +1510,7 @@ Tk_DeleteBindingTable(
PatSeq *nextPtr;
PatSeq *psPtr;
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
nextPtr = psPtr->nextSeqPtr;
FreePatSeq(psPtr);
@@ -1577,12 +1577,12 @@ InsertPatSeq(
hPtr = Tcl_CreateHashEntry(&lookupTables->listTable, (char *) &key, &isNew);
if (isNew) {
- psList = ckalloc(sizeof(PSList));
+ psList = (PSList *)ckalloc(sizeof(PSList));
PSList_Init(psList);
Tcl_SetHashValue(hPtr, psList);
DEBUG(countListItems += 1;)
} else {
- psList = Tcl_GetHashValue(hPtr);
+ psList = (PSList *)Tcl_GetHashValue(hPtr);
}
psEntry = MakeListEntry(&lookupTables->entryPool, psPtr, 0);
@@ -1670,7 +1670,7 @@ Tk_CreateBinding(
*/
hPtr = Tcl_CreateHashEntry(&bindPtr->objectTable, (char *) object, &isNew);
- psPtr->ptr.nextObj = isNew ? NULL : Tcl_GetHashValue(hPtr);
+ psPtr->ptr.nextObj = isNew ? NULL : (PatSeq *)Tcl_GetHashValue(hPtr);
Tcl_SetHashValue(hPtr, psPtr);
InsertPatSeq(&bindPtr->lookupTables, psPtr);
}
@@ -1680,14 +1680,14 @@ Tk_CreateBinding(
size_t length1 = strlen(oldStr);
size_t length2 = strlen(script);
- newStr = ckalloc(length1 + length2 + 2);
+ newStr = (char *)ckalloc(length1 + length2 + 2);
memcpy(newStr, oldStr, length1);
newStr[length1] = '\n';
memcpy(newStr + length1 + 1, script, length2 + 1);
} else {
size_t length = strlen(script);
- newStr = ckalloc(length + 1);
+ newStr = (char *)ckalloc(length + 1);
memcpy(newStr, script, length + 1);
}
ckfree(oldStr);
@@ -1742,7 +1742,7 @@ Tk_DeleteBinding(
if (!(hPtr = Tcl_FindHashEntry(&bindPtr->objectTable, (char *) object))) {
Tcl_Panic("Tk_DeleteBinding couldn't find object table entry");
}
- prevPtr = Tcl_GetHashValue(hPtr);
+ prevPtr = (PatSeq *)Tcl_GetHashValue(hPtr);
if (prevPtr == psPtr) {
Tcl_SetHashValue(hPtr, psPtr->ptr.nextObj);
} else {
@@ -1843,7 +1843,7 @@ Tk_GetAllBindings(
* For each binding, output information about each of the patterns in its sequence.
*/
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) {
+ for (psPtr = (const PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = psPtr->ptr.nextObj) {
assert(TEST_PSENTRY(psPtr));
Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(psPtr));
}
@@ -1882,7 +1882,7 @@ RemovePatSeqFromLookup(
SetupPatternKey(&key, psPtr);
if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) {
- PSList *psList = Tcl_GetHashValue(hPtr);
+ PSList *psList = (PSList *)Tcl_GetHashValue(hPtr);
PSEntry *psEntry;
TK_DLIST_FOREACH(psEntry, psList) {
@@ -1966,7 +1966,7 @@ DeletePatSeq(
assert(!psPtr->added);
assert(!psPtr->owned);
- prevPtr = Tcl_GetHashValue(psPtr->hPtr);
+ prevPtr = (PatSeq *)Tcl_GetHashValue(psPtr->hPtr);
nextPtr = psPtr->ptr.nextObj;
/*
@@ -2037,7 +2037,7 @@ Tk_DeleteAllBindings(
ClearLookupTable(&bindPtr->lookupTables, object);
ClearPromotionLists(bindPtr, object);
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
DEBUG(psPtr->added = 0;)
nextPtr = DeletePatSeq(psPtr);
@@ -2362,7 +2362,7 @@ Tk_BindEvent(
if ((size_t) numObjects > SIZE_OF_ARRAY(matchPtrBuf)) {
/* it's unrealistic that the buffer size is too small, but who knows? */
- matchPtrArr = ckalloc(numObjects*sizeof(matchPtrArr[0]));
+ matchPtrArr = (PatSeq **)ckalloc(numObjects*sizeof(matchPtrArr[0]));
}
memset(matchPtrArr, 0, numObjects*sizeof(matchPtrArr[0]));
@@ -2403,8 +2403,8 @@ Tk_BindEvent(
PSList *psSuccList = PromArr_First(bindPtr->promArr);
PatSeq *bestPtr;
- psl[0] = GetLookupForEvent(physTables, curEvent, objArr[k], 1);
- psl[1] = GetLookupForEvent(physTables, curEvent, objArr[k], 0);
+ psl[0] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 1);
+ psl[1] = GetLookupForEvent(physTables, curEvent, (Tcl_Obj *)objArr[k], 0);
assert(psl[0] == NULL || psl[0] != psl[1]);
@@ -3468,7 +3468,7 @@ DeleteVirtualEventTable(
PatSeq *nextPtr;
PatSeq *psPtr;
- for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
+ for (psPtr = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) {
assert(TEST_PSENTRY(psPtr));
nextPtr = psPtr->nextSeqPtr;
DEBUG(psPtr->owned = 0;)
@@ -3550,7 +3550,7 @@ CreateVirtualEvent(
* Make virtual event own the physical event.
*/
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (PhysOwned *)Tcl_GetHashValue(vhPtr);
if (!PhysOwned_Contains(owned, psPtr)) {
PhysOwned_Append(&owned, psPtr);
@@ -3612,7 +3612,7 @@ DeleteVirtualEvent(
if (!(vhPtr = Tcl_FindHashEntry(&vetPtr->nameTable, virtUid))) {
return TCL_OK;
}
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (PhysOwned *)Tcl_GetHashValue(vhPtr);
eventPSPtr = NULL;
if (eventString) {
@@ -3744,7 +3744,7 @@ GetVirtualEvent(
}
resultObj = Tcl_NewObj();
- owned = Tcl_GetHashValue(vhPtr);
+ owned = (const PhysOwned *)Tcl_GetHashValue(vhPtr);
for (iPhys = 0; iPhys < PhysOwned_Size(owned); ++iPhys) {
Tcl_ListObjAppendElement(NULL, resultObj, GetPatternObj(PhysOwned_Get(owned, iPhys)));
}
@@ -3833,7 +3833,7 @@ HandleEventGenerate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- union { XEvent general; XVirtualEvent virtual; } event;
+ union { XEvent general; XVirtualEvent virt; } event;
const char *p;
const char *name;
@@ -3936,7 +3936,7 @@ HandleEventGenerate(
} else if (flags & BUTTON) {
event.general.xbutton.button = pat.info;
} else if (flags & VIRTUAL) {
- event.virtual.name = pat.name;
+ event.virt.name = pat.name;
}
}
if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) {
@@ -4376,7 +4376,7 @@ HandleEventGenerate(
* refcount before firing it into the low-level event subsystem; the
* refcount will be decremented once the event has been processed.
*/
- event.virtual.user_data = userDataObj;
+ event.virt.user_data = userDataObj;
Tcl_IncrRefCount(userDataObj);
}
@@ -4636,7 +4636,7 @@ FindSequence(
assert(lookupTables);
assert(eventString);
- psPtr = ckalloc(PATSEQ_MEMSIZE(patsBufSize));
+ psPtr = (PatSeq *)ckalloc(PATSEQ_MEMSIZE(patsBufSize));
/*
*------------------------------------------------------------------
@@ -4648,7 +4648,7 @@ FindSequence(
if (numPats >= patsBufSize) {
unsigned pos = patPtr - psPtr->pats;
patsBufSize += patsBufSize;
- psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize));
+ psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(patsBufSize));
patPtr = psPtr->pats + pos;
}
@@ -4697,18 +4697,18 @@ FindSequence(
return NULL;
}
if (patsBufSize > numPats) {
- psPtr = ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats));
+ psPtr = (PatSeq *)ckrealloc(psPtr, PATSEQ_MEMSIZE(numPats));
}
patPtr = psPtr->pats;
- psPtr->object = object;
+ psPtr->object = (Tcl_Obj *)object;
SetupPatternKey(&key, psPtr);
hPtr = Tcl_CreateHashEntry(&lookupTables->patternTable, (char *) &key, &isNew);
if (!isNew) {
unsigned sequenceSize = numPats*sizeof(TkPattern);
PatSeq *psPtr2;
- for (psPtr2 = Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) {
+ for (psPtr2 = (PatSeq *)Tcl_GetHashValue(hPtr); psPtr2; psPtr2 = psPtr2->nextSeqPtr) {
assert(TEST_PSENTRY(psPtr2));
if (numPats == psPtr2->numPats && memcmp(patPtr, psPtr2->pats, sequenceSize) == 0) {
ckfree(psPtr);
@@ -4744,7 +4744,7 @@ FindSequence(
psPtr->added = 0;
psPtr->modMaskUsed = (modMask != 0);
psPtr->script = NULL;
- psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr);
+ psPtr->nextSeqPtr = (PatSeq *)Tcl_GetHashValue(hPtr);
psPtr->hPtr = hPtr;
psPtr->ptr.nextObj = NULL;
assert(psPtr->ptr.owners == NULL);
@@ -4886,7 +4886,7 @@ ParseEventDescription(
size = p - field;
if (size >= sizeof(buf)) {
- bufPtr = ckalloc(size + 1);
+ bufPtr = (char *)ckalloc(size + 1);
}
strncpy(bufPtr, field, size);
bufPtr[size] = '\0';
@@ -4918,7 +4918,7 @@ ParseEventDescription(
if (!(hPtr = Tcl_FindHashEntry(&modTable, field))) {
break;
}
- modPtr = Tcl_GetHashValue(hPtr);
+ modPtr = (ModInfo *)Tcl_GetHashValue(hPtr);
patPtr->modMask |= modPtr->mask;
if (modPtr->flags & MULT_CLICKS) {
unsigned i = modPtr->flags & MULT_CLICKS;
@@ -4933,7 +4933,7 @@ ParseEventDescription(
eventFlags = 0;
if ((hPtr = Tcl_FindHashEntry(&eventTable, field))) {
- const EventInfo *eiPtr = Tcl_GetHashValue(hPtr);
+ const EventInfo *eiPtr = (const EventInfo *)Tcl_GetHashValue(hPtr);
patPtr->eventType = eiPtr->type;
eventFlags = flagArray[eiPtr->type];
@@ -5169,7 +5169,7 @@ GetPatternObj(
case ButtonPress:
case ButtonRelease:
assert(patPtr->info <= Button5);
- Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info);
+ Tcl_AppendPrintfToObj(patternObj, "-%u", (unsigned) patPtr->info);
break;
#if PRINT_SHORT_MOTION_SYNTAX
case MotionNotify: {
@@ -5257,7 +5257,7 @@ TkKeysymToString(
Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&nameTable, (char *)keysym);
if (hPtr) {
- return Tcl_GetHashValue(hPtr);
+ return (const char *)Tcl_GetHashValue(hPtr);
}
#endif /* REDO_KEYSYM_LOOKUP */
diff --git a/generic/tkBusy.c b/generic/tkBusy.c
index 7bd9a44..1e4e91f 100644
--- a/generic/tkBusy.c
+++ b/generic/tkBusy.c
@@ -54,7 +54,7 @@ static void MakeTransparentWindowExist(Tk_Window tkwin,
Window parent);
static inline Tk_Window NextChild(Tk_Window tkwin);
static void RefWinEventProc(ClientData clientData,
- register XEvent *eventPtr);
+ XEvent *eventPtr);
static inline void SetWindowInstanceData(Tk_Window tkwin,
ClientData instanceData);
@@ -122,13 +122,12 @@ SetWindowInstanceData(
*----------------------------------------------------------------------
*/
-/* ARGSUSED */
static void
BusyCustodyProc(
ClientData clientData, /* Information about the busy window. */
- Tk_Window tkwin) /* Not used. */
+ TCL_UNUSED(Tk_Window)) /* Not used. */
{
- Busy *busyPtr = clientData;
+ Busy *busyPtr = (Busy *)clientData;
Tk_DeleteEventHandler(busyPtr->tkBusy, StructureNotifyMask, BusyEventProc,
busyPtr);
@@ -156,12 +155,11 @@ BusyCustodyProc(
*----------------------------------------------------------------------
*/
-/* ARGSUSED */
static void
BusyGeometryProc(
- ClientData clientData, /* Information about window that got new
+ TCL_UNUSED(void *), /* Information about window that got new
* preferred geometry. */
- Tk_Window tkwin) /* Other Tk-related information about the
+ TCL_UNUSED(Tk_Window)) /* Other Tk-related information about the
* window. */
{
/* Should never get here */
@@ -249,9 +247,9 @@ DoConfigureNotify(
static void
RefWinEventProc(
ClientData clientData, /* Busy window record */
- register XEvent *eventPtr) /* Event which triggered call to routine */
+ XEvent *eventPtr) /* Event which triggered call to routine */
{
- register Busy *busyPtr = clientData;
+ Busy *busyPtr = (Busy *)clientData;
switch (eventPtr->type) {
case ReparentNotify:
@@ -333,7 +331,7 @@ static void
DestroyBusy(
void *data) /* Busy window structure record */
{
- register Busy *busyPtr = data;
+ Busy *busyPtr = (Busy *)data;
if (busyPtr->hashPtr != NULL) {
Tcl_DeleteHashEntry(busyPtr->hashPtr);
@@ -377,7 +375,7 @@ BusyEventProc(
ClientData clientData, /* Busy window record */
XEvent *eventPtr) /* Event which triggered call to routine */
{
- Busy *busyPtr = clientData;
+ Busy *busyPtr = (Busy *)clientData;
if (eventPtr->type == DestroyNotify) {
busyPtr->tkBusy = NULL;
@@ -527,10 +525,10 @@ CreateBusy(
Window parent;
Tk_FakeWin *winPtr;
- busyPtr = ckalloc(sizeof(Busy));
+ busyPtr = (Busy *)ckalloc(sizeof(Busy));
x = y = 0;
length = strlen(Tk_Name(tkRef));
- name = ckalloc(length + 6);
+ name = (char *)ckalloc(length + 6);
if (Tk_IsTopLevel(tkRef)) {
fmt = "_Busy"; /* Child */
tkParent = tkRef;
@@ -696,7 +694,7 @@ GetBusy(
Tcl_GetString(windowObj), NULL);
return NULL;
}
- return Tcl_GetHashValue(hPtr);
+ return (Busy *)Tcl_GetHashValue(hPtr);
}
/*
@@ -746,7 +744,7 @@ HoldBusy(
Tcl_SetHashValue(hPtr, busyPtr);
busyPtr->hashPtr = hPtr;
} else {
- busyPtr = Tcl_GetHashValue(hPtr);
+ busyPtr = (Busy *)Tcl_GetHashValue(hPtr);
}
busyPtr->tablePtr = busyTablePtr;
@@ -789,7 +787,7 @@ Tk_BusyObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable;
Busy *busyPtr;
Tcl_Obj *objPtr;
@@ -855,7 +853,7 @@ Tk_BusyObjCmd(
}
Tcl_Preserve(busyPtr);
if (objc <= 4) {
- objPtr = Tk_GetOptionInfo(interp, (char *) busyPtr,
+ objPtr = Tk_GetOptionInfo(interp, (char *)busyPtr,
busyPtr->optionTable, (objc == 4) ? objv[3] : NULL,
busyPtr->tkBusy);
if (objPtr == NULL) {
@@ -877,7 +875,7 @@ Tk_BusyObjCmd(
objPtr = Tcl_NewObj();
for (hPtr = Tcl_FirstHashEntry(busyTablePtr, &cursor); hPtr != NULL;
hPtr = Tcl_NextHashEntry(&cursor)) {
- busyPtr = Tcl_GetHashValue(hPtr);
+ busyPtr = (Busy *)Tcl_GetHashValue(hPtr);
if (pattern == NULL ||
Tcl_StringCaseMatch(Tk_PathName(busyPtr->tkRef), pattern, 0)) {
Tcl_ListObjAppendElement(interp, objPtr,
diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c
index 2e504eb..703ef41 100644
--- a/generic/tkClipboard.c
+++ b/generic/tkClipboard.c
@@ -56,7 +56,7 @@ ClipboardHandler(
char *buffer, /* Place to store converted selection. */
int maxBytes) /* Maximum # of bytes to store at buffer. */
{
- TkClipboardTarget *targetPtr = clientData;
+ TkClipboardTarget *targetPtr = (TkClipboardTarget *)clientData;
TkClipboardBuffer *cbPtr;
char *srcPtr, *destPtr;
size_t count = 0;
@@ -173,11 +173,11 @@ ClipboardAppHandler(
static int
ClipboardWindowHandler(
- ClientData clientData, /* Not used. */
- int offset, /* Return selection bytes starting at this
+ TCL_UNUSED(void *), /* Not used. */
+ TCL_UNUSED(int), /* Return selection bytes starting at this
* offset. */
char *buffer, /* Place to store converted selection. */
- int maxBytes) /* Maximum # of bytes to store at buffer. */
+ TCL_UNUSED(int)) /* Maximum # of bytes to store at buffer. */
{
buffer[0] = '.';
buffer[1] = 0;
@@ -206,7 +206,7 @@ static void
ClipboardLostSel(
ClientData clientData) /* Pointer to TkDisplay structure. */
{
- TkDisplay *dispPtr = clientData;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
dispPtr->clipboardActive = 0;
}
@@ -359,7 +359,7 @@ Tk_ClipboardAppend(
}
}
if (targetPtr == NULL) {
- targetPtr = ckalloc(sizeof(TkClipboardTarget));
+ targetPtr = (TkClipboardTarget *)ckalloc(sizeof(TkClipboardTarget));
targetPtr->type = type;
targetPtr->format = format;
targetPtr->firstBufferPtr = targetPtr->lastBufferPtr = NULL;
@@ -381,7 +381,7 @@ Tk_ClipboardAppend(
* Append a new buffer to the buffer chain.
*/
- cbPtr = ckalloc(sizeof(TkClipboardBuffer));
+ cbPtr = (TkClipboardBuffer *)ckalloc(sizeof(TkClipboardBuffer));
cbPtr->nextPtr = NULL;
if (targetPtr->lastBufferPtr != NULL) {
targetPtr->lastBufferPtr->nextPtr = cbPtr;
@@ -391,7 +391,7 @@ Tk_ClipboardAppend(
targetPtr->lastBufferPtr = cbPtr;
cbPtr->length = strlen(buffer);
- cbPtr->buffer = ckalloc(cbPtr->length + 1);
+ cbPtr->buffer = (char *)ckalloc(cbPtr->length + 1);
strcpy(cbPtr->buffer, buffer);
TkSelUpdateClipboard((TkWindow *) dispPtr->clipWindow, targetPtr);
@@ -423,7 +423,7 @@ Tk_ClipboardObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
- Tk_Window tkwin = (Tk_Window) clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
const char *path = NULL;
Atom selection;
static const char *const optionStrings[] = { "append", "clear", "get", NULL };
@@ -636,8 +636,8 @@ Tk_ClipboardObjCmd(
int
TkClipInit(
- Tcl_Interp *interp, /* Interpreter to use for error reporting. */
- register TkDisplay *dispPtr)/* Display to initialize. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter to use for error reporting. */
+ TkDisplay *dispPtr)/* Display to initialize. */
{
XSetWindowAttributes atts;
@@ -700,12 +700,11 @@ TkClipInit(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ClipboardGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *interp, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 89b5254..193c3d6 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -99,7 +99,7 @@ Tk_BellObjCmd(
"-displayof", "-nice", NULL
};
enum options { TK_BELL_DISPLAYOF, TK_BELL_NICE };
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int i, index, nice = 0;
Tk_ErrorHandler handler;
@@ -163,7 +163,7 @@ Tk_BindObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr;
ClientData object;
const char *string;
@@ -187,7 +187,7 @@ Tk_BindObjCmd(
}
object = (ClientData) winPtr->pathName;
} else {
- winPtr = clientData;
+ winPtr = (TkWindow *)clientData;
object = (ClientData) Tk_GetUid(string);
}
@@ -285,10 +285,10 @@ TkBindEventProc(
*/
if (winPtr->numTags > MAX_OBJS) {
- objPtr = ckalloc(winPtr->numTags * sizeof(ClientData));
+ objPtr = (void **)ckalloc(winPtr->numTags * sizeof(void *));
}
for (i = 0; i < winPtr->numTags; i++) {
- p = winPtr->tagPtr[i];
+ p = (const char *)winPtr->tagPtr[i];
if (*p == '.') {
hPtr = Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, p);
if (hPtr != NULL) {
@@ -347,7 +347,7 @@ Tk_BindtagsObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr, *winPtr2;
int i, length;
const char *p;
@@ -399,7 +399,7 @@ Tk_BindtagsObjCmd(
}
winPtr->numTags = length;
- winPtr->tagPtr = ckalloc(length * sizeof(ClientData));
+ winPtr->tagPtr = (void **)ckalloc(length * sizeof(void *));
for (i = 0; i < length; i++) {
p = Tcl_GetString(tags[i]);
if (p[0] == '.') {
@@ -412,7 +412,7 @@ Tk_BindtagsObjCmd(
* is one.
*/
- copy = ckalloc(strlen(p) + 1);
+ copy = (char *)ckalloc(strlen(p) + 1);
strcpy(copy, p);
winPtr->tagPtr[i] = (ClientData) copy;
} else {
@@ -448,7 +448,7 @@ TkFreeBindingTags(
const char *p;
for (i = 0; i < winPtr->numTags; i++) {
- p = winPtr->tagPtr[i];
+ p = (const char *)winPtr->tagPtr[i];
if (*p == '.') {
/*
* Names starting with "." are malloced rather than Uids, so they
@@ -488,7 +488,7 @@ Tk_DestroyObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tk_Window window;
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int i;
for (i = 1; i < objc; i++) {
@@ -527,7 +527,6 @@ Tk_DestroyObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_LowerObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -535,7 +534,7 @@ Tk_LowerObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window mainwin = clientData;
+ Tk_Window mainwin = (Tk_Window)clientData;
Tk_Window tkwin, other;
if ((objc != 2) && (objc != 3)) {
@@ -587,7 +586,6 @@ Tk_LowerObjCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_RaiseObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -595,7 +593,7 @@ Tk_RaiseObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window mainwin = clientData;
+ Tk_Window mainwin = (Tk_Window)clientData;
Tk_Window tkwin, other;
if ((objc != 2) && (objc != 3)) {
@@ -683,7 +681,7 @@ AppnameCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr;
const char *string;
@@ -715,7 +713,7 @@ CaretCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int index;
Tcl_Obj *objPtr;
TkCaret *caretPtr;
@@ -807,7 +805,7 @@ ScalingCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
Screen *screenPtr;
int skip, width, height;
double d;
@@ -858,7 +856,7 @@ UseinputmethodsCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkDisplay *dispPtr;
int skip;
@@ -906,7 +904,7 @@ UseinputmethodsCmd(
int
WindowingsystemCmd(
- ClientData clientData, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -935,7 +933,7 @@ InactiveCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin);
if (skip < 0) {
@@ -991,7 +989,6 @@ InactiveCmd(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_TkwaitObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -999,7 +996,7 @@ Tk_TkwaitObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int done, index;
int code = TCL_OK;
static const char *const optionStrings[] = {
@@ -1120,28 +1117,26 @@ Tk_TkwaitObjCmd(
return code;
}
- /* ARGSUSED */
static char *
WaitVariableProc(
ClientData clientData, /* Pointer to integer to set to 1. */
- Tcl_Interp *interp, /* Interpreter containing variable. */
- const char *name1, /* Name of variable. */
- const char *name2, /* Second part of variable name. */
- int flags) /* Information about what happened. */
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter containing variable. */
+ TCL_UNUSED(const char *), /* Name of variable. */
+ TCL_UNUSED(const char *), /* Second part of variable name. */
+ TCL_UNUSED(int)) /* Information about what happened. */
{
- int *donePtr = clientData;
+ int *donePtr = (int *)clientData;
*donePtr = 1;
return NULL;
}
- /*ARGSUSED*/
static void
WaitVisibilityProc(
ClientData clientData, /* Pointer to integer to set to 1. */
XEvent *eventPtr) /* Information about event (not used). */
{
- int *donePtr = clientData;
+ int *donePtr = (int *)clientData;
if (eventPtr->type == VisibilityNotify) {
*donePtr = 1;
@@ -1155,7 +1150,7 @@ WaitWindowProc(
ClientData clientData, /* Pointer to integer to set to 1. */
XEvent *eventPtr) /* Information about event. */
{
- int *donePtr = clientData;
+ int *donePtr = (int *)clientData;
if (eventPtr->type == DestroyNotify) {
*donePtr = 1;
@@ -1179,10 +1174,9 @@ WaitWindowProc(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_UpdateObjCmd(
- ClientData clientData, /* Main window associated with interpreter. */
+ TCL_UNUSED(void *), /* Main window associated with interpreter. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -1288,7 +1282,7 @@ Tk_WinfoObjCmd(
int index, x, y, width, height, useX, useY, c_class, skip;
const char *string;
TkWindow *winPtr;
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
static const TkStateMap visualMap[] = {
{PseudoColor, "pseudocolor"},
@@ -1579,11 +1573,11 @@ Tk_WinfoObjCmd(
objv += skip;
string = Tcl_GetString(objv[2]);
Tcl_SetObjResult(interp,
- Tcl_NewLongObj((long) Tk_InternAtom(tkwin, string)));
+ Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string)));
break;
case WIN_ATOMNAME: {
const char *name;
- long id;
+ Tcl_WideInt id;
skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin);
if (skip < 0) {
@@ -1594,7 +1588,7 @@ Tk_WinfoObjCmd(
return TCL_ERROR;
}
objv += skip;
- if (Tcl_GetLongFromObj(interp, objv[2], &id) != TCL_OK) {
+ if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) {
return TCL_ERROR;
}
name = Tk_GetAtomName(tkwin, (Atom) id);
@@ -1774,7 +1768,7 @@ Tk_WinfoObjCmd(
break;
}
case WIN_VISUALSAVAILABLE: {
- XVisualInfo template, *visInfoPtr;
+ XVisualInfo templ, *visInfoPtr;
int count, i;
int includeVisualId;
Tcl_Obj *strPtr, *resultPtr;
@@ -1795,9 +1789,9 @@ Tk_WinfoObjCmd(
return TCL_ERROR;
}
- template.screen = Tk_ScreenNumber(tkwin);
+ templ.screen = Tk_ScreenNumber(tkwin);
visInfoPtr = XGetVisualInfo(Tk_Display(tkwin), VisualScreenMask,
- &template, &count);
+ &templ, &count);
if (visInfoPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"can't find any visuals for screen", -1));
@@ -2094,7 +2088,7 @@ TkGetDisplayOf(
}
string = Tcl_GetStringFromObj(objv[0], &length);
if ((length >= 2) &&
- (strncmp(string, "-displayof", (unsigned) length) == 0)) {
+ (strncmp(string, "-displayof", length) == 0)) {
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"value for \"-displayof\" missing", -1));
@@ -2128,12 +2122,11 @@ TkGetDisplayOf(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
TkDeadAppObjCmd(
- ClientData clientData, /* Dummy. */
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
- int objc, /* Number of arguments. */
+ TCL_UNUSED(int), /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 7e0943d..46338e2 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -178,7 +178,7 @@ Tk_CreateOptionTable(
const Tk_OptionSpec *specPtr, *specPtr2;
Option *optionPtr;
int numOptions, i;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -202,7 +202,7 @@ Tk_CreateOptionTable(
hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->hashTable, (char *) templatePtr,
&newEntry);
if (!newEntry) {
- tablePtr = Tcl_GetHashValue(hashEntryPtr);
+ tablePtr = (OptionTable *)Tcl_GetHashValue(hashEntryPtr);
tablePtr->refCount++;
return (Tk_OptionTable) tablePtr;
}
@@ -216,7 +216,7 @@ Tk_CreateOptionTable(
for (specPtr = templatePtr; specPtr->type != TK_OPTION_END; specPtr++) {
numOptions++;
}
- tablePtr = ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option)));
+ tablePtr = (OptionTable *)ckalloc(sizeof(OptionTable) + (numOptions * sizeof(Option)));
tablePtr->refCount = 1;
tablePtr->hashEntryPtr = hashEntryPtr;
tablePtr->nextPtr = NULL;
@@ -266,7 +266,7 @@ Tk_CreateOptionTable(
|| (specPtr->type == TK_OPTION_BORDER))
&& (specPtr->clientData != NULL)) {
optionPtr->extra.monoColorPtr =
- Tcl_NewStringObj(specPtr->clientData, -1);
+ Tcl_NewStringObj((const char *)specPtr->clientData, -1);
Tcl_IncrRefCount(optionPtr->extra.monoColorPtr);
}
@@ -275,7 +275,7 @@ Tk_CreateOptionTable(
* Get the custom parsing, etc., functions.
*/
- optionPtr->extra.custom = specPtr->clientData;
+ optionPtr->extra.custom = (const Tk_ObjCustomOption *)specPtr->clientData;
}
}
if (((specPtr->type == TK_OPTION_STRING)
@@ -300,7 +300,7 @@ Tk_CreateOptionTable(
if (specPtr->clientData != NULL) {
tablePtr->nextPtr = (OptionTable *)
- Tk_CreateOptionTable(interp, specPtr->clientData);
+ Tk_CreateOptionTable(interp, (Tk_OptionSpec *)specPtr->clientData);
}
return (Tk_OptionTable) tablePtr;
@@ -332,8 +332,7 @@ Tk_DeleteOptionTable(
Option *optionPtr;
int count;
- tablePtr->refCount--;
- if (tablePtr->refCount > 0) {
+ if (tablePtr->refCount-- > 1) {
return;
}
@@ -1166,9 +1165,9 @@ TkGetOptionSpec(
static void
FreeOptionInternalRep(
- register Tcl_Obj *objPtr) /* Object whose internal rep to free. */
+ Tcl_Obj *objPtr) /* Object whose internal rep to free. */
{
- register Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1;
+ Tk_OptionTable tablePtr = (Tk_OptionTable) objPtr->internalRep.twoPtrValue.ptr1;
Tk_DeleteOptionTable(tablePtr);
objPtr->typePtr = NULL;
@@ -1192,7 +1191,7 @@ DupOptionInternalRep(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- register OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1;
+ OptionTable *tablePtr = (OptionTable *) srcObjPtr->internalRep.twoPtrValue.ptr1;
tablePtr->refCount++;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep = srcObjPtr->internalRep;
@@ -1289,7 +1288,7 @@ Tk_SetOptions(
* more space.
*/
- newSavePtr = ckalloc(sizeof(Tk_SavedOptions));
+ newSavePtr = (Tk_SavedOptions *)ckalloc(sizeof(Tk_SavedOptions));
newSavePtr->recordPtr = recordPtr;
newSavePtr->tkwin = tkwin;
newSavePtr->numItems = 0;
@@ -1529,7 +1528,6 @@ Tk_FreeSavedOptions(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
Tk_FreeConfigOptions(
char *recordPtr, /* Record whose fields contain current values
@@ -2068,7 +2066,7 @@ Tk_GetOptionValue(
Tcl_Obj *
TkDebugConfig(
- Tcl_Interp *interp, /* Interpreter in which the table is
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter in which the table is
* defined. */
Tk_OptionTable table) /* Table about which information is to be
* returned. May not necessarily exist in the
@@ -2078,7 +2076,7 @@ TkDebugConfig(
Tcl_HashEntry *hashEntryPtr;
Tcl_HashSearch search;
Tcl_Obj *objPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
objPtr = Tcl_NewObj();
diff --git a/generic/tkConsole.c b/generic/tkConsole.c
index 701ce77..095d132 100644
--- a/generic/tkConsole.c
+++ b/generic/tkConsole.c
@@ -67,7 +67,7 @@ static int InterpreterObjCmd(ClientData clientData, Tcl_Interp *interp,
static const Tcl_ChannelType consoleChannelType = {
"console", /* Type name. */
- TCL_CHANNEL_VERSION_5, /* v4 channel */
+ TCL_CHANNEL_VERSION_5, /* v5 channel */
ConsoleClose, /* Close proc. */
ConsoleInput, /* Input proc. */
ConsoleOutput, /* Output proc. */
@@ -228,7 +228,7 @@ Tk_InitConsoleChannels(
return;
}
- consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
+ consoleInitPtr = (int *)Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int));
if (*consoleInitPtr) {
/*
* We've already initialized console channels in this thread.
@@ -256,13 +256,13 @@ Tk_InitConsoleChannels(
* interp for it to live in.
*/
- info = ckalloc(sizeof(ConsoleInfo));
+ info = (ConsoleInfo *) ckalloc(sizeof(ConsoleInfo));
info->consoleInterp = NULL;
info->interp = NULL;
info->refCount = 0;
if (doIn) {
- ChannelData *data = ckalloc(sizeof(ChannelData));
+ ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -279,7 +279,7 @@ Tk_InitConsoleChannels(
}
if (doOut) {
- ChannelData *data = ckalloc(sizeof(ChannelData));
+ ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -296,7 +296,7 @@ Tk_InitConsoleChannels(
}
if (doErr) {
- ChannelData *data = ckalloc(sizeof(ChannelData));
+ ChannelData *data = (ChannelData *)ckalloc(sizeof(ChannelData));
data->info = info;
data->info->refCount++;
@@ -378,7 +378,7 @@ Tk_CreateConsoleWindow(
* New ConsoleInfo for a new console window.
*/
- info = ckalloc(sizeof(ConsoleInfo));
+ info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
/*
@@ -408,7 +408,7 @@ Tk_CreateConsoleWindow(
}
}
} else {
- info = ckalloc(sizeof(ConsoleInfo));
+ info = (ConsoleInfo *)ckalloc(sizeof(ConsoleInfo));
info->refCount = 0;
}
@@ -457,7 +457,7 @@ Tk_CreateConsoleWindow(
if (mainWindow) {
Tk_DeleteEventHandler(mainWindow, StructureNotifyMask,
ConsoleEventProc, info);
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -498,7 +498,7 @@ ConsoleOutput(
int toWrite, /* How many bytes to write? */
int *errorCode) /* Where to store error code. */
{
- ChannelData *data = instanceData;
+ ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
*errorCode = 0;
@@ -559,14 +559,13 @@ ConsoleOutput(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ConsoleInput(
- ClientData instanceData, /* Unused. */
- char *buf, /* Where to store data read. */
- int bufSize, /* How much space is available in the
+ TCL_UNUSED(void *),
+ TCL_UNUSED(char *), /* Where to store data read. */
+ TCL_UNUSED(int), /* How much space is available in the
* buffer? */
- int *errorCode) /* Where to store error code. */
+ TCL_UNUSED(int *)) /* Where to store error code. */
{
return 0; /* Always return EOF. */
}
@@ -587,17 +586,16 @@ ConsoleInput(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ConsoleClose(
- ClientData instanceData, /* Unused. */
- Tcl_Interp *interp) /* Unused. */
+ ClientData instanceData,
+ TCL_UNUSED(Tcl_Interp *))
{
- ChannelData *data = instanceData;
+ ChannelData *data = (ChannelData *)instanceData;
ConsoleInfo *info = data->info;
if (info) {
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
/*
* Assuming the Tcl_Interp * fields must already be NULL.
*/
@@ -639,11 +637,10 @@ Console2Close(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static void
ConsoleWatch(
- ClientData instanceData, /* Device ID for the channel. */
- int mask) /* OR-ed combination of TCL_READABLE,
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int)) /* OR-ed combination of TCL_READABLE,
* TCL_WRITABLE and TCL_EXCEPTION, for the
* events we are interested in. */
{
@@ -666,14 +663,13 @@ ConsoleWatch(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ConsoleHandle(
- ClientData instanceData, /* Device ID for the channel. */
- int direction, /* TCL_READABLE or TCL_WRITABLE to indicate
+ TCL_UNUSED(void *), /* Device ID for the channel. */
+ TCL_UNUSED(int), /* TCL_READABLE or TCL_WRITABLE to indicate
* which direction of the channel is being
* requested. */
- ClientData *handlePtr) /* Where to store handle */
+ TCL_UNUSED(void **)) /* Where to store handle */
{
return TCL_ERROR;
}
@@ -707,7 +703,7 @@ ConsoleObjCmd(
"eval", "hide", "show", "title", NULL};
enum option {CON_EVAL, CON_HIDE, CON_SHOW, CON_TITLE};
Tcl_Obj *cmd = NULL;
- ConsoleInfo *info = clientData;
+ ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *consoleInterp = info->consoleInterp;
if (objc < 2) {
@@ -797,7 +793,7 @@ InterpreterObjCmd(
int index, result = TCL_OK;
static const char *const options[] = {"eval", "record", NULL};
enum option {OTHER_EVAL, OTHER_RECORD};
- ConsoleInfo *info = clientData;
+ ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *otherInterp = info->interp;
if (objc < 2) {
@@ -865,7 +861,7 @@ static void
DeleteConsoleInterp(
ClientData clientData)
{
- Tcl_Interp *interp = clientData;
+ Tcl_Interp *interp = (Tcl_Interp *)clientData;
Tcl_DeleteInterp(interp);
}
@@ -892,13 +888,13 @@ InterpDeleteProc(
ClientData clientData,
Tcl_Interp *interp)
{
- ConsoleInfo *info = clientData;
+ ConsoleInfo *info = (ConsoleInfo *)clientData;
if (info->consoleInterp == interp) {
Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp);
info->consoleInterp = NULL;
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -924,12 +920,12 @@ static void
ConsoleDeleteProc(
ClientData clientData)
{
- ConsoleInfo *info = clientData;
+ ConsoleInfo *info = (ConsoleInfo *)clientData;
if (info->consoleInterp) {
Tcl_DeleteInterp(info->consoleInterp);
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
@@ -959,14 +955,14 @@ ConsoleEventProc(
XEvent *eventPtr)
{
if (eventPtr->type == DestroyNotify) {
- ConsoleInfo *info = clientData;
+ ConsoleInfo *info = (ConsoleInfo *)clientData;
Tcl_Interp *consoleInterp = info->consoleInterp;
if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) {
Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL);
}
- if (--info->refCount <= 0) {
+ if (info->refCount-- <= 1) {
ckfree(info);
}
}
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 0994a07..456b86d 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -685,8 +685,8 @@ Tk_CreateEventHandler(
Tk_EventProc *proc, /* Function to call for each selected event */
ClientData clientData) /* Arbitrary data to pass to proc. */
{
- register TkEventHandler *handlerPtr;
- register TkWindow *winPtr = (TkWindow *) token;
+ TkEventHandler *handlerPtr;
+ TkWindow *winPtr = (TkWindow *)token;
/*
* Skim through the list of existing handlers to (a) compute the overall
@@ -701,7 +701,7 @@ Tk_CreateEventHandler(
* No event handlers defined at all, so must create.
*/
- handlerPtr = ckalloc(sizeof(TkEventHandler));
+ handlerPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler));
winPtr->handlerList = handlerPtr;
} else {
int found = 0;
@@ -732,7 +732,7 @@ Tk_CreateEventHandler(
* No event handler matched, so create a new one.
*/
- handlerPtr->nextPtr = ckalloc(sizeof(TkEventHandler));
+ handlerPtr->nextPtr = (TkEventHandler *)ckalloc(sizeof(TkEventHandler));
handlerPtr = handlerPtr->nextPtr;
}
@@ -775,11 +775,11 @@ Tk_DeleteEventHandler(
Tk_EventProc *proc,
ClientData clientData)
{
- register TkEventHandler *handlerPtr;
- register InProgress *ipPtr;
+ TkEventHandler *handlerPtr;
+ InProgress *ipPtr;
TkEventHandler *prevPtr;
- register TkWindow *winPtr = (TkWindow *) token;
- ThreadSpecificData *tsdPtr =
+ TkWindow *winPtr = (TkWindow *) token;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -851,10 +851,10 @@ Tk_CreateGenericHandler(
ClientData clientData) /* One-word value to pass to proc. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- handlerPtr = ckalloc(sizeof(GenericHandler));
+ handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler));
handlerPtr->proc = proc;
handlerPtr->clientData = clientData;
@@ -892,7 +892,7 @@ Tk_DeleteGenericHandler(
ClientData clientData)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (handler=tsdPtr->genericList ; handler ; handler=handler->nextPtr) {
@@ -925,7 +925,7 @@ Tk_CreateClientMessageHandler(
Tk_ClientMessageProc *proc) /* Function to call on event. */
{
GenericHandler *handlerPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -933,7 +933,7 @@ Tk_CreateClientMessageHandler(
* with an extra clientData field we'll never use.
*/
- handlerPtr = ckalloc(sizeof(GenericHandler));
+ handlerPtr = (GenericHandler *)ckalloc(sizeof(GenericHandler));
handlerPtr->proc = (Tk_GenericProc *) proc;
handlerPtr->clientData = NULL; /* never used */
@@ -971,7 +971,7 @@ Tk_DeleteClientMessageHandler(
Tk_ClientMessageProc *proc)
{
GenericHandler * handler;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (handler=tsdPtr->cmList ; handler!=NULL ; handler=handler->nextPtr) {
@@ -1002,7 +1002,7 @@ Tk_DeleteClientMessageHandler(
void
TkEventInit(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->handlersActive = 0;
@@ -1035,9 +1035,9 @@ TkEventInit(void)
static int
TkXErrorHandler(
ClientData clientData, /* Pointer to flag we set. */
- XErrorEvent *errEventPtr) /* X error info. */
+ TCL_UNUSED(XErrorEvent *)) /* X error info. */
{
- int *error = clientData;
+ int *error = (int *)clientData;
*error = 1;
return 0;
@@ -1124,12 +1124,12 @@ void
Tk_HandleEvent(
XEvent *eventPtr) /* Event to dispatch. */
{
- register TkEventHandler *handlerPtr;
+ TkEventHandler *handlerPtr;
TkWindow *winPtr;
unsigned long mask;
InProgress ip;
Tcl_Interp *interp = NULL;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
#if !defined(MAC_OSX_TK) && !defined(_WIN32)
@@ -1337,9 +1337,9 @@ TkEventDeadWindow(
TkWindow *winPtr) /* Information about the window that is being
* deleted. */
{
- register TkEventHandler *handlerPtr;
- register InProgress *ipPtr;
- ThreadSpecificData *tsdPtr =
+ TkEventHandler *handlerPtr;
+ InProgress *ipPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1387,8 +1387,8 @@ Time
TkCurrentTime(
TkDisplay *dispPtr) /* Display for which the time is desired. */
{
- register XEvent *eventPtr;
- ThreadSpecificData *tsdPtr =
+ XEvent *eventPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->pendingPtr == NULL) {
@@ -1442,7 +1442,7 @@ Tk_RestrictEvents(
* argument. */
{
Tk_RestrictProc *prev;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
prev = tsdPtr->restrictProc;
@@ -1535,7 +1535,7 @@ Tk_QueueWindowEvent(
*/
if (!(dispPtr->flags & TK_DISPLAY_COLLAPSE_MOTION_EVENTS)) {
- wevPtr = ckalloc(sizeof(TkWindowEvent));
+ wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
Tcl_QueueEvent(&wevPtr->header, position);
@@ -1567,7 +1567,7 @@ Tk_QueueWindowEvent(
}
}
- wevPtr = ckalloc(sizeof(TkWindowEvent));
+ wevPtr = (TkWindowEvent *)ckalloc(sizeof(TkWindowEvent));
wevPtr->header.proc = WindowEventProc;
wevPtr->event = *eventPtr;
if ((eventPtr->type == MotionNotify) && (position == TCL_QUEUE_TAIL)) {
@@ -1698,7 +1698,7 @@ WindowEventProc(
{
TkWindowEvent *wevPtr = (TkWindowEvent *) evPtr;
Tk_RestrictAction result;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (!(flags & TCL_WINDOW_EVENTS)) {
@@ -1799,7 +1799,7 @@ DelayedMotionProc(
ClientData clientData) /* Pointer to display containing a delayed
* motion event to be serviced. */
{
- TkDisplay *dispPtr = clientData;
+ TkDisplay *dispPtr = (TkDisplay *)clientData;
if (dispPtr->delayedMotionPtr == NULL) {
Tcl_Panic("DelayedMotionProc found no delayed mouse motion event");
@@ -1831,7 +1831,7 @@ TkCreateExitHandler(
{
ExitHandler *exitPtr;
- exitPtr = ckalloc(sizeof(ExitHandler));
+ exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
Tcl_MutexLock(&exitMutex);
@@ -1927,10 +1927,10 @@ TkCreateThreadExitHandler(
ClientData clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- exitPtr = ckalloc(sizeof(ExitHandler));
+ exitPtr = (ExitHandler *)ckalloc(sizeof(ExitHandler));
exitPtr->proc = proc;
exitPtr->clientData = clientData;
@@ -1968,7 +1968,7 @@ TkDeleteThreadExitHandler(
ClientData clientData) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr, *prevPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (prevPtr = NULL, exitPtr = tsdPtr->firstExitPtr; exitPtr != NULL;
@@ -2007,7 +2007,7 @@ TkDeleteThreadExitHandler(
void
TkFinalize(
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
@@ -2059,10 +2059,10 @@ TkFinalize(
void
TkFinalizeThread(
- ClientData clientData) /* Arbitrary value to pass to proc. */
+ TCL_UNUSED(void *)) /* Arbitrary value to pass to proc. */
{
ExitHandler *exitPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteThreadExitHandler(TkFinalizeThread, NULL);
diff --git a/generic/tkFont.c b/generic/tkFont.c
index 0b858fc..3aed702 100644
--- a/generic/tkFont.c
+++ b/generic/tkFont.c
@@ -96,7 +96,7 @@ typedef struct TextLayout {
* layout. */
int numChunks; /* Number of chunks actually used in following
* array. */
- LayoutChunk chunks[1]; /* Array of chunks. The actual size will be
+ LayoutChunk chunks[TKFLEXARRAY];/* Array of chunks. The actual size will be
* maxChunks. THIS FIELD MUST BE THE LAST IN
* THE STRUCTURE. */
} TextLayout;
@@ -380,7 +380,7 @@ void
TkFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
- TkFontInfo *fiPtr = ckalloc(sizeof(TkFontInfo));
+ TkFontInfo *fiPtr = (TkFontInfo *)ckalloc(sizeof(TkFontInfo));
Tcl_InitHashTable(&fiPtr->fontCache, TCL_STRING_KEYS);
Tcl_InitHashTable(&fiPtr->namedTable, TCL_STRING_KEYS);
@@ -473,7 +473,7 @@ Tk_FontObjCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
int index;
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
TkFontInfo *fiPtr = ((TkWindow *) tkwin)->mainPtr->fontInfoPtr;
static const char *const optionStrings[] = {
"actual", "configure", "create", "delete",
@@ -617,9 +617,9 @@ Tk_FontObjCmd(
}
string = Tcl_GetString(objv[2]);
namedHashPtr = Tcl_FindHashEntry(&fiPtr->namedTable, string);
- nfPtr = NULL; /* lint. */
+ nfPtr = NULL;
if (namedHashPtr != NULL) {
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
}
if ((namedHashPtr == NULL) || nfPtr->deletePending) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -797,10 +797,10 @@ Tk_FontObjCmd(
resultPtr = Tcl_NewObj();
namedHashPtr = Tcl_FirstHashEntry(&fiPtr->namedTable, &search);
while (namedHashPtr != NULL) {
- NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr);
+ NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (!nfPtr->deletePending) {
- char *string = Tcl_GetHashKey(&fiPtr->namedTable,
+ char *string = (char *)Tcl_GetHashKey(&fiPtr->namedTable,
namedHashPtr);
Tcl_ListObjAppendElement(NULL, resultPtr,
@@ -843,7 +843,7 @@ UpdateDependentFonts(
Tcl_HashEntry *cacheHashPtr;
Tcl_HashSearch search;
TkFont *fontPtr;
- NamedFont *nfPtr = Tcl_GetHashValue(namedHashPtr);
+ NamedFont *nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount == 0) {
/*
@@ -856,7 +856,7 @@ UpdateDependentFonts(
cacheHashPtr = Tcl_FirstHashEntry(&fiPtr->fontCache, &search);
while (cacheHashPtr != NULL) {
- for (fontPtr = Tcl_GetHashValue(cacheHashPtr);
+ for (fontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr);
fontPtr != NULL; fontPtr = fontPtr->nextPtr) {
if (fontPtr->namedHashPtr == namedHashPtr) {
TkpGetFontFromAttributes(fontPtr, tkwin, &nfPtr->fa);
@@ -874,7 +874,7 @@ static void
TheWorldHasChanged(
ClientData clientData) /* Info about application's fonts. */
{
- TkFontInfo *fiPtr = clientData;
+ TkFontInfo *fiPtr = (TkFontInfo *)clientData;
/*
* On macOS it is catastrophic to recompute all widgets while the
@@ -964,7 +964,7 @@ TkCreateNamedFont(
namedHashPtr = Tcl_CreateHashEntry(&fiPtr->namedTable, name, &isNew);
if (!isNew) {
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (!nfPtr->deletePending) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -986,7 +986,7 @@ TkCreateNamedFont(
return TCL_OK;
}
- nfPtr = ckalloc(sizeof(NamedFont));
+ nfPtr = (NamedFont *)ckalloc(sizeof(NamedFont));
nfPtr->deletePending = 0;
Tcl_SetHashValue(namedHashPtr, nfPtr);
nfPtr->fa = *faPtr;
@@ -1025,7 +1025,7 @@ TkDeleteNamedFont(
}
return TCL_ERROR;
}
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
if (nfPtr->refCount != 0) {
nfPtr->deletePending = 1;
} else {
@@ -1114,7 +1114,7 @@ Tk_AllocFontFromObj(
SetFontFromAny(interp, objPtr);
}
- oldFontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ oldFontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (oldFontPtr != NULL) {
if (oldFontPtr->resourceRefCount == 0) {
/*
@@ -1143,7 +1143,7 @@ Tk_AllocFontFromObj(
cacheHashPtr = Tcl_CreateHashEntry(&fiPtr->fontCache,
Tcl_GetString(objPtr), &isNew);
}
- firstFontPtr = Tcl_GetHashValue(cacheHashPtr);
+ firstFontPtr = (TkFont *)Tcl_GetHashValue(cacheHashPtr);
for (fontPtr = firstFontPtr; (fontPtr != NULL);
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
@@ -1166,7 +1166,7 @@ Tk_AllocFontFromObj(
* Construct a font based on a named font.
*/
- nfPtr = Tcl_GetHashValue(namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(namedHashPtr);
nfPtr->refCount++;
fontPtr = TkpGetFontFromAttributes(NULL, tkwin, &nfPtr->fa);
@@ -1299,7 +1299,7 @@ Tk_GetFontFromObj(
SetFontFromAny(NULL, objPtr);
}
- fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
if (fontPtr->resourceRefCount == 0) {
/*
@@ -1326,7 +1326,7 @@ Tk_GetFontFromObj(
hashPtr = Tcl_FindHashEntry(&fiPtr->fontCache, Tcl_GetString(objPtr));
}
if (hashPtr != NULL) {
- for (fontPtr = Tcl_GetHashValue(hashPtr); fontPtr != NULL;
+ for (fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr); fontPtr != NULL;
fontPtr = fontPtr->nextPtr) {
if (Tk_Screen(tkwin) == fontPtr->screen) {
fontPtr->objRefCount++;
@@ -1361,7 +1361,7 @@ Tk_GetFontFromObj(
static int
SetFontFromAny(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
+ TCL_UNUSED(Tcl_Interp *), /* Used for error reporting if not NULL. */
Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
@@ -1437,8 +1437,7 @@ Tk_FreeFont(
if (fontPtr == NULL) {
return;
}
- fontPtr->resourceRefCount--;
- if (fontPtr->resourceRefCount > 0) {
+ if (fontPtr->resourceRefCount-- > 1) {
return;
}
if (fontPtr->namedHashPtr != NULL) {
@@ -1447,7 +1446,7 @@ Tk_FreeFont(
* the named font and free it if no-one else is using it.
*/
- nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr);
+ nfPtr = (NamedFont *)Tcl_GetHashValue(fontPtr->namedHashPtr);
nfPtr->refCount--;
if ((nfPtr->refCount == 0) && nfPtr->deletePending) {
Tcl_DeleteHashEntry(fontPtr->namedHashPtr);
@@ -1455,7 +1454,7 @@ Tk_FreeFont(
}
}
- prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr);
+ prevPtr = (TkFont *)Tcl_GetHashValue(fontPtr->cacheHashPtr);
if (prevPtr == fontPtr) {
if (fontPtr->nextPtr == NULL) {
Tcl_DeleteHashEntry(fontPtr->cacheHashPtr);
@@ -1533,7 +1532,7 @@ static void
FreeFontObj(
Tcl_Obj *objPtr) /* The object we are releasing. */
{
- TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = (TkFont *)objPtr->internalRep.twoPtrValue.ptr1;
if (fontPtr != NULL) {
fontPtr->objRefCount--;
@@ -1568,7 +1567,7 @@ DupFontObjProc(
Tcl_Obj *srcObjPtr, /* The object we are copying from. */
Tcl_Obj *dupObjPtr) /* The object we are copying to. */
{
- TkFont *fontPtr = srcObjPtr->internalRep.twoPtrValue.ptr1;
+ TkFont *fontPtr = (TkFont *)srcObjPtr->internalRep.twoPtrValue.ptr1;
dupObjPtr->typePtr = srcObjPtr->typePtr;
dupObjPtr->internalRep.twoPtrValue.ptr1 = fontPtr;
@@ -2007,8 +2006,8 @@ Tk_ComputeTextLayout(
maxChunks = 1;
- layoutPtr = ckalloc(sizeof(TextLayout)
- + (maxChunks-1) * sizeof(LayoutChunk));
+ layoutPtr = (TextLayout *)ckalloc(Tk_Offset(TextLayout, chunks)
+ + maxChunks * sizeof(LayoutChunk));
layoutPtr->tkfont = tkfont;
layoutPtr->string = string;
layoutPtr->numChunks = 0;
@@ -3405,7 +3404,7 @@ noMapping: ;
static int
ConfigAttributesObj(
Tcl_Interp *interp, /* Interp for error return. */
- Tk_Window tkwin, /* For display on which font will be used. */
+ TCL_UNUSED(Tk_Window), /* For display on which font will be used. */
int objc, /* Number of elements in argv. */
Tcl_Obj *const objv[], /* Command line options. */
TkFontAttributes *faPtr) /* Font attributes structure whose fields are
@@ -3780,7 +3779,7 @@ NewChunk(
maxChunks = *maxPtr;
if (layoutPtr->numChunks == maxChunks) {
maxChunks *= 2;
- s = sizeof(TextLayout) + ((maxChunks - 1) * sizeof(LayoutChunk));
+ s = Tk_Offset(TextLayout, chunks) + (maxChunks * sizeof(LayoutChunk));
layoutPtr = ckrealloc(layoutPtr, s);
*layoutPtrPtr = layoutPtr;
@@ -4244,7 +4243,7 @@ TkDebugFont(
hashPtr = Tcl_FindHashEntry(
&((TkWindow *) tkwin)->mainPtr->fontInfoPtr->fontCache, name);
if (hashPtr != NULL) {
- fontPtr = Tcl_GetHashValue(hashPtr);
+ fontPtr = (TkFont *)Tcl_GetHashValue(hashPtr);
if (fontPtr == NULL) {
Tcl_Panic("TkDebugFont found empty hash table entry");
}
@@ -4297,7 +4296,7 @@ TkFontGetFirstTextLayout(
}
chunkPtr = layoutPtr->chunks;
numBytesInChunk = chunkPtr->numBytes;
- strncpy(dst, chunkPtr->start, (size_t) numBytesInChunk);
+ strncpy(dst, chunkPtr->start, numBytesInChunk);
*font = layoutPtr->tkfont;
return numBytesInChunk;
}
diff --git a/generic/tkGet.c b/generic/tkGet.c
index 6eff3a3..f2aed2c 100644
--- a/generic/tkGet.c
+++ b/generic/tkGet.c
@@ -493,10 +493,10 @@ Tk_NameOfJustify(
static void
FreeUidThreadExitProc(
- ClientData clientData) /* Not used. */
+ TCL_UNUSED(void *))
{
- ThreadSpecificData *tsdPtr =
- Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
+ Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DeleteHashTable(&tsdPtr->uidTable);
tsdPtr->initialized = 0;
@@ -529,7 +529,7 @@ Tk_GetUid(
const char *string) /* String to convert. */
{
int dummy;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashTable *tablePtr = &tsdPtr->uidTable;
diff --git a/generic/tkGrab.c b/generic/tkGrab.c
index 2855637..a1ff46c 100644
--- a/generic/tkGrab.c
+++ b/generic/tkGrab.c
@@ -166,7 +166,6 @@ static void ReleaseButtonGrab(TkDisplay *dispPtr);
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
int
Tk_GrabObjCmd(
ClientData clientData, /* Main window associated with interpreter. */
@@ -223,7 +222,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, arg, clientData);
+ tkwin = Tk_NameToWindow(interp, arg, (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -239,7 +238,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "?-global? window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -265,7 +264,7 @@ Tk_GrabObjCmd(
}
if (objc == 3) {
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
if (tkwin == NULL) {
return TCL_ERROR;
}
@@ -294,7 +293,7 @@ Tk_GrabObjCmd(
Tcl_WrongNumArgs(interp, 1, objv, "release window");
return TCL_ERROR;
}
- tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), clientData);
+ tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]), (Tk_Window)clientData);
if (tkwin == NULL) {
Tcl_ResetResult(interp);
} else {
@@ -311,7 +310,7 @@ Tk_GrabObjCmd(
if (objc == 3) {
globalGrab = 0;
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
} else {
globalGrab = 1;
@@ -327,7 +326,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[3]),
- clientData);
+ (Tk_Window)clientData);
}
if (tkwin == NULL) {
return TCL_ERROR;
@@ -344,7 +343,7 @@ Tk_GrabObjCmd(
return TCL_ERROR;
}
winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]),
- clientData);
+ (Tk_Window)clientData);
if (winPtr == NULL) {
return TCL_ERROR;
}
@@ -638,7 +637,7 @@ Tk_Ungrab(
static void
ReleaseButtonGrab(
- register TkDisplay *dispPtr)/* Display whose button grab is to be
+ TkDisplay *dispPtr)/* Display whose button grab is to be
* released. */
{
unsigned int serial;
@@ -684,11 +683,11 @@ ReleaseButtonGrab(
int
TkPointerEvent(
- register XEvent *eventPtr, /* Pointer to the event. */
+ XEvent *eventPtr, /* Pointer to the event. */
TkWindow *winPtr) /* Tk's information for window where event was
* reported. */
{
- register TkWindow *winPtr2;
+ TkWindow *winPtr2;
TkDisplay *dispPtr = winPtr->dispPtr;
unsigned int serial;
int outsideGrabTree = 0;
@@ -872,7 +871,7 @@ TkPointerEvent(
} else {
if (eventPtr->xbutton.button != AnyButton &&
((eventPtr->xbutton.state & ALL_BUTTONS)
- == (unsigned int)TkGetButtonMask(eventPtr->xbutton.button))) {
+ == TkGetButtonMask(eventPtr->xbutton.button))) {
ReleaseButtonGrab(dispPtr); /* Note 4. */
}
}
@@ -907,14 +906,14 @@ TkPointerEvent(
void
TkChangeEventWindow(
- register XEvent *eventPtr, /* Event to retarget. Must have type
+ XEvent *eventPtr, /* Event to retarget. Must have type
* ButtonPress, ButtonRelease, KeyPress,
* KeyRelease, MotionNotify, EnterNotify, or
* LeaveNotify. */
TkWindow *winPtr) /* New target window for event. */
{
int x, y, sameScreen, bd;
- register TkWindow *childPtr;
+ TkWindow *childPtr;
eventPtr->xmotion.window = Tk_WindowId(winPtr);
if (eventPtr->xmotion.root ==
@@ -995,7 +994,7 @@ TkInOutEvents(
Tcl_QueuePosition position) /* Position at which events are added to the
* system event queue. */
{
- register TkWindow *winPtr;
+ TkWindow *winPtr;
int upLevels, downLevels, i, j, focus;
/*
@@ -1188,7 +1187,7 @@ MovePointer2(
void
TkGrabDeadWindow(
- register TkWindow *winPtr) /* Window that is in the process of being
+ TkWindow *winPtr) /* Window that is in the process of being
* deleted. */
{
TkDisplay *dispPtr = winPtr->dispPtr;
@@ -1278,7 +1277,7 @@ GrabRestrictProc(
ClientData arg,
XEvent *eventPtr)
{
- GrabInfo *info = arg;
+ GrabInfo *info = (GrabInfo *)arg;
int mode, diff;
/*
@@ -1336,7 +1335,7 @@ QueueGrabWindowChange(
{
NewGrabWinEvent *grabEvPtr;
- grabEvPtr = ckalloc(sizeof(NewGrabWinEvent));
+ grabEvPtr = (NewGrabWinEvent *)ckalloc(sizeof(NewGrabWinEvent));
grabEvPtr->header.proc = GrabWinEventProc;
grabEvPtr->dispPtr = dispPtr;
if (grabWinPtr == NULL) {
@@ -1371,7 +1370,7 @@ QueueGrabWindowChange(
static int
GrabWinEventProc(
Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */
- int flags) /* Flags argument to Tcl_DoOneEvent: indicates
+ TCL_UNUSED(int)) /* Flags argument to Tcl_DoOneEvent: indicates
* what kinds of events are being processed
* right now. */
{
@@ -1416,7 +1415,7 @@ FindCommonAncestor(
int *countPtr2) /* Store nesting level of winPtr2 within
* common ancestor here. */
{
- register TkWindow *winPtr;
+ TkWindow *winPtr;
TkWindow *ancestorPtr;
int count1, count2, i;
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index c6ab05d..04027b0 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -1083,7 +1083,7 @@ GetByte(
int size;
size = Tcl_Read(chan, &buffer, 1);
- if (size <= 0) {
+ if (size != 1) {
return EOF;
} else {
return buffer;
diff --git a/generic/tkImgPNG.c b/generic/tkImgPNG.c
index c6f2dcb..07b4f8b 100644
--- a/generic/tkImgPNG.c
+++ b/generic/tkImgPNG.c
@@ -626,7 +626,7 @@ ReadData(
int blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ);
blockSz = Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz);
- if (blockSz < 0) {
+ if (blockSz == -1) {
/* TODO: failure info... */
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"channel read failed: %s", Tcl_PosixError(interp)));
@@ -2884,7 +2884,7 @@ WriteData(
}
memcpy(destPtr+objSz, srcPtr, srcSz);
- } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) < 0) {
+ } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == -1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write to channel failed: %s", Tcl_PosixError(interp)));
return TCL_ERROR;
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c
index 6f084f0..89d4387 100644
--- a/generic/tkImgPPM.c
+++ b/generic/tkImgPPM.c
@@ -323,8 +323,8 @@ FileWritePPM(
pixelPtr = pixLinePtr;
for (w = blockPtr->width; w > 0; w--) {
if ( Tcl_Write(chan,(char *)&pixelPtr[0], 1) == -1 ||
- Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1)==-1 ||
- Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) ==-1) {
+ Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == -1 ||
+ Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == -1) {
goto writeerror;
}
pixelPtr += blockPtr->pixelSize;
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 530638a..3b1e559 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -84,6 +84,11 @@
# endif
#endif
+#if defined(__GNUC__) && (__GNUC__ > 2)
+# define TKFLEXARRAY 0
+#else
+# define TKFLEXARRAY 1
+#endif
#ifndef Tcl_GetParent
# define Tcl_GetParent Tcl_GetMaster
@@ -358,14 +363,14 @@ typedef struct TkDisplay {
*/
Tcl_HashTable maintainHashTable;
- /* Hash table that maps from a master's
- * Tk_Window token to a list of slaves managed
- * by that master. */
+ /* Hash table that maps from a container's
+ * Tk_Window token to a list of windows managed
+ * by that container. */
int geomInit;
#define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \
((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr)
-#define TkGetGeomContainer TkGetGeomMaster
+#define TkGetContainer TkGetGeomMaster
/*
* Information used by tkGet.c only:
diff --git a/generic/tkIntPlatDecls.h b/generic/tkIntPlatDecls.h
index a785392..e9b3a65 100644
--- a/generic/tkIntPlatDecls.h
+++ b/generic/tkIntPlatDecls.h
@@ -794,7 +794,7 @@ extern const TkIntPlatStubs *tkIntPlatStubsPtr;
#undef TkpTestsendCmd_
#undef TkGenerateActivateEvents_
-#define TkGetTransientContainer TkGetTransientMaster
+#define TkMacOSXGetContainer TkGetTransientMaster
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLIMPORT
diff --git a/generic/tkMain.c b/generic/tkMain.c
index c6c9835..32006b3 100644
--- a/generic/tkMain.c
+++ b/generic/tkMain.c
@@ -40,6 +40,9 @@ static const char DEFAULT_PRIMARY_PROMPT[] = "% ";
* to strcmp here.
*/
#ifdef _WIN32
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Little hack to eliminate the need for "tclInt.h" here:
Just copy a small portion of TclIntPlatStubs, just
enough to make it work. See [600b72bfbc] */
@@ -50,6 +53,9 @@ typedef struct {
int (*tclpIsAtty) (int fd); /* 16 */
} TclIntPlatStubs;
extern const TclIntPlatStubs *tclIntPlatStubsPtr;
+#ifdef __cplusplus
+}
+#endif
# include "tkWinInt.h"
#else
# define TCHAR char
@@ -417,7 +423,7 @@ StdinProc(
count = Tcl_Gets(chan, &isPtr->line);
- if (count == -1 && !isPtr->gotPartial) {
+ if ((count == -1) && !isPtr->gotPartial) {
if (isPtr->tty) {
Tcl_Exit(0);
} else {
diff --git a/generic/tkObj.c b/generic/tkObj.c
index 559f0e2..716c7e1 100644
--- a/generic/tkObj.c
+++ b/generic/tkObj.c
@@ -149,7 +149,7 @@ static const Tcl_ObjType windowObjType = {
static ThreadSpecificData *
GetTypeCache(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->doubleTypePtr == NULL) {
@@ -408,8 +408,8 @@ FreePixelInternalRep(
static void
DupPixelInternalRep(
- register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
+ Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
copyPtr->typePtr = srcPtr->typePtr;
@@ -419,7 +419,7 @@ DupPixelInternalRep(
PixelRep *oldPtr, *newPtr;
oldPtr = GET_COMPLEXPIXEL(srcPtr);
- newPtr = ckalloc(sizeof(PixelRep));
+ newPtr = (PixelRep *)ckalloc(sizeof(PixelRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -503,7 +503,7 @@ SetPixelFromAny(
if ((units < 0) && (i == d)) {
SET_SIMPLEPIXEL(objPtr, i);
} else {
- PixelRep *pixelPtr = ckalloc(sizeof(PixelRep));
+ PixelRep *pixelPtr = (PixelRep *)ckalloc(sizeof(PixelRep));
pixelPtr->value = d;
pixelPtr->units = units;
@@ -564,7 +564,7 @@ Tk_GetMMFromObj(
}
}
- mmPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1;
if (mmPtr->tkwin != tkwin) {
d = mmPtr->value;
if (mmPtr->units == -1) {
@@ -628,14 +628,14 @@ FreeMMInternalRep(
static void
DupMMInternalRep(
- register Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
- register Tcl_Obj *copyPtr) /* Object with internal rep to set. */
+ Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
+ Tcl_Obj *copyPtr) /* Object with internal rep to set. */
{
MMRep *oldPtr, *newPtr;
copyPtr->typePtr = srcPtr->typePtr;
- oldPtr = srcPtr->internalRep.twoPtrValue.ptr1;
- newPtr = ckalloc(sizeof(MMRep));
+ oldPtr = (MMRep *)srcPtr->internalRep.twoPtrValue.ptr1;
+ newPtr = (MMRep *)ckalloc(sizeof(MMRep));
newPtr->value = oldPtr->value;
newPtr->units = oldPtr->units;
newPtr->tkwin = oldPtr->tkwin;
@@ -664,13 +664,13 @@ DupMMInternalRep(
static void
UpdateStringOfMM(
- register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
+ Tcl_Obj *objPtr) /* pixel obj with string rep to update. */
{
MMRep *mmPtr;
char buffer[TCL_DOUBLE_SPACE];
size_t len;
- mmPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ mmPtr = (MMRep *)objPtr->internalRep.twoPtrValue.ptr1;
/* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */
if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) {
Tcl_Panic("UpdateStringOfMM: false precondition");
@@ -679,7 +679,7 @@ UpdateStringOfMM(
Tcl_PrintDouble(NULL, mmPtr->value, buffer);
len = strlen(buffer);
- objPtr->bytes = ckalloc(len + 1);
+ objPtr->bytes = (char *)ckalloc(len + 1);
strcpy(objPtr->bytes, buffer);
objPtr->length = len;
}
@@ -787,7 +787,7 @@ SetMMFromAny(
objPtr->typePtr = &mmObjType;
- mmPtr = ckalloc(sizeof(MMRep));
+ mmPtr = (MMRep *)ckalloc(sizeof(MMRep));
mmPtr->value = d;
mmPtr->units = units;
mmPtr->tkwin = NULL;
@@ -827,7 +827,7 @@ TkGetWindowFromObj(
Tk_Window *windowPtr) /* Place to store resulting window. */
{
TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
- register WindowRep *winPtr;
+ WindowRep *winPtr;
if (objPtr->typePtr != &windowObjType) {
int result = SetWindowFromAny(interp, objPtr);
@@ -836,7 +836,7 @@ TkGetWindowFromObj(
}
}
- winPtr = objPtr->internalRep.twoPtrValue.ptr1;
+ winPtr = (WindowRep *)objPtr->internalRep.twoPtrValue.ptr1;
if (winPtr->tkwin == NULL
|| winPtr->mainPtr == NULL
|| winPtr->mainPtr != mainPtr
@@ -882,8 +882,8 @@ TkGetWindowFromObj(
static int
SetWindowFromAny(
- Tcl_Interp *interp, /* Used for error reporting if not NULL. */
- register Tcl_Obj *objPtr) /* The object to convert. */
+ TCL_UNUSED(Tcl_Interp *),
+ Tcl_Obj *objPtr) /* The object to convert. */
{
const Tcl_ObjType *typePtr;
WindowRep *winPtr;
@@ -898,7 +898,7 @@ SetWindowFromAny(
typePtr->freeIntRepProc(objPtr);
}
- winPtr = ckalloc(sizeof(WindowRep));
+ winPtr = (WindowRep *)ckalloc(sizeof(WindowRep));
winPtr->tkwin = NULL;
winPtr->mainPtr = NULL;
winPtr->epoch = 0;
@@ -993,7 +993,7 @@ TkNewWindowObj(
{
Tcl_Obj *objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1);
TkMainInfo *mainPtr = ((TkWindow *) tkwin)->mainPtr;
- register WindowRep *winPtr;
+ WindowRep *winPtr;
SetWindowFromAny(NULL, objPtr);
diff --git a/generic/tkOldConfig.c b/generic/tkOldConfig.c
index d05a2c7..d01da95 100644
--- a/generic/tkOldConfig.c
+++ b/generic/tkOldConfig.c
@@ -82,7 +82,7 @@ Tk_ConfigureWidget(
* considered. Also, may have
* TK_CONFIG_ARGV_ONLY set. */
{
- register Tk_ConfigSpec *specPtr, *staticSpecs;
+ Tk_ConfigSpec *specPtr, *staticSpecs;
Tk_Uid value; /* Value of option from database. */
int needFlags; /* Specs must contain this set of flags or
* else they are not considered. */
@@ -245,8 +245,8 @@ FindConfigSpec(
int hateFlags) /* Flags that must NOT be present in matching
* entry. */
{
- register Tk_ConfigSpec *specPtr;
- register char c; /* First character of current argument. */
+ Tk_ConfigSpec *specPtr;
+ char c; /* First character of current argument. */
Tk_ConfigSpec *matchPtr; /* Matching spec, or NULL. */
size_t length;
@@ -376,7 +376,7 @@ DoConfig(
if (nullValue) {
newStr = NULL;
} else {
- newStr = ckalloc(strlen(value) + 1);
+ newStr = (char *)ckalloc(strlen(value) + 1);
strcpy(newStr, value);
}
oldStr = *((char **) ptr);
@@ -603,7 +603,7 @@ Tk_ConfigureInfo(
* be present in config specs for them to be
* considered. */
{
- register Tk_ConfigSpec *specPtr, *staticSpecs;
+ Tk_ConfigSpec *specPtr, *staticSpecs;
int needFlags, hateFlags;
char *list;
const char *leader = "{";
@@ -686,7 +686,7 @@ FormatConfigInfo(
Tcl_Interp *interp, /* Interpreter to use for things like
* floating-point precision. */
Tk_Window tkwin, /* Window corresponding to widget. */
- register const Tk_ConfigSpec *specPtr,
+ const Tk_ConfigSpec *specPtr,
/* Pointer to information describing
* option. */
char *widgRec) /* Pointer to record holding current values of
@@ -971,7 +971,6 @@ Tk_ConfigureValue(
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
void
Tk_FreeOptions(
const Tk_ConfigSpec *specs, /* Describes legal options. */
@@ -983,7 +982,7 @@ Tk_FreeOptions(
* be present in config specs for them to be
* considered. */
{
- register const Tk_ConfigSpec *specPtr;
+ const Tk_ConfigSpec *specPtr;
char *ptr;
for (specPtr = specs; specPtr->type != TK_CONFIG_END; specPtr++) {
@@ -1071,10 +1070,10 @@ GetCachedSpecs(
* self-initializing code.
*/
- specCacheTablePtr =
+ specCacheTablePtr = (Tcl_HashTable *)
Tcl_GetAssocData(interp, "tkConfigSpec.threadTable", NULL);
if (specCacheTablePtr == NULL) {
- specCacheTablePtr = ckalloc(sizeof(Tcl_HashTable));
+ specCacheTablePtr = (Tcl_HashTable *)ckalloc(sizeof(Tcl_HashTable));
Tcl_InitHashTable(specCacheTablePtr, TCL_ONE_WORD_KEYS);
Tcl_SetAssocData(interp, "tkConfigSpec.threadTable",
DeleteSpecCacheTable, specCacheTablePtr);
@@ -1088,7 +1087,7 @@ GetCachedSpecs(
entryPtr = Tcl_CreateHashEntry(specCacheTablePtr, (char *) staticSpecs,
&isNew);
if (isNew) {
- unsigned int entrySpace = sizeof(Tk_ConfigSpec);
+ size_t entrySpace = sizeof(Tk_ConfigSpec);
const Tk_ConfigSpec *staticSpecPtr;
Tk_ConfigSpec *specPtr;
@@ -1107,7 +1106,7 @@ GetCachedSpecs(
* from the origin.
*/
- cachedSpecs = ckalloc(entrySpace);
+ cachedSpecs = (Tk_ConfigSpec *)ckalloc(entrySpace);
memcpy(cachedSpecs, staticSpecs, entrySpace);
Tcl_SetHashValue(entryPtr, cachedSpecs);
@@ -1131,7 +1130,7 @@ GetCachedSpecs(
}
}
} else {
- cachedSpecs = Tcl_GetHashValue(entryPtr);
+ cachedSpecs = (Tk_ConfigSpec *)Tcl_GetHashValue(entryPtr);
}
return cachedSpecs;
@@ -1157,9 +1156,9 @@ GetCachedSpecs(
static void
DeleteSpecCacheTable(
ClientData clientData,
- Tcl_Interp *interp)
+ TCL_UNUSED(Tcl_Interp *))
{
- Tcl_HashTable *tablePtr = clientData;
+ Tcl_HashTable *tablePtr = (Tcl_HashTable *)clientData;
Tcl_HashEntry *entryPtr;
Tcl_HashSearch search;
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 8aaf805..15fc405 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -254,16 +254,16 @@ Tk_AddOption(
* TK_MAX_PRIO. */
{
TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr;
- register ElArray **arrayPtrPtr;
- register Element *elPtr;
+ ElArray **arrayPtrPtr;
+ Element *elPtr;
Element newEl;
- register const char *p;
+ const char *p;
const char *field;
int count, firstField;
- ptrdiff_t length;
+ size_t length;
#define TMP_SIZE 100
char tmp[TMP_SIZE+1];
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->mainPtr->optionRootPtr == NULL) {
@@ -311,7 +311,7 @@ Tk_AddOption(
if (length > TMP_SIZE) {
length = TMP_SIZE;
}
- strncpy(tmp, field, (size_t) length);
+ strncpy(tmp, field, length);
tmp[length] = 0;
newEl.nameUid = Tk_GetUid(tmp);
if (isupper(UCHAR(*field))) {
@@ -407,11 +407,11 @@ Tk_GetOption(
{
Tk_Uid nameId, classId = NULL;
const char *masqName;
- register Element *elPtr, *bestPtr;
- register int count;
+ Element *elPtr, *bestPtr;
+ int count;
StackLevel *levelPtr;
int stackDepth[NUM_STACKS];
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -521,8 +521,8 @@ Tk_GetOption(
if (masqName != NULL) {
char *masqClass;
Tk_Uid nodeId, winClassId, winNameId;
- unsigned int classNameLength;
- register Element *nodePtr, *leafPtr;
+ size_t classNameLength;
+ Element *nodePtr, *leafPtr;
static const int searchOrder[] = {
EXACT_NODE_NAME, WILDCARD_NODE_NAME, EXACT_NODE_CLASS,
WILDCARD_NODE_CLASS, -1
@@ -534,8 +534,8 @@ Tk_GetOption(
* Extract the masquerade class name from the name field.
*/
- classNameLength = (unsigned) (masqName - name);
- masqClass = ckalloc(classNameLength + 1);
+ classNameLength = (size_t) (masqName - name);
+ masqClass = (char *)ckalloc(classNameLength + 1);
strncpy(masqClass, name, classNameLength);
masqClass[classNameLength] = '\0';
@@ -615,9 +615,9 @@ Tk_OptionObjCmd(
int objc, /* Number of Tcl_Obj arguments. */
Tcl_Obj *const objv[]) /* Tcl_Obj arguments. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
int index, result;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
static const char *const optionCmds[] = {
"add", "clear", "get", "readfile", NULL
@@ -738,9 +738,9 @@ Tk_OptionObjCmd(
void
TkOptionDeadWindow(
- register TkWindow *winPtr) /* Window to be cleaned up. */
+ TkWindow *winPtr) /* Window to be cleaned up. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -796,7 +796,7 @@ TkOptionClassChanged(
{
int i, j, *basePtr;
ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (winPtr->optionLevel == -1) {
@@ -922,7 +922,7 @@ AddFromString(
* TK_INTERACTIVE_PRIO. Must be between 0 and
* TK_MAX_PRIO. */
{
- register char *src, *dst;
+ char *src, *dst;
char *name, *value;
int lineNum;
@@ -1115,7 +1115,7 @@ ReadOptionFile(
Tcl_IncrRefCount(buffer);
Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8");
bufferSize = Tcl_ReadChars(chan, buffer, -1, 0);
- if (bufferSize < 0) {
+ if (bufferSize == -1) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"error reading file \"%s\": %s",
fileName, Tcl_PosixError(interp)));
@@ -1149,7 +1149,7 @@ static ElArray *
NewArray(
int numEls) /* How many elements of space to allocate. */
{
- register ElArray *arrayPtr = ckalloc(EL_ARRAY_SIZE(numEls));
+ ElArray *arrayPtr = (ElArray *)ckalloc(EL_ARRAY_SIZE(numEls));
arrayPtr->arraySize = numEls;
arrayPtr->numUsed = 0;
@@ -1176,17 +1176,17 @@ NewArray(
static ElArray *
ExtendArray(
- register ElArray *arrayPtr, /* Array to be extended. */
- register Element *elPtr) /* Element to be copied into array. */
+ ElArray *arrayPtr, /* Array to be extended. */
+ Element *elPtr) /* Element to be copied into array. */
{
/*
* If the current array has filled up, make it bigger.
*/
if (arrayPtr->numUsed >= arrayPtr->arraySize) {
- register int newSize = 2*arrayPtr->arraySize;
+ int newSize = 2*arrayPtr->arraySize;
- arrayPtr = ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize));
+ arrayPtr = (ElArray *)ckrealloc(arrayPtr, EL_ARRAY_SIZE(newSize));
arrayPtr->arraySize = newSize;
arrayPtr->nextToUse = &arrayPtr->els[arrayPtr->numUsed];
}
@@ -1225,9 +1225,9 @@ SetupStacks(
{
int level, i;
const int *iPtr;
- register StackLevel *levelPtr;
- register ElArray *arrayPtr;
- ThreadSpecificData *tsdPtr =
+ StackLevel *levelPtr;
+ ElArray *arrayPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1304,7 +1304,7 @@ SetupStacks(
*/
if (tsdPtr->curLevel >= tsdPtr->numLevels) {
- StackLevel *newLevels =
+ StackLevel *newLevels = (StackLevel *)
ckalloc(tsdPtr->numLevels * 2 * sizeof(StackLevel));
memcpy(newLevels, tsdPtr->levels,
@@ -1331,7 +1331,7 @@ SetupStacks(
*/
for (iPtr = searchOrder; *iPtr != -1; iPtr++) {
- register Element *elPtr;
+ Element *elPtr;
int count;
Tk_Uid id;
@@ -1386,9 +1386,9 @@ ExtendStacks(
int leaf) /* If zero, then don't copy exact leaf
* elements. */
{
- register int count;
- register Element *elPtr;
- ThreadSpecificData *tsdPtr =
+ int count;
+ Element *elPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
for (elPtr = arrayPtr->els, count = arrayPtr->numUsed;
@@ -1419,9 +1419,9 @@ ExtendStacks(
static void
OptionThreadExitProc(
- ClientData clientData) /* not used */
+ TCL_UNUSED(void *))
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->initialized) {
@@ -1453,13 +1453,13 @@ OptionThreadExitProc(
static void
OptionInit(
- register TkMainInfo *mainPtr)
+ TkMainInfo *mainPtr)
/* Top-level information about window that
* isn't initialized yet. */
{
int i;
Tcl_Interp *interp;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Element *defaultMatchPtr = &tsdPtr->defaultMatch;
@@ -1474,7 +1474,7 @@ OptionInit(
tsdPtr->curLevel = -1;
tsdPtr->serial = 0;
- tsdPtr->levels = ckalloc(5 * sizeof(StackLevel));
+ tsdPtr->levels = (StackLevel *)ckalloc(5 * sizeof(StackLevel));
for (i = 0; i < NUM_STACKS; i++) {
tsdPtr->stacks[i] = NewArray(10);
tsdPtr->levels[0].bases[i] = 0;
@@ -1521,7 +1521,7 @@ ClearOptionTree(
ElArray *arrayPtr) /* Array of options; delete everything
* referred to recursively by this. */
{
- register Element *elPtr;
+ Element *elPtr;
int count;
for (count = arrayPtr->numUsed, elPtr = arrayPtr->els; count > 0;
diff --git a/generic/tkPointer.c b/generic/tkPointer.c
index c17367a..cc67401 100644
--- a/generic/tkPointer.c
+++ b/generic/tkPointer.c
@@ -26,7 +26,7 @@
typedef struct {
TkWindow *grabWinPtr; /* Window that defines the top of the grab
* tree in a global grab. */
- int lastState; /* Last known state flags. */
+ unsigned lastState; /* Last known state flags. */
XPoint lastPos; /* Last reported mouse position. */
TkWindow *lastWinPtr; /* Last reported mouse window. */
TkWindow *restrictWinPtr; /* Window to which all mouse events will be
diff --git a/generic/tkSelect.c b/generic/tkSelect.c
index ef16ff5..9584be4 100644
--- a/generic/tkSelect.c
+++ b/generic/tkSelect.c
@@ -28,7 +28,7 @@ typedef struct {
* chunk. */
char buffer[4]; /* A buffer to hold part of a UTF character
* that is split across chunks. */
- char command[1]; /* Command to invoke. Actual space is
+ char command[TKFLEXARRAY]; /* Command to invoke. Actual space is
* allocated as large as necessary. This must
* be the last entry in the structure. */
} CommandInfo;
@@ -125,7 +125,7 @@ Tk_CreateSelHandler(
* listed in the ICCCM will be tolerated
* (blech). */
{
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
TkWindow *winPtr = (TkWindow *) tkwin;
if (winPtr->dispPtr->multipleAtom == None) {
@@ -139,7 +139,7 @@ Tk_CreateSelHandler(
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = ckalloc(sizeof(TkSelHandler));
+ selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
break;
@@ -177,7 +177,7 @@ Tk_CreateSelHandler(
target = winPtr->dispPtr->utf8Atom;
for (selPtr = winPtr->selHandlerList; ; selPtr = selPtr->nextPtr) {
if (selPtr == NULL) {
- selPtr = ckalloc(sizeof(TkSelHandler));
+ selPtr = (TkSelHandler *)ckalloc(sizeof(TkSelHandler));
selPtr->nextPtr = winPtr->selHandlerList;
winPtr->selHandlerList = selPtr;
selPtr->selection = selection;
@@ -239,9 +239,9 @@ Tk_DeleteSelHandler(
* removed. */
{
TkWindow *winPtr = (TkWindow *) tkwin;
- register TkSelHandler *selPtr, *prevPtr;
- register TkSelInProgress *ipPtr;
- ThreadSpecificData *tsdPtr =
+ TkSelHandler *selPtr, *prevPtr;
+ TkSelInProgress *ipPtr;
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -353,7 +353,7 @@ Tk_OwnSelection(
ClientData clientData) /* Arbitrary one-word argument to pass to
* proc. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
Tk_LostSelProc *clearProc = NULL;
@@ -382,7 +382,7 @@ Tk_OwnSelection(
}
}
if (infoPtr == NULL) {
- infoPtr = ckalloc(sizeof(TkSelectionInfo));
+ infoPtr = (TkSelectionInfo *)ckalloc(sizeof(TkSelectionInfo));
infoPtr->selection = selection;
infoPtr->nextPtr = dispPtr->selectionInfoPtr;
dispPtr->selectionInfoPtr = infoPtr;
@@ -460,7 +460,7 @@ Tk_ClearSelection(
Tk_Window tkwin, /* Window that selects a display. */
Atom selection) /* Selection to be cancelled. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
TkSelectionInfo *prevPtr;
@@ -556,7 +556,7 @@ Tk_GetSelection(
TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (dispPtr->multipleAtom == None) {
@@ -577,7 +577,7 @@ Tk_GetSelection(
}
}
if (infoPtr != NULL) {
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
int offset, result, count;
char buffer[TK_SEL_BYTES_AT_ONCE+1];
TkSelInProgress ip;
@@ -670,7 +670,7 @@ Tk_SelectionObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
const char *path = NULL;
Atom selection;
const char *selName = NULL;
@@ -830,7 +830,7 @@ Tk_SelectionObjCmd(
Atom target, format;
const char *targetName = NULL;
const char *formatName = NULL;
- register CommandInfo *cmdInfoPtr;
+ CommandInfo *cmdInfoPtr;
int cmdLength;
static const char *const handleOptionStrings[] = {
"-format", "-selection", "-type", NULL
@@ -904,7 +904,7 @@ Tk_SelectionObjCmd(
if (cmdLength == 0) {
Tk_DeleteSelHandler(tkwin, selection, target);
} else {
- cmdInfoPtr = ckalloc(Tk_Offset(CommandInfo, command)
+ cmdInfoPtr = (CommandInfo *)ckalloc(Tk_Offset(CommandInfo, command)
+ 1 + cmdLength);
cmdInfoPtr->interp = interp;
cmdInfoPtr->charOffset = 0;
@@ -919,7 +919,7 @@ Tk_SelectionObjCmd(
}
case SELECTION_OWN: {
- register LostCommand *lostPtr;
+ LostCommand *lostPtr;
Tcl_Obj *commandObj = NULL;
static const char *const ownOptionStrings[] = {
"-command", "-displayof", "-selection", NULL
@@ -1008,7 +1008,7 @@ Tk_SelectionObjCmd(
Tk_OwnSelection(tkwin, selection, NULL, NULL);
return TCL_OK;
}
- lostPtr = ckalloc(sizeof(LostCommand));
+ lostPtr = (LostCommand *)ckalloc(sizeof(LostCommand));
lostPtr->interp = interp;
lostPtr->cmdObj = commandObj;
Tcl_IncrRefCount(commandObj);
@@ -1040,7 +1040,7 @@ Tk_SelectionObjCmd(
TkSelInProgress *
TkSelGetInProgress(void)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
return tsdPtr->pendingPtr;
@@ -1067,7 +1067,7 @@ void
TkSelSetInProgress(
TkSelInProgress *pendingPtr)
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
tsdPtr->pendingPtr = pendingPtr;
@@ -1092,12 +1092,12 @@ TkSelSetInProgress(
void
TkSelDeadWindow(
- register TkWindow *winPtr) /* Window that's being deleted. */
+ TkWindow *winPtr) /* Window that's being deleted. */
{
- register TkSelHandler *selPtr;
- register TkSelInProgress *ipPtr;
+ TkSelHandler *selPtr;
+ TkSelInProgress *ipPtr;
TkSelectionInfo *infoPtr, *prevPtr, *nextPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
/*
@@ -1170,7 +1170,7 @@ TkSelInit(
Tk_Window tkwin) /* Window token (used to find display to
* initialize). */
{
- register TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
+ TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr;
/*
* Fetch commonly-used atoms.
@@ -1221,9 +1221,9 @@ TkSelInit(
void
TkSelClearSelection(
Tk_Window tkwin, /* Window for which event was targeted. */
- register XEvent *eventPtr) /* X SelectionClear event. */
+ XEvent *eventPtr) /* X SelectionClear event. */
{
- register TkWindow *winPtr = (TkWindow *) tkwin;
+ TkWindow *winPtr = (TkWindow *) tkwin;
TkDisplay *dispPtr = winPtr->dispPtr;
TkSelectionInfo *infoPtr;
TkSelectionInfo *prevPtr;
@@ -1285,16 +1285,15 @@ TkSelClearSelection(
*--------------------------------------------------------------
*/
- /* ARGSUSED */
static int
SelGetProc(
ClientData clientData, /* Dynamic string holding partially assembled
* selection. */
- Tcl_Interp *interp, /* Interpreter used for error reporting (not
+ TCL_UNUSED(Tcl_Interp *), /* Interpreter used for error reporting (not
* used). */
const char *portion) /* New information to be appended. */
{
- Tcl_DStringAppend(clientData, portion, -1);
+ Tcl_DStringAppend((Tcl_DString *)clientData, portion, -1);
return TCL_OK;
}
@@ -1411,7 +1410,7 @@ HandleTclCommand(
cmdInfoPtr->charOffset += numChars;
length = p - string;
if (length > 0) {
- strncpy(cmdInfoPtr->buffer, string, (size_t) length);
+ strncpy(cmdInfoPtr->buffer, string, length);
}
cmdInfoPtr->buffer[length] = '\0';
}
@@ -1470,7 +1469,7 @@ TkSelDefaultSelection(
Atom *typePtr) /* Store here the type of the selection, for
* use in converting to proper X format. */
{
- register TkWindow *winPtr = (TkWindow *) infoPtr->owner;
+ TkWindow *winPtr = (TkWindow *) infoPtr->owner;
TkDisplay *dispPtr = winPtr->dispPtr;
if (target == dispPtr->timestampAtom) {
@@ -1483,7 +1482,7 @@ TkSelDefaultSelection(
}
if (target == dispPtr->targetsAtom) {
- register TkSelHandler *selPtr;
+ TkSelHandler *selPtr;
int length;
Tcl_DString ds;
@@ -1509,7 +1508,7 @@ TkSelDefaultSelection(
Tcl_DStringFree(&ds);
return -1;
}
- memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) (1+length));
+ memcpy(buffer, Tcl_DStringValue(&ds), length + 1);
Tcl_DStringFree(&ds);
*typePtr = XA_ATOM;
return length;
@@ -1566,7 +1565,7 @@ static void
LostSelection(
ClientData clientData) /* Pointer to LostCommand structure. */
{
- LostCommand *lostPtr = clientData;
+ LostCommand *lostPtr = (LostCommand *)clientData;
Tcl_Interp *interp = lostPtr->interp;
Tcl_InterpState savedState;
int code;
diff --git a/generic/tkStyle.c b/generic/tkStyle.c
index 9cf95d0..1289f14 100644
--- a/generic/tkStyle.c
+++ b/generic/tkStyle.c
@@ -178,9 +178,9 @@ static const Tcl_ObjType styleObjType = {
void
TkStylePkgInit(
- TkMainInfo *mainPtr) /* The application being created. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being created. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
if (tsdPtr->nbInit != 0) {
@@ -233,9 +233,9 @@ TkStylePkgInit(
void
TkStylePkgFree(
- TkMainInfo *mainPtr) /* The application being deleted. */
+ TCL_UNUSED(TkMainInfo *)) /* The application being deleted. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashSearch search;
Tcl_HashEntry *entryPtr;
@@ -264,7 +264,7 @@ TkStylePkgFree(
entryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (entryPtr != NULL) {
- enginePtr = Tcl_GetHashValue(entryPtr);
+ enginePtr = (StyleEngine *)Tcl_GetHashValue(entryPtr);
FreeStyleEngine(enginePtr);
ckfree(enginePtr);
entryPtr = Tcl_NextHashEntry(&search);
@@ -307,7 +307,7 @@ Tk_RegisterStyleEngine(
Tk_StyleEngine parent) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -331,8 +331,8 @@ Tk_RegisterStyleEngine(
* Allocate and intitialize a new engine.
*/
- enginePtr = ckalloc(sizeof(StyleEngine));
- InitStyleEngine(enginePtr, Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
+ enginePtr = (StyleEngine *)ckalloc(sizeof(StyleEngine));
+ InitStyleEngine(enginePtr, (const char *)Tcl_GetHashKey(&tsdPtr->engineTable, entryPtr),
(StyleEngine *) parent);
Tcl_SetHashValue(entryPtr, enginePtr);
@@ -364,7 +364,7 @@ InitStyleEngine(
StyleEngine *parentPtr) /* The engine's parent. NULL means the default
* system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -389,7 +389,7 @@ InitStyleEngine(
*/
if (tsdPtr->nbElements > 0) {
- enginePtr->elements = ckalloc(
+ enginePtr->elements = (StyledElement *)ckalloc(
sizeof(StyledElement) * tsdPtr->nbElements);
for (elementId = 0; elementId < tsdPtr->nbElements; elementId++) {
InitStyledElement(enginePtr->elements+elementId);
@@ -419,7 +419,7 @@ static void
FreeStyleEngine(
StyleEngine *enginePtr) /* The style engine to free. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
int elementId;
@@ -454,7 +454,7 @@ Tk_GetStyleEngine(
const char *name) /* Name of the engine to retrieve. NULL or
* empty means the default system engine. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
@@ -467,7 +467,7 @@ Tk_GetStyleEngine(
return NULL;
}
- return Tcl_GetHashValue(entryPtr);
+ return (Tk_StyleEngine)Tcl_GetHashValue(entryPtr);
}
/*
@@ -521,7 +521,7 @@ InitElement(
static void
FreeElement(
- Element *elementPtr) /* The element to free. */
+ TCL_UNUSED(Element *)) /* The element to free. */
{
/* Nothing to do. */
}
@@ -604,7 +604,7 @@ CreateElement(
* created explicitly (being registered) or
* implicitly (by a derived element). */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr, *engineEntryPtr;
Tcl_HashSearch search;
@@ -642,10 +642,10 @@ CreateElement(
* Reallocate element table.
*/
- tsdPtr->elements = ckrealloc(tsdPtr->elements,
+ tsdPtr->elements = (Element *)ckrealloc(tsdPtr->elements,
sizeof(Element) * tsdPtr->nbElements);
InitElement(tsdPtr->elements+elementId,
- Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
+ (const char *)Tcl_GetHashKey(&tsdPtr->elementTable, entryPtr), elementId,
genericId, create);
/*
@@ -654,9 +654,9 @@ CreateElement(
engineEntryPtr = Tcl_FirstHashEntry(&tsdPtr->engineTable, &search);
while (engineEntryPtr != NULL) {
- enginePtr = Tcl_GetHashValue(engineEntryPtr);
+ enginePtr = (StyleEngine *)Tcl_GetHashValue(engineEntryPtr);
- enginePtr->elements = ckrealloc(enginePtr->elements,
+ enginePtr->elements = (StyledElement *)ckrealloc(enginePtr->elements,
sizeof(StyledElement) * tsdPtr->nbElements);
InitStyledElement(enginePtr->elements+elementId);
@@ -686,7 +686,7 @@ int
Tk_GetElementId(
const char *name) /* Name of the element. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int genericId = -1;
@@ -759,7 +759,7 @@ Tk_RegisterStyledElement(
StyledElement *elementPtr;
Tk_ElementSpec *specPtr;
int nbOptions;
- register Tk_ElementOptionSpec *srcOptions, *dstOptions;
+ Tk_ElementOptionSpec *srcOptions, *dstOptions;
if (templatePtr->version != TK_STYLE_VERSION_1) {
/*
@@ -786,16 +786,16 @@ Tk_RegisterStyledElement(
elementPtr = ((StyleEngine *) engine)->elements+elementId;
- specPtr = ckalloc(sizeof(Tk_ElementSpec));
+ specPtr = (Tk_ElementSpec *)ckalloc(sizeof(Tk_ElementSpec));
specPtr->version = templatePtr->version;
- specPtr->name = ckalloc(strlen(templatePtr->name)+1);
+ specPtr->name = (char *)ckalloc(strlen(templatePtr->name)+1);
strcpy(specPtr->name, templatePtr->name);
nbOptions = 0;
for (nbOptions = 0, srcOptions = templatePtr->options;
srcOptions->name != NULL; nbOptions++, srcOptions++) {
/* empty body */
}
- specPtr->options =
+ specPtr->options = (Tk_ElementOptionSpec *)
ckalloc(sizeof(Tk_ElementOptionSpec) * (nbOptions+1));
for (srcOptions = templatePtr->options, dstOptions = specPtr->options;
/* End condition within loop */; srcOptions++, dstOptions++) {
@@ -804,7 +804,7 @@ Tk_RegisterStyledElement(
break;
}
- dstOptions->name = ckalloc(strlen(srcOptions->name)+1);
+ dstOptions->name = (char *)ckalloc(strlen(srcOptions->name)+1);
strcpy(dstOptions->name, srcOptions->name);
dstOptions->type = srcOptions->type;
}
@@ -844,7 +844,7 @@ GetStyledElement(
int elementId) /* Unique element ID */
{
StyledElement *elementPtr;
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
StyleEngine *enginePtr2;
@@ -924,7 +924,7 @@ InitWidgetSpec(
*/
widgetSpecPtr->optionsPtr =
- ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
+ (const Tk_OptionSpec **)ckalloc(sizeof(Tk_OptionSpec *) * nbOptions);
for (i = 0, elementOptionPtr = elementPtr->specPtr->options;
i < nbOptions; i++, elementOptionPtr++) {
widgetOptionPtr = TkGetOptionSpec(elementOptionPtr->name, optionTable);
@@ -1008,7 +1008,7 @@ GetWidgetSpec(
*/
i = elementPtr->nbWidgetSpecs++;
- elementPtr->widgetSpecs = ckrealloc(elementPtr->widgetSpecs,
+ elementPtr->widgetSpecs = (StyledWidgetSpec *)ckrealloc(elementPtr->widgetSpecs,
sizeof(StyledWidgetSpec) * elementPtr->nbWidgetSpecs);
widgetSpecPtr = elementPtr->widgetSpecs+i;
InitWidgetSpec(widgetSpecPtr, elementPtr, optionTable);
@@ -1229,7 +1229,7 @@ Tk_CreateStyle(
Tk_StyleEngine engine, /* The style engine. */
ClientData clientData) /* Private data passed as is to engine code. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
int newEntry;
@@ -1253,8 +1253,8 @@ Tk_CreateStyle(
* Allocate and intitialize a new style.
*/
- stylePtr = ckalloc(sizeof(Style));
- InitStyle(stylePtr, Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
+ stylePtr = (Style *)ckalloc(sizeof(Style));
+ InitStyle(stylePtr, (const char *)Tcl_GetHashKey(&tsdPtr->styleTable, entryPtr),
(engine!=NULL ? (StyleEngine*) engine : tsdPtr->defaultEnginePtr),
clientData);
Tcl_SetHashValue(entryPtr, stylePtr);
@@ -1344,10 +1344,9 @@ Tk_GetStyle(
const char *name) /* Name of the style to retrieve. NULL or empty
* means the default system style. */
{
- ThreadSpecificData *tsdPtr =
+ ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_HashEntry *entryPtr;
- Style *stylePtr;
/*
* Search for a corresponding entry in the style table.
@@ -1362,9 +1361,7 @@ Tk_GetStyle(
}
return NULL;
}
- stylePtr = Tcl_GetHashValue(entryPtr);
-
- return (Tk_Style) stylePtr;
+ return (Tk_Style)Tcl_GetHashValue(entryPtr);
}
/*
@@ -1379,7 +1376,7 @@ Tk_GetStyle(
void
Tk_FreeStyle(
- Tk_Style style)
+ TCL_UNUSED(Tk_Style))
{
}
@@ -1456,7 +1453,7 @@ Tk_GetStyleFromObj(
*/
void
Tk_FreeStyleFromObj(
- Tcl_Obj *objPtr)
+ TCL_UNUSED(Tcl_Obj *))
{
}
diff --git a/generic/tkText.c b/generic/tkText.c
index 2ddfea1..5996688 100644
--- a/generic/tkText.c
+++ b/generic/tkText.c
@@ -14,9 +14,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-#include "default.h"
#include "tkInt.h"
#include "tkUndo.h"
+#include "default.h"
#if defined(MAC_OSX_TK)
#define Style TkStyle
@@ -461,7 +461,7 @@ Tk_TextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- Tk_Window tkwin = clientData;
+ Tk_Window tkwin = (Tk_Window)clientData;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?");
@@ -502,7 +502,7 @@ CreateWidget(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkText *textPtr;
+ TkText *textPtr;
Tk_OptionTable optionTable;
TkTextIndex startIndex;
Tk_Window newWin;
@@ -523,7 +523,7 @@ CreateWidget(
* and 'insert', 'current' mark pointers are all NULL to start.
*/
- textPtr = ckalloc(sizeof(TkText));
+ textPtr = (TkText *)ckalloc(sizeof(TkText));
memset(textPtr, 0, sizeof(TkText));
textPtr->tkwin = newWin;
@@ -534,7 +534,7 @@ CreateWidget(
textPtr, TextCmdDeletedProc);
if (sharedPtr == NULL) {
- sharedPtr = ckalloc(sizeof(TkSharedText));
+ sharedPtr = (TkSharedText *)ckalloc(sizeof(TkSharedText));
memset(sharedPtr, 0, sizeof(TkSharedText));
sharedPtr->refCount = 0;
@@ -632,7 +632,7 @@ CreateWidget(
*/
textPtr->selTagPtr = TkTextCreateTag(textPtr, "sel", NULL);
- textPtr->selTagPtr->reliefString =
+ textPtr->selTagPtr->reliefString = (char *)
ckalloc(sizeof(DEF_TEXT_SELECT_RELIEF));
strcpy(textPtr->selTagPtr->reliefString, DEF_TEXT_SELECT_RELIEF);
Tk_GetRelief(interp, DEF_TEXT_SELECT_RELIEF, &textPtr->selTagPtr->relief);
@@ -699,7 +699,7 @@ TextWidgetObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
int result = TCL_OK;
int index;
@@ -864,11 +864,10 @@ TextWidgetObjCmd(
for (i = 2; i < objc-2; i++) {
int value;
- size_t length;
- const char *option = Tcl_GetString(objv[i]);
+ int length;
+ const char *option = Tcl_GetStringFromObj(objv[i], &length);
char c;
- length = objv[i]->length;
if (length < 2 || option[0] != '-') {
goto badOption;
}
@@ -1126,7 +1125,7 @@ TextWidgetObjCmd(
objc -= 2;
objv += 2;
- indices = ckalloc((objc + 1) * sizeof(TkTextIndex));
+ indices = (TkTextIndex *)ckalloc((objc + 1) * sizeof(TkTextIndex));
/*
* First pass verifies that all indices are valid.
@@ -1154,8 +1153,8 @@ TextWidgetObjCmd(
COUNT_INDICES);
objc++;
}
- useIdx = ckalloc(objc);
- memset(useIdx, 0, (size_t) objc);
+ useIdx = (char *)ckalloc(objc);
+ memset(useIdx, 0, objc);
/*
* Do a decreasing order sort so that we delete the end ranges
@@ -1260,7 +1259,7 @@ TextWidgetObjCmd(
Tcl_Obj *objPtr = NULL;
int i, found = 0, visible = 0;
const char *name;
- size_t length;
+ int length;
if (objc < 3) {
Tcl_WrongNumArgs(interp, 2, objv,
@@ -1276,14 +1275,12 @@ TextWidgetObjCmd(
i = 2;
if (objc > 3) {
- name = Tcl_GetString(objv[i]);
- length = objv[i]->length;
+ name = Tcl_GetStringFromObj(objv[i], &length);
if (length > 1 && name[0] == '-') {
if (strncmp("-displaychars", name, length) == 0) {
i++;
visible = 1;
- name = Tcl_GetString(objv[i]);
- length = objv[i]->length;
+ name = Tcl_GetStringFromObj(objv[i], &length);
}
if ((i < objc-1) && (length == 2) && !strcmp("--", name)) {
i++;
@@ -1610,7 +1607,7 @@ SharedTextObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- register TkSharedText *sharedPtr = clientData;
+ TkSharedText *sharedPtr = (TkSharedText *)clientData;
int result = TCL_OK;
int index;
@@ -1980,7 +1977,7 @@ DestroyText(
for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->windowTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
TkTextEmbWindowClient *loop;
- TkTextSegment *ewPtr = Tcl_GetHashValue(hPtr);
+ TkTextSegment *ewPtr = (TkTextSegment *)Tcl_GetHashValue(hPtr);
loop = ewPtr->body.ew.clients;
if (loop->textPtr == textPtr) {
@@ -2012,7 +2009,7 @@ DestroyText(
for (hPtr = Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
- tagPtr = Tcl_GetHashValue(hPtr);
+ tagPtr = (TkTextTag *)Tcl_GetHashValue(hPtr);
/*
* No need to use 'TkTextDeleteTag' since we've already removed
@@ -2078,7 +2075,7 @@ DestroyText(
static int
ConfigureText(
Tcl_Interp *interp, /* Used for error reporting. */
- register TkText *textPtr, /* Information about widget; may or may not
+ TkText *textPtr, /* Information about widget; may or may not
* already have values for some fields. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
@@ -2381,7 +2378,7 @@ static void
TextWorldChangedCallback(
ClientData instanceData) /* Information about widget. */
{
- TkText *textPtr = instanceData;
+ TkText *textPtr = (TkText *)instanceData;
TextWorldChanged(textPtr, TK_TEXT_LINE_GEOMETRY);
}
@@ -2470,9 +2467,9 @@ TextWorldChanged(
static void
TextEventProc(
ClientData clientData, /* Information about window. */
- register XEvent *eventPtr) /* Information about event. */
+ XEvent *eventPtr) /* Information about event. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex index, index2;
if (eventPtr->type == Expose) {
@@ -2581,7 +2578,7 @@ static void
TextCmdDeletedProc(
ClientData clientData) /* Pointer to widget record for widget. */
{
- TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
Tk_Window tkwin = textPtr->tkwin;
/*
@@ -2634,14 +2631,13 @@ InsertChars(
int viewUpdate) /* Update the view if set. */
{
int lineIndex;
- size_t length;
+ int length;
TkText *tPtr;
int *lineAndByteIndex;
int resetViewCount;
int pixels[2*PIXEL_CLIENTS];
- const char *string = Tcl_GetString(stringPtr);
+ const char *string = Tcl_GetStringFromObj(stringPtr, &length);
- length = stringPtr->length;
if (sharedTextPtr == NULL) {
sharedTextPtr = textPtr->sharedTextPtr;
}
@@ -2667,7 +2663,7 @@ InsertChars(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -2916,7 +2912,7 @@ TextUndoRedoCallback(
Tcl_Obj *objPtr) /* Arguments of a command to be handled by the
* shared text data structure. */
{
- TkSharedText *sharedPtr = clientData;
+ TkSharedText *sharedPtr = (TkSharedText *)clientData;
int res, objc;
Tcl_Obj **objv;
TkText *textPtr;
@@ -3155,9 +3151,7 @@ DeleteIndexRange(
for (i=0, hPtr=Tcl_FirstHashEntry(&sharedTextPtr->tagTable, &search);
hPtr != NULL; i++, hPtr = Tcl_NextHashEntry(&search)) {
- TkTextTag *tagPtr = Tcl_GetHashValue(hPtr);
-
- TkBTreeTag(&index1, &index2, tagPtr, 0);
+ TkBTreeTag(&index1, &index2, (TkTextTag *)Tcl_GetHashValue(hPtr), 0);
}
/*
@@ -3191,7 +3185,7 @@ DeleteIndexRange(
resetViewCount = 0;
if (sharedTextPtr->refCount > PIXEL_CLIENTS) {
- lineAndByteIndex = ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
+ lineAndByteIndex = (int *)ckalloc(sizeof(int) * 2 * sharedTextPtr->refCount);
} else {
lineAndByteIndex = pixels;
}
@@ -3380,7 +3374,7 @@ TextFetchSelection(
* not including terminating NULL
* character. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex eof;
int count, chunkSize, offsetInSeg;
TkTextSearch search;
@@ -3464,7 +3458,7 @@ TextFetchSelection(
if ((segPtr->typePtr == &tkTextCharType)
&& !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) {
memcpy(buffer, segPtr->body.chars + offsetInSeg,
- (size_t) chunkSize);
+ chunkSize);
buffer += chunkSize;
maxBytes -= chunkSize;
count += chunkSize;
@@ -3511,7 +3505,7 @@ void
TkTextLostSelection(
ClientData clientData) /* Information about text widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
if (TkpAlwaysShowSelection(textPtr->tkwin)) {
TkTextIndex start, end;
@@ -3596,7 +3590,7 @@ static void
TextBlinkProc(
ClientData clientData) /* Pointer to record describing text. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TkTextIndex index;
int x, y, w, h, charWidth;
@@ -3976,7 +3970,7 @@ TextSearchGetLineIndex(
{
const TkTextIndex *indexPtr;
int line;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
indexPtr = TkTextGetIndexFromObj(interp, textPtr, objPtr);
if (indexPtr == NULL) {
@@ -4041,7 +4035,7 @@ TextSearchIndexInLine(
TkTextSegment *segPtr;
TkTextIndex curIndex;
int index, leftToScan;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
index = 0;
curIndex.tree = textPtr->sharedTextPtr->tree;
@@ -4111,7 +4105,7 @@ TextSearchAddNextLine(
TkTextLine *linePtr, *thisLinePtr;
TkTextIndex curIndex;
TkTextSegment *segPtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
int nothingYet = 1;
/*
@@ -4233,7 +4227,7 @@ TextSearchFoundMatch(
TkTextIndex curIndex, foundIndex;
TkTextSegment *segPtr;
TkTextLine *linePtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
if (lineNum == searchSpecPtr->stopLine) {
/*
@@ -4284,7 +4278,7 @@ TextSearchFoundMatch(
* reached the end of the match or we have reached the end of the line.
*/
- linePtr = clientData;
+ linePtr = (TkTextLine *)clientData;
if (linePtr == NULL) {
linePtr = TkBTreeFindLine(textPtr->sharedTextPtr->tree, textPtr,
lineNum);
@@ -4494,8 +4488,8 @@ TkTextGetTabs(
* Parse the elements of the list one at a time to fill in the array.
*/
- tabArrayPtr = ckalloc(sizeof(TkTextTabArray)
- + (count - 1) * sizeof(TkTextTab));
+ tabArrayPtr = (TkTextTabArray *)ckalloc(Tk_Offset(TkTextTabArray, tabs)
+ + count * sizeof(TkTextTab));
tabArrayPtr->numTabs = 0;
prevStop = 0.0;
lastStop = 0.0;
@@ -4621,7 +4615,7 @@ TkTextGetTabs(
static int
TextDumpCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -4708,14 +4702,13 @@ TextDumpCmd(
if (objc == arg) {
TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES);
} else {
- size_t length;
+ int length;
const char *str;
if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) {
return TCL_ERROR;
}
- str = Tcl_GetString(objv[arg]);
- length = objv[arg]->length;
+ str = Tcl_GetStringFromObj(objv[arg], &length);
if (strncmp(str, "end", length) == 0) {
atEnd = 1;
}
@@ -4859,7 +4852,7 @@ DumpLine(
*/
int length = last - first;
- char *range = ckalloc(length + 1);
+ char *range = (char *)ckalloc(length + 1);
memcpy(range, segPtr->body.chars + first, length);
range[length] = '\0';
@@ -4890,7 +4883,7 @@ DumpLine(
name = NULL;
lineChanged = 0;
} else {
- name = Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
+ name = (const char *)Tcl_GetHashKey(&textPtr->sharedTextPtr->markTable,
markPtr->hPtr);
}
if (name != NULL) {
@@ -5016,7 +5009,7 @@ DumpSegment(
const char *value, /* Segment value. */
Tcl_Obj *command, /* Script callback. */
const TkTextIndex *index, /* index with line/byte position info. */
- int what) /* Look for TK_DUMP_INDEX bit. */
+ TCL_UNUSED(int)) /* Look for TK_DUMP_INDEX bit. */
{
char buffer[TK_POS_CHARS];
Tcl_Obj *values[3], *tuple;
@@ -5518,7 +5511,7 @@ void
TkTextRunAfterSyncCmd(
ClientData clientData) /* Information about text widget. */
{
- register TkText *textPtr = (TkText *) clientData;
+ TkText *textPtr = (TkText *)clientData;
int code;
if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
@@ -5592,7 +5585,7 @@ SearchPerform(
if (toPtr != NULL) {
const TkTextIndex *indexToPtr, *indexFromPtr;
- TkText *textPtr = searchSpecPtr->clientData;
+ TkText *textPtr = (TkText *)searchSpecPtr->clientData;
indexToPtr = TkTextGetIndexFromObj(interp, textPtr, toPtr);
if (indexToPtr == NULL) {
@@ -5673,7 +5666,8 @@ SearchCore(
* they are Unicode char offsets.
*/
- int firstOffset, lastOffset, matchOffset, matchLength;
+ int firstOffset, lastOffset;
+ int matchOffset, matchLength;
int passes;
int lineNum = searchSpecPtr->startLine;
int code = TCL_OK;
@@ -5746,8 +5740,7 @@ SearchCore(
* it has dual purpose.
*/
- pattern = Tcl_GetString(patObj);
- matchLength = patObj->length;
+ pattern = Tcl_GetStringFromObj(patObj, &matchLength);
nl = strchr(pattern, '\n');
/*
@@ -5916,7 +5909,7 @@ SearchCore(
}
while (p >= startOfLine + firstOffset) {
if (matchLength == 0 || (p[0] == c && !strncmp(
- p, pattern, (size_t) matchLength))) {
+ p, pattern, matchLength))) {
goto backwardsMatch;
}
p--;
@@ -5945,7 +5938,7 @@ SearchCore(
*/
p = startOfLine + lastOffset - firstNewLine - 1;
- if (strncmp(p, pattern, (unsigned) firstNewLine + 1)) {
+ if (strncmp(p, pattern, firstNewLine + 1)) {
/*
* No match.
*/
@@ -6011,7 +6004,7 @@ SearchCore(
* result.
*/
- if (strncmp(p,pattern,(size_t)matchLength)) {
+ if (strncmp(p, pattern, matchLength)) {
p = NULL;
}
break;
@@ -6259,8 +6252,8 @@ SearchCore(
*/
if ((match &&
- firstOffset+info.matches[0].end != lastTotal &&
- firstOffset+info.matches[0].end < prevFullLine)
+ firstOffset + info.matches[0].end != lastTotal &&
+ firstOffset + info.matches[0].end < prevFullLine)
|| info.extendStart < 0) {
break;
}
@@ -6329,8 +6322,8 @@ SearchCore(
* Possible overlap or enclosure.
*/
- if (thisOffset-lastNonOverlap >=
- lastBackwardsMatchOffset+matchLength){
+ if (thisOffset - lastNonOverlap >=
+ lastBackwardsMatchOffset + matchLength){
/*
* Totally encloses previous match, so
* forget the previous match.
@@ -6434,7 +6427,7 @@ SearchCore(
* matches on the heap.
*/
- int *newArray =
+ int *newArray = (int *)
ckalloc(4 * matchNum * sizeof(int));
memcpy(newArray, storeMatch, matchNum*sizeof(int));
memcpy(newArray + 2*matchNum, storeLength,
@@ -6695,8 +6688,8 @@ SearchCore(
static Tcl_Obj *
GetLineStartEnd(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *recordPtr, /* Pointer to widget record. */
int internalOffset) /* Offset within *recordPtr containing the
* line value. */
@@ -6730,9 +6723,9 @@ GetLineStartEnd(
static int
SetLineStartEnd(
- ClientData clientData,
+ TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interp; may be used for errors. */
- Tk_Window tkwin, /* Window for which option is being set. */
+ TCL_UNUSED(Tk_Window), /* Window for which option is being set. */
Tcl_Obj **value, /* Pointer to the pointer to the value object.
* We use a pointer to the pointer because we
* may need to return a value (NULL). */
@@ -6789,8 +6782,8 @@ SetLineStartEnd(
static void
RestoreLineStartEnd(
- ClientData clientData,
- Tk_Window tkwin,
+ TCL_UNUSED(void *),
+ TCL_UNUSED(Tk_Window),
char *internalPtr, /* Pointer to storage for value. */
char *oldInternalPtr) /* Pointer to old value. */
{
@@ -6848,7 +6841,7 @@ ObjectIsEmpty(
int
TkpTesttextCmd(
- 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. */
@@ -6867,7 +6860,7 @@ TkpTesttextCmd(
if (Tcl_GetCommandInfo(interp, Tcl_GetString(objv[1]), &info) == 0) {
return TCL_ERROR;
}
- textPtr = info.objClientData;
+ textPtr = (TkText *)info.objClientData;
len = strlen(Tcl_GetString(objv[2]));
if (strncmp(Tcl_GetString(objv[2]), "byteindex", len) == 0) {
if (objc != 5) {
diff --git a/generic/tkText.h b/generic/tkText.h
index a8a17da..9a9495a 100644
--- a/generic/tkText.h
+++ b/generic/tkText.h
@@ -168,7 +168,7 @@ typedef struct TkTextSegment {
int size; /* Size of this segment (# of bytes of index
* space it occupies). */
union {
- char chars[2]; /* Characters that make up character info.
+ char chars[TKFLEXARRAY]; /* Characters that make up character info.
* Actual length varies to hold as many
* characters as needed.*/
TkTextToggle toggle; /* Information about tag toggle. */
@@ -489,7 +489,7 @@ typedef struct TkTextTabArray {
double tabIncrement; /* The accurate fractional pixel increment
* between interpolated tabs we have to create
* when we exceed numTabs. */
- TkTextTab tabs[1]; /* Array of tabs. The actual size will be
+ TkTextTab tabs[TKFLEXARRAY];/* Array of tabs. The actual size will be
* numTabs. THIS FIELD MUST BE THE LAST IN THE
* STRUCTURE. */
} TkTextTabArray;
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 6d680f6..0eae4a9 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -444,8 +444,8 @@ typedef struct TextDInfo {
typedef struct CharInfo {
int numBytes; /* Number of bytes to display. */
- char chars[1]; /* UTF characters to display. Actual size will
- * be numBytes, not 1. THIS MUST BE THE LAST
+ char chars[TKFLEXARRAY]; /* UTF characters to display.
+ * Allocated as large as necessary. THIS MUST BE THE LAST
* FIELD IN THE STRUCTURE. */
} CharInfo;
@@ -658,10 +658,10 @@ void
TkTextCreateDInfo(
TkText *textPtr) /* Overall information for text widget. */
{
- register TextDInfo *dInfoPtr;
+ TextDInfo *dInfoPtr;
XGCValues gcValues;
- dInfoPtr = ckalloc(sizeof(TextDInfo));
+ dInfoPtr = (TextDInfo *)ckalloc(sizeof(TextDInfo));
Tcl_InitHashTable(&dInfoPtr->styleTable, sizeof(StyleValues)/sizeof(int));
dInfoPtr->dLinePtr = NULL;
dInfoPtr->copyGC = NULL;
@@ -717,7 +717,7 @@ void
TkTextFreeDInfo(
TkText *textPtr) /* Overall information for text widget. */
{
- register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
/*
* Be careful to free up styleTable *after* freeing up all the DLines, so
@@ -773,7 +773,7 @@ GetStyle(
* information is wanted. */
{
TkTextTag **tagPtrs;
- register TkTextTag *tagPtr;
+ TkTextTag *tagPtr;
StyleValues styleValues;
TextStyle *stylePtr;
Tcl_HashEntry *hPtr;
@@ -1002,7 +1002,7 @@ GetStyle(
hPtr = Tcl_CreateHashEntry(&textPtr->dInfoPtr->styleTable,
(char *) &styleValues, &isNew);
if (!isNew) {
- stylePtr = Tcl_GetHashValue(hPtr);
+ stylePtr = (TextStyle *)Tcl_GetHashValue(hPtr);
stylePtr->refCount++;
return stylePtr;
}
@@ -1011,7 +1011,7 @@ GetStyle(
* No existing style matched. Make a new one.
*/
- stylePtr = ckalloc(sizeof(TextStyle));
+ stylePtr = (TextStyle *)ckalloc(sizeof(TextStyle));
stylePtr->refCount = 1;
if (styleValues.border != NULL) {
gcValues.foreground = Tk_3DBorderColor(styleValues.border)->pixel;
@@ -1069,7 +1069,7 @@ GetStyle(
static void
FreeStyle(
TkText *textPtr, /* Information about overall widget. */
- register TextStyle *stylePtr)
+ TextStyle *stylePtr)
/* Information about style to free. */
{
stylePtr->refCount--;
@@ -1132,7 +1132,7 @@ LayoutDLine(
* necessarily point to a character
* segment. */
{
- register DLine *dlPtr; /* New display line. */
+ DLine *dlPtr; /* New display line. */
TkTextSegment *segPtr; /* Current segment in text. */
TkTextDispChunk *lastChunkPtr;
/* Last chunk allocated so far for line. */
@@ -1186,7 +1186,7 @@ LayoutDLine(
* Create and initialize a new DLine structure.
*/
- dlPtr = ckalloc(sizeof(DLine));
+ dlPtr = (DLine *)ckalloc(sizeof(DLine));
dlPtr->index = *indexPtr;
dlPtr->byteCount = 0;
dlPtr->y = 0;
@@ -1435,7 +1435,7 @@ LayoutDLine(
continue;
}
if (chunkPtr == NULL) {
- chunkPtr = ckalloc(sizeof(TkTextDispChunk));
+ chunkPtr = (TkTextDispChunk *)ckalloc(sizeof(TkTextDispChunk));
chunkPtr->nextPtr = NULL;
chunkPtr->clientData = NULL;
}
@@ -1833,8 +1833,8 @@ static void
UpdateDisplayInfo(
TkText *textPtr) /* Text widget to update. */
{
- register TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr, *prevPtr;
+ TextDInfo *dInfoPtr = textPtr->dInfoPtr;
+ DLine *dlPtr, *prevPtr;
TkTextIndex index;
TkTextLine *lastLinePtr;
int y, maxY, xPixelOffset, maxOffset, lineHeight;
@@ -1871,7 +1871,7 @@ UpdateDisplayInfo(
y = dInfoPtr->y - dInfoPtr->newTopPixelOffset;
maxY = dInfoPtr->maxY;
while (1) {
- register DLine *newPtr;
+ DLine *newPtr;
if (index.linePtr == lastLinePtr) {
break;
@@ -1982,7 +1982,7 @@ UpdateDisplayInfo(
*/
if (index.linePtr != prevPtr->index.linePtr) {
- register DLine *nextPtr;
+ DLine *nextPtr;
nextPtr = dlPtr;
while ((nextPtr != NULL)
@@ -2351,7 +2351,7 @@ UpdateDisplayInfo(
static void
FreeDLines(
TkText *textPtr, /* Information about overall text widget. */
- register DLine *firstPtr, /* Pointer to first DLine to free up. */
+ DLine *firstPtr, /* Pointer to first DLine to free up. */
DLine *lastPtr, /* Pointer to DLine just after last one to
* free (NULL means everything starting with
* firstPtr). */
@@ -2364,8 +2364,8 @@ FreeDLines(
* we shouldn't invalidate anything for the
* overall widget. */
{
- register TkTextDispChunk *chunkPtr, *nextChunkPtr;
- register DLine *nextDLinePtr;
+ TkTextDispChunk *chunkPtr, *nextChunkPtr;
+ DLine *nextDLinePtr;
if (action == DLINE_FREE_TEMP) {
lineHeightsRecalculated++;
@@ -2384,7 +2384,7 @@ FreeDLines(
if (textPtr->dInfoPtr->dLinePtr == firstPtr) {
textPtr->dInfoPtr->dLinePtr = lastPtr;
} else {
- register DLine *prevPtr;
+ DLine *prevPtr;
for (prevPtr = textPtr->dInfoPtr->dLinePtr;
prevPtr->nextPtr != firstPtr; prevPtr = prevPtr->nextPtr) {
@@ -2432,14 +2432,14 @@ FreeDLines(
static void
DisplayDLine(
TkText *textPtr, /* Text widget in which to draw line. */
- register DLine *dlPtr, /* Information about line to draw. */
+ DLine *dlPtr, /* Information about line to draw. */
DLine *prevPtr, /* Line just before one to draw, or NULL if
* dlPtr is the top line. */
Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
* must make sure it's large enough to hold
* line. */
{
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
Display *display;
int height, y_off;
@@ -2611,7 +2611,7 @@ DisplayDLine(
static void
DisplayLineBackground(
TkText *textPtr, /* Text widget containing line. */
- register DLine *dlPtr, /* Information about line to draw. */
+ DLine *dlPtr, /* Information about line to draw. */
DLine *prevPtr, /* Line just above dlPtr, or NULL if dlPtr is
* the top-most line in the window. */
Pixmap pixmap) /* Pixmap to use for double-buffering. Caller
@@ -3007,7 +3007,7 @@ static void
AsyncUpdateLineMetrics(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int lineNum;
@@ -4164,9 +4164,9 @@ static void
DisplayText(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr;
+ DLine *dlPtr;
DLine *prevPtr;
Pixmap pixmap;
int maxHeight, borders;
@@ -4254,7 +4254,7 @@ DisplayText(
*/
for (dlPtr = dInfoPtr->dLinePtr; dlPtr != NULL; dlPtr = dlPtr->nextPtr) {
- register DLine *dlPtr2;
+ DLine *dlPtr2;
int offset, height, y, oldY;
TkRegion damageRgn;
@@ -4552,7 +4552,7 @@ DisplayText(
* proc of embedded windows only.
*/
#endif
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
for (chunkPtr = dlPtr->chunkPtr; (chunkPtr != NULL);
chunkPtr = chunkPtr->nextPtr) {
@@ -4754,7 +4754,7 @@ TextInvalidateRegion(
TkText *textPtr, /* Widget record for text widget. */
TkRegion region) /* Region of area to redraw. */
{
- register DLine *dlPtr;
+ DLine *dlPtr;
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
int maxY, inset;
XRectangle rect;
@@ -5012,7 +5012,7 @@ TextRedrawTag(
int withTag) /* 1 means redraw characters that have the
* tag, 0 means redraw those without. */
{
- register DLine *dlPtr;
+ DLine *dlPtr;
DLine *endPtr;
int tagOn;
TkTextSearch search;
@@ -5352,7 +5352,7 @@ TkTextSetYView(
* are to be off the top of the screen. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr;
+ DLine *dlPtr;
int bottomY, close, lineIndex;
TkTextIndex tmpIndex, rounded;
int lineHeight;
@@ -6180,7 +6180,7 @@ TkTextYviewCmd(
pickPlace = 0;
if (Tcl_GetString(objv[2])[0] == '-') {
- register const char *switchStr =
+ const char *switchStr =
Tcl_GetStringFromObj(objv[2], &switchLength);
if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace",
@@ -6358,7 +6358,7 @@ TkTextPendingsync(
int
TkTextScanCmd(
- register TkText *textPtr, /* Information about text widget. */
+ TkText *textPtr, /* Information about text widget. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. Someone else has already
@@ -6844,7 +6844,7 @@ static void
AsyncUpdateYScrollbar(
ClientData clientData) /* Information about widget. */
{
- register TkText *textPtr = clientData;
+ TkText *textPtr = (TkText *)clientData;
textPtr->dInfoPtr->scrollbarTimer = NULL;
@@ -6879,7 +6879,7 @@ AsyncUpdateYScrollbar(
static DLine *
FindDLine(
TkText *textPtr, /* Widget record for text widget. */
- register DLine *dlPtr, /* Pointer to first in list of DLines to
+ DLine *dlPtr, /* Pointer to first in list of DLines to
* search. */
const TkTextIndex *indexPtr)/* Index of desired character. */
{
@@ -7049,7 +7049,7 @@ TkTextPixelIndex(
* border of the widget). */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register DLine *dlPtr, *validDlPtr;
+ DLine *dlPtr, *validDlPtr;
int nearby = 0;
/*
@@ -7151,7 +7151,7 @@ DlineIndexOfX(
* the character nearest to x. */
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
/*
* Scan through the line's chunks to find the one that contains the
@@ -7279,7 +7279,7 @@ DlineXOfIndex(
int byteIndex) /* The byte index for which we want the
* coordinate. */
{
- register TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
+ TkTextDispChunk *chunkPtr = dlPtr->chunkPtr;
int x = 0;
if (byteIndex == 0 || chunkPtr == NULL) {
@@ -7349,7 +7349,7 @@ TkTextIndexBbox(
{
TextDInfo *dInfoPtr = textPtr->dInfoPtr;
DLine *dlPtr;
- register TkTextDispChunk *chunkPtr;
+ TkTextDispChunk *chunkPtr;
int byteCount;
/*
@@ -7541,14 +7541,14 @@ TkTextDLineInfo(
static void
ElideBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
- int index, /* Index of desired character within the
+ TCL_UNUSED(int), /* Index of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
- int baseline, /* Location of line's baseline, in pixels
+ TCL_UNUSED(int), /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
* upper-left pixel. X-coord is in same
@@ -7569,8 +7569,8 @@ ElideBboxProc(
static int
ElideMeasureProc(
- TkTextDispChunk *chunkPtr, /* Chunk containing desired coord. */
- int x) /* X-coordinate, in same coordinate system as
+ TCL_UNUSED(TkTextDispChunk *), /* Chunk containing desired coord. */
+ TCL_UNUSED(int)) /* X-coordinate, in same coordinate system as
* chunkPtr->x. */
{
return 0 /*chunkPtr->numBytes - 1*/;
@@ -7599,8 +7599,8 @@ ElideMeasureProc(
int
TkTextCharLayoutProc(
- TkText *textPtr, /* Text widget being layed out. */
- TkTextIndex *indexPtr, /* Index of first character to lay out
+ TCL_UNUSED(TkText *), /* Text widget being layed out. */
+ TCL_UNUSED(TkTextIndex *), /* Index of first character to lay out
* (corresponds to segPtr and offset). */
TkTextSegment *segPtr, /* Segment being layed out. */
int byteOffset, /* Byte offset within segment of first
@@ -7614,7 +7614,7 @@ TkTextCharLayoutProc(
TkWrapMode wrapMode, /* How to handle line wrapping:
* TEXT_WRAPMODE_CHAR, TEXT_WRAPMODE_NONE, or
* TEXT_WRAPMODE_WORD. */
- register TkTextDispChunk *chunkPtr)
+ TkTextDispChunk *chunkPtr)
/* Structure to fill in with information about
* this chunk. The x field has already been
* set by the caller. */
@@ -7765,9 +7765,9 @@ TkTextCharLayoutProc(
chunkPtr->breakIndex = -1;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
- ciPtr = ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
+ ciPtr = (CharInfo *)ckalloc((Tk_Offset(CharInfo, chars) + 1) + bytesThatFit);
chunkPtr->clientData = ciPtr;
- memcpy(ciPtr->chars, p, (unsigned) bytesThatFit);
+ memcpy(ciPtr->chars, p, bytesThatFit);
#endif /* TK_LAYOUT_WITH_BASE_CHUNKS */
ciPtr->numBytes = bytesThatFit;
@@ -7878,7 +7878,7 @@ CharChunkMeasureChars(
* here. */
{
Tk_Font tkfont = chunkPtr->stylePtr->sValuePtr->tkfont;
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
#if !TK_LAYOUT_WITH_BASE_CHUNKS
if (chars == NULL) {
@@ -7953,21 +7953,21 @@ CharChunkMeasureChars(
static void
CharDisplayProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk that is to be drawn. */
int x, /* X-position in dst at which to draw this
* chunk (may differ from the x-position in
* the chunk because of scrolling). */
int y, /* Y-position at which to draw this chunk in
* dst. */
- int height, /* Total height of line. */
+ TCL_UNUSED(int), /* Total height of line. */
int baseline, /* Offset of baseline from y. */
Display *display, /* Display to use for drawing. */
Drawable dst, /* Pixmap or window in which to draw chunk. */
- int screenY) /* Y-coordinate in text window that
+ TCL_UNUSED(int)) /* Y-coordinate in text window that
* corresponds to y. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
const char *string;
TextStyle *stylePtr;
StyleValues *sValuePtr;
@@ -8115,10 +8115,10 @@ CharDisplayProc(
static void
CharUndisplayProc(
- TkText *textPtr, /* Overall information about text widget. */
+ TCL_UNUSED(TkText *), /* Overall information about text widget. */
TkTextDispChunk *chunkPtr) /* Chunk that is about to be freed. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
if (ciPtr) {
#if TK_LAYOUT_WITH_BASE_CHUNKS
@@ -8204,13 +8204,13 @@ CharMeasureProc(
static void
CharBboxProc(
- TkText *textPtr,
+ TCL_UNUSED(TkText *),
TkTextDispChunk *chunkPtr, /* Chunk containing desired char. */
int byteIndex, /* Byte offset of desired character within the
* chunk. */
int y, /* Topmost pixel in area allocated for this
* line. */
- int lineHeight, /* Height of line, in pixels. */
+ TCL_UNUSED(int), /* Height of line, in pixels. */
int baseline, /* Location of line's baseline, in pixels
* measured down from y. */
int *xPtr, int *yPtr, /* Gets filled in with coords of character's
@@ -8221,7 +8221,7 @@ CharBboxProc(
int *heightPtr) /* Gets filled in with height of character, in
* pixels. */
{
- CharInfo *ciPtr = chunkPtr->clientData;
+ CharInfo *ciPtr = (CharInfo *)chunkPtr->clientData;
int maxX;
maxX = chunkPtr->width + chunkPtr->x;
@@ -8384,7 +8384,7 @@ AdjustForTab(
if (chunkPtr2->displayProc != CharDisplayProc) {
continue;
}
- ciPtr = chunkPtr2->clientData;
+ ciPtr = (CharInfo *)chunkPtr2->clientData;
for (p = ciPtr->chars, i = 0; i < ciPtr->numBytes; p++, i++) {
if (isdigit(UCHAR(*p))) {
gotDigit = 1;
@@ -8405,7 +8405,7 @@ AdjustForTab(
if (decimalChunkPtr != NULL) {
int curX;
- ciPtr = decimalChunkPtr->clientData;
+ ciPtr = (CharInfo *)decimalChunkPtr->clientData;
CharChunkMeasureChars(decimalChunkPtr, NULL, 0, 0, decimal,
decimalChunkPtr->x, -1, 0, &curX);
desired = tabX - (curX - x);
@@ -8676,7 +8676,7 @@ MeasureChars(
int curX, width, ch;
const char *special, *end, *start;
- ch = 0; /* lint. */
+ ch = 0;
curX = startX;
start = source + rangeStart;
end = start + rangeLength;
diff --git a/library/demos/arrow.tcl b/library/demos/arrow.tcl
index 12249c0..3d0b406 100644
--- a/library/demos/arrow.tcl
+++ b/library/demos/arrow.tcl
@@ -154,11 +154,11 @@ $c bind box <Enter> "$c itemconfigure current $demo_arrowInfo(activeStyle)"
$c bind box <Leave> "$c itemconfigure current $demo_arrowInfo(boxStyle)"
$c bind box <B1-Enter> " "
$c bind box <B1-Leave> " "
-$c bind box1 <1> {set demo_arrowInfo(motionProc) arrowMove1}
-$c bind box2 <1> {set demo_arrowInfo(motionProc) arrowMove2}
-$c bind box3 <1> {set demo_arrowInfo(motionProc) arrowMove3}
+$c bind box1 <Button-1> {set demo_arrowInfo(motionProc) arrowMove1}
+$c bind box2 <Button-1> {set demo_arrowInfo(motionProc) arrowMove2}
+$c bind box3 <Button-1> {set demo_arrowInfo(motionProc) arrowMove3}
$c bind box <B1-Motion> "\$demo_arrowInfo(motionProc) $c %x %y"
-bind $c <Any-ButtonRelease-1> "arrowSetup $c"
+bind $c <ButtonRelease-1> "arrowSetup $c"
# arrowMove1 --
# This procedure is called for each mouse motion event on box1 (the
diff --git a/library/demos/bind.tcl b/library/demos/bind.tcl
index 03f6d3b..9146362 100644
--- a/library/demos/bind.tcl
+++ b/library/demos/bind.tcl
@@ -63,16 +63,16 @@ $w.text insert end \
# Create bindings for tags.
foreach tag {d1 d2 d3 d4 d5 d6} {
- $w.text tag bind $tag <Any-Enter> "$w.text tag configure $tag $bold"
- $w.text tag bind $tag <Any-Leave> "$w.text tag configure $tag $normal"
+ $w.text tag bind $tag <Enter> "$w.text tag configure $tag $bold"
+ $w.text tag bind $tag <Leave> "$w.text tag configure $tag $normal"
}
# Main widget program sets variable tk_demoDirectory
-$w.text tag bind d1 <1> {source [file join $tk_demoDirectory items.tcl]}
-$w.text tag bind d2 <1> {source [file join $tk_demoDirectory plot.tcl]}
-$w.text tag bind d3 <1> {source [file join $tk_demoDirectory ctext.tcl]}
-$w.text tag bind d4 <1> {source [file join $tk_demoDirectory arrow.tcl]}
-$w.text tag bind d5 <1> {source [file join $tk_demoDirectory ruler.tcl]}
-$w.text tag bind d6 <1> {source [file join $tk_demoDirectory cscroll.tcl]}
+$w.text tag bind d1 <Button-1> {source [file join $tk_demoDirectory items.tcl]}
+$w.text tag bind d2 <Button-1> {source [file join $tk_demoDirectory plot.tcl]}
+$w.text tag bind d3 <Button-1> {source [file join $tk_demoDirectory ctext.tcl]}
+$w.text tag bind d4 <Button-1> {source [file join $tk_demoDirectory arrow.tcl]}
+$w.text tag bind d5 <Button-1> {source [file join $tk_demoDirectory ruler.tcl]}
+$w.text tag bind d6 <Button-1> {source [file join $tk_demoDirectory cscroll.tcl]}
$w.text mark set insert 0.0
$w.text configure -state disabled
diff --git a/library/demos/colors.tcl b/library/demos/colors.tcl
index 99dec92..fdfdc5b 100644
--- a/library/demos/colors.tcl
+++ b/library/demos/colors.tcl
@@ -32,7 +32,7 @@ listbox $w.frame.list -yscroll "$w.frame.scroll set" \
-width 20 -height 16 -setgrid 1
pack $w.frame.list $w.frame.scroll -side left -fill y -expand 1
-bind $w.frame.list <Double-1> {
+bind $w.frame.list <Double-Button-1> {
tk_setPalette [selection get]
}
$w.frame.list insert 0 gray60 gray70 gray80 gray85 gray90 gray95 \
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index 443b102..f64ca5d 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -53,12 +53,12 @@ for {set i 0} {$i < 20} {incr i} {
}
}
-$c bind all <Any-Enter> "scrollEnter $c"
-$c bind all <Any-Leave> "scrollLeave $c"
-$c bind all <1> "scrollButton $c"
-bind $c <2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
+$c bind all <Enter> "scrollEnter $c"
+$c bind all <Leave> "scrollLeave $c"
+$c bind all <Button-1> "scrollButton $c"
if {[tk windowingsystem] eq "aqua"} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
bind $c <MouseWheel> {
%W yview scroll [expr {-(%D)}] units
}
@@ -72,11 +72,33 @@ if {[tk windowingsystem] eq "aqua"} {
%W xview scroll [expr {-10 * (%D)}] units
}
} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+ # We must make sure that positive and negative movements are rounded
+ # equally to integers, avoiding the problem that
+ # (int)1/30 = 0,
+ # but
+ # (int)-1/30 = -1
+ # The following code ensure equal +/- behaviour.
bind $c <MouseWheel> {
- %W yview scroll [expr {-(%D / 30)}] units
+ if {%D >= 0} {
+ %W yview scroll [expr {%D/-30}] units
+ } else {
+ %W yview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Option-MouseWheel> {
+ %W yview scroll [expr {%D/-3}] units
}
bind $c <Shift-MouseWheel> {
- %W xview scroll [expr {-(%D / 30)}] units
+ if {%D >= 0} {
+ %W xview scroll [expr {%D/-30}] units
+ } else {
+ %W xview scroll [expr {(%D-29)/-30}] units
+ }
+ }
+ bind $c <Shift-Option-MouseWheel> {
+ %W xview scroll [expr {%D/-3}] units
}
}
@@ -85,22 +107,22 @@ if {[tk windowingsystem] eq "x11"} {
# the wheel to the extended buttons. If you have a mousewheel, find
# Linux configuration info at:
# http://linuxreviews.org/howtos/xfree/mouse/
- bind $c <4> {
+ bind $c <Button-4> {
if {!$tk_strictMotif} {
%W yview scroll -5 units
}
}
- bind $c <Shift-4> {
+ bind $c <Shift-Button-4> {
if {!$tk_strictMotif} {
%W xview scroll -5 units
}
}
- bind $c <5> {
+ bind $c <Button-5> {
if {!$tk_strictMotif} {
%W yview scroll 5 units
}
}
- bind $c <Shift-5> {
+ bind $c <Shift-Button-5> {
if {!$tk_strictMotif} {
%W xview scroll 5 units
}
diff --git a/library/demos/ctext.tcl b/library/demos/ctext.tcl
index 502c9d0..5acc82f 100644
--- a/library/demos/ctext.tcl
+++ b/library/demos/ctext.tcl
@@ -50,7 +50,11 @@ $c bind text <Return> "textInsert $c \\n"
$c bind text <Control-h> "textBs $c"
$c bind text <BackSpace> "textBs $c"
$c bind text <Delete> "textDel $c"
-$c bind text <Button-2> "textPaste $c @%x,%y"
+if {[tk windowingsystem] eq "aqua"} {
+ $c bind text <Button-3> "textPaste $c @%x,%y"
+} else {
+ $c bind text <Button-2> "textPaste $c @%x,%y"
+}
# Next, create some items that allow the text's anchor position
# to be edited.
diff --git a/library/demos/entry3.tcl b/library/demos/entry3.tcl
index d4435c6..acde1b3 100644
--- a/library/demos/entry3.tcl
+++ b/library/demos/entry3.tcl
@@ -102,7 +102,7 @@ foreach {chars digit} {abc 2 def 3 ghi 4 jkl 5 mno 6 pqrs 7 tuv 8 wxyz 9} {
proc validatePhoneChange {W vmode idx char} {
global phoneNumberMap entry3content
- if {$idx == -1} {return 1}
+ if {$idx < 0} {return 1}
after idle [list $W configure -validate $vmode -invcmd bell]
if {
!($idx<3 || $idx==6 || $idx==7 || $idx==11 || $idx>15) &&
diff --git a/library/demos/floor.tcl b/library/demos/floor.tcl
index d5ef3a0..37e1b95 100644
--- a/library/demos/floor.tcl
+++ b/library/demos/floor.tcl
@@ -1354,13 +1354,18 @@ floorDisplay $c 3
# Set up event bindings for canvas:
-$c bind floor1 <1> "floorDisplay $c 1"
-$c bind floor2 <1> "floorDisplay $c 2"
-$c bind floor3 <1> "floorDisplay $c 3"
+$c bind floor1 <Button-1> "floorDisplay $c 1"
+$c bind floor2 <Button-1> "floorDisplay $c 2"
+$c bind floor3 <Button-1> "floorDisplay $c 3"
$c bind room <Enter> "newRoom $c"
$c bind room <Leave> {set currentRoom ""}
-bind $c <2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
+if {[tk windowingsystem] eq "aqua"} {
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+}
bind $c <Destroy> "unset currentRoom"
set currentRoom ""
trace variable currentRoom w "roomChanged $c"
diff --git a/library/demos/image2.tcl b/library/demos/image2.tcl
index 2d7ba03..7af52be 100644
--- a/library/demos/image2.tcl
+++ b/library/demos/image2.tcl
@@ -95,7 +95,7 @@ listbox $w.f.list -width 20 -height 10 -yscrollcommand "$w.f.scroll set"
ttk::scrollbar $w.f.scroll -command "$w.f.list yview"
pack $w.f.list $w.f.scroll -side left -fill y -expand 1
$w.f.list insert 0 earth.gif earthris.gif teapot.ppm
-bind $w.f.list <Double-1> "loadImage $w %x %y"
+bind $w.f.list <Double-Button-1> "loadImage $w %x %y"
catch {image delete image2a}
image create photo image2a
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index be9214a..545877c 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -17,7 +17,7 @@ wm iconname $w "Items"
positionWindow $w
set c $w.frame.c
-label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
+label $w.msg -font $font -wraplength 5i -justify left -text "This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Left-Button drag:\tmoves item under pointer.\n Middle-Button drag:\trepositions view.\n Right-Button drag:\tstrokes out area.\n Ctrl+f:\t\tprints items under area."
pack $w.msg -side top
## See Code / Dismiss buttons
@@ -171,14 +171,21 @@ $c create text 28.5c 17.4c -text Scale: -anchor s
# Set up event bindings for canvas:
-$c bind item <Any-Enter> "itemEnter $c"
-$c bind item <Any-Leave> "itemLeave $c"
-bind $c <2> "$c scan mark %x %y"
-bind $c <B2-Motion> "$c scan dragto %x %y"
-bind $c <3> "itemMark $c %x %y"
-bind $c <B3-Motion> "itemStroke $c %x %y"
+$c bind item <Enter> "itemEnter $c"
+$c bind item <Leave> "itemLeave $c"
+if {[tk windowingsystem] eq "aqua"} {
+ bind $c <Button-2> "itemMark $c %x %y"
+ bind $c <B2-Motion> "itemStroke $c %x %y"
+ bind $c <Button-3> "$c scan mark %x %y"
+ bind $c <B3-Motion> "$c scan dragto %x %y"
+} else {
+ bind $c <Button-2> "$c scan mark %x %y"
+ bind $c <B2-Motion> "$c scan dragto %x %y"
+ bind $c <Button-3> "itemMark $c %x %y"
+ bind $c <B3-Motion> "itemStroke $c %x %y"
+}
bind $c <<NextChar>> "itemsUnderArea $c"
-bind $c <1> "itemStartDrag $c %x %y"
+bind $c <Button-1> "itemStartDrag $c %x %y"
bind $c <B1-Motion> "itemDrag $c %x %y"
# Utility procedures for highlighting the item under the pointer:
@@ -250,14 +257,14 @@ proc itemsUnderArea {c} {
set area [$c find withtag area]
set items ""
foreach i [$c find enclosed $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
puts stdout "Items enclosed by area: $items"
set items ""
foreach i [$c find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
- if {[lsearch [$c gettags $i] item] != -1} {
+ if {[lsearch [$c gettags $i] item] >= 0} {
lappend items $i
}
}
diff --git a/library/demos/ixset b/library/demos/ixset
index 13235de..85664d9 100644
--- a/library/demos/ixset
+++ b/library/demos/ixset
@@ -54,7 +54,7 @@ proc readsettings {} {
global screencyc ; set screencyc 600
set xfd [open "|xset q" r]
- while {[gets $xfd line] > -1} {
+ while {[gets $xfd line] >= 0} {
switch -- [lindex $line 0] {
auto {
set rpt [lindex $line 1]
@@ -197,7 +197,7 @@ proc createwindows {} {
bind . <Return> {.buttons.ok flash; .buttons.ok invoke}
bind . <Escape> {.buttons.quit flash; .buttons.quit invoke}
- bind . <1> {
+ bind . <Button-1> {
if {![string match .buttons* %W]} {
.buttons.apply configure -state normal
.buttons.cancel configure -state normal
diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl
index b5cffa8..11b3b5c 100644
--- a/library/demos/knightstour.tcl
+++ b/library/demos/knightstour.tcl
@@ -21,7 +21,7 @@
# If you let it repeat then it will choose random start positions
# for each new tour.
-package require Tk 8.5
+package require Tk
# Return a list of accessible squares from a given square
proc ValidMoves {square} {
@@ -29,7 +29,7 @@ proc ValidMoves {square} {
foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} {
set col [expr {($square % 8) + [lindex $pair 0]}]
set row [expr {($square / 8) + [lindex $pair 1]}]
- if {$row > -1 && $row < 8 && $col > -1 && $col < 8} {
+ if {$row >= 0 && $row < 8 && $col >= 0 && $col < 8} {
lappend moves [expr {$row * 8 + $col}]
}
}
@@ -41,7 +41,7 @@ proc CheckSquare {square} {
variable visited
set moves 0
foreach test [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $test] == -1} {
+ if {[lsearch -exact -integer $visited $test] < 0} {
incr moves
}
}
@@ -55,7 +55,7 @@ proc Next {square} {
set minimum 9
set nextSquare -1
foreach testSquare [ValidMoves $square] {
- if {[lsearch -exact -integer $visited $testSquare] == -1} {
+ if {[lsearch -exact -integer $visited $testSquare] < 0} {
set count [CheckSquare $testSquare]
if {$count < $minimum} {
set minimum $count
@@ -190,7 +190,7 @@ proc CreateGUI {} {
ttk::button $dlg.tf.b1 -text Start -command [list Tour $dlg]
ttk::button $dlg.tf.b2 -text Exit -command [list Exit $dlg]
set square 0
- for {set row 7} {$row != -1} {incr row -1} {
+ for {set row 7} {$row >= 0} {incr row -1} {
for {set col 0} {$col < 8} {incr col} {
if {(($col & 1) ^ ($row & 1))} {
set fill tan3 ; set dfill tan4
diff --git a/library/demos/pendulum.tcl b/library/demos/pendulum.tcl
index 6422c67..9833e8f 100644
--- a/library/demos/pendulum.tcl
+++ b/library/demos/pendulum.tcl
@@ -113,7 +113,7 @@ bind $w.c <Destroy> {
after cancel $animationCallbacks(pendulum)
unset animationCallbacks(pendulum)
}
-bind $w.c <1> {
+bind $w.c <Button-1> {
after cancel $animationCallbacks(pendulum)
showPendulum %W at %x %y
}
diff --git a/library/demos/plot.tcl b/library/demos/plot.tcl
index e7f0361..453b7a6 100644
--- a/library/demos/plot.tcl
+++ b/library/demos/plot.tcl
@@ -55,9 +55,9 @@ foreach point {
$c addtag point withtag $item
}
-$c bind point <Any-Enter> "$c itemconfig current -fill red"
-$c bind point <Any-Leave> "$c itemconfig current -fill SkyBlue2"
-$c bind point <1> "plotDown $c %x %y"
+$c bind point <Enter> "$c itemconfig current -fill red"
+$c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
+$c bind point <Button-1> "plotDown $c %x %y"
$c bind point <ButtonRelease-1> "$c dtag selected"
bind $c <B1-Motion> "plotMove $c %x %y"
diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl
index f7bc37b..0b78370 100644
--- a/library/demos/ruler.tcl
+++ b/library/demos/ruler.tcl
@@ -77,10 +77,10 @@ $c addtag well withtag [$c create rect 13.2c 1c 13.8c 0.5c \
$c addtag well withtag [rulerMkTab $c [winfo pixels $c 13.5c] \
[winfo pixels $c .65c]]
-$c bind well <1> "rulerNewTab $c %x %y"
-$c bind tab <1> "rulerSelectTab $c %x %y"
+$c bind well <Button-1> "rulerNewTab $c %x %y"
+$c bind tab <Button-1> "rulerSelectTab $c %x %y"
bind $c <B1-Motion> "rulerMoveTab $c %x %y"
-bind $c <Any-ButtonRelease-1> "rulerReleaseTab $c"
+bind $c <ButtonRelease-1> "rulerReleaseTab $c"
# rulerNewTab --
# Does all the work of creating a tab stop, including creating the
diff --git a/library/demos/square b/library/demos/square
index 6ce91b8..9f200ba 100644
--- a/library/demos/square
+++ b/library/demos/square
@@ -18,7 +18,7 @@ square .s
pack .s -expand yes -fill both
wm minsize . 1 1
-bind .s <1> {center %x %y}
+bind .s <Button-1> {center %x %y}
bind .s <B1-Motion> {center %x %y}
bind .s a animate
focus .s
diff --git a/library/demos/tcolor b/library/demos/tcolor
index 6e50c61..0aa133b 100644
--- a/library/demos/tcolor
+++ b/library/demos/tcolor
@@ -7,7 +7,7 @@ exec wish "$0" ${1+"$@"}
# create colors using either the RGB, HSB, or CYM color spaces
# and apply the color to existing applications.
-package require Tk 8.4
+package require Tk
wm title . "Color Editor"
# Global variables that control the program:
@@ -90,7 +90,7 @@ foreach i {
grid columnconfigure . 0 -weight 1
listbox .names.lb -width 20 -height 12 -yscrollcommand ".names.s set" \
-exportselection false
- bind .names.lb <Double-1> {
+ bind .names.lb <Double-Button-1> {
tc_loadNamedColor [.names.lb get [.names.lb curselection]]
}
scrollbar .names.s -orient vertical -command ".names.lb yview"
diff --git a/library/demos/twind.tcl b/library/demos/twind.tcl
index 45d1da8..74f11eb 100644
--- a/library/demos/twind.tcl
+++ b/library/demos/twind.tcl
@@ -265,9 +265,9 @@ proc createPlot {t} {
$c addtag point withtag $item
}
- $c bind point <Any-Enter> "$c itemconfig current -fill red"
- $c bind point <Any-Leave> "$c itemconfig current -fill SkyBlue2"
- $c bind point <1> "embPlotDown $c %x %y"
+ $c bind point <Enter> "$c itemconfig current -fill red"
+ $c bind point <Leave> "$c itemconfig current -fill SkyBlue2"
+ $c bind point <Button-1> "embPlotDown $c %x %y"
$c bind point <ButtonRelease-1> "$c dtag selected"
bind $c <B1-Motion> "embPlotMove $c %x %y"
return $c
diff --git a/library/fontchooser.tcl b/library/fontchooser.tcl
index 9197aea..a9bd706 100644
--- a/library/fontchooser.tcl
+++ b/library/fontchooser.tcl
@@ -384,7 +384,7 @@ proc ::tk::fontchooser::Tracer {var1 var2 op} {
$S(W).l${var}s selection clear 0 end
set n [lsearch -exact $S(${var}s,lcase) $value]
$S(W).l${var}s selection set $n
- if {$n != -1} {
+ if {$n >= 0} {
set S($var) [lindex $S(${var}s) $n]
$S(W).e$var icursor end
$S(W).e$var selection clear
diff --git a/library/iconlist.tcl b/library/iconlist.tcl
index eed7476..34b19d0 100644
--- a/library/iconlist.tcl
+++ b/library/iconlist.tcl
@@ -26,7 +26,7 @@
# <path> selection includes <item>
# <path> selection set <first> ?<last>?
-package require Tk 8.6
+package require Tk
::tk::Megawidget create ::tk::IconList ::tk::FocusableWidget {
variable w canvas sbar accel accelCB fill font index \
@@ -697,7 +697,7 @@ package require Tk 8.6
}
}
- if {$theIndex > -1} {
+ if {$theIndex >= 0} {
$w selection clear 0 end
$w selection set $theIndex
$w selection anchor $theIndex
diff --git a/library/megawidget.tcl b/library/megawidget.tcl
index aeb1263..ec9f469 100644
--- a/library/megawidget.tcl
+++ b/library/megawidget.tcl
@@ -10,7 +10,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-package require Tk 8.6
+package require Tk
::oo::class create ::tk::Megawidget {
superclass ::oo::class
diff --git a/library/safetk.tcl b/library/safetk.tcl
index 841a0b6..9e71cc6 100644
--- a/library/safetk.tcl
+++ b/library/safetk.tcl
@@ -220,7 +220,7 @@ proc ::safe::tkTopLevel {child display} {
set w ".safe$tkSafeId"
if {[catch {toplevel $w -screen $display -class SafeTk} msg]} {
return -code error -errorcode {TK TOPLEVEL SAFE} \
- "Unable to create toplevel for safe child \"$child\" ($msg)"
+ "Unable to create toplevel for \"$child\" ($msg)"
}
Log $child "New toplevel $w" NOTICE
diff --git a/library/spinbox.tcl b/library/spinbox.tcl
index f5a2ad3..2b387d2 100644
--- a/library/spinbox.tcl
+++ b/library/spinbox.tcl
@@ -483,10 +483,10 @@ proc ::tk::spinbox::MouseSelect {w x {cursor {}}} {
word {
if {$cur < [$w index anchor]} {
set before [tcl_wordBreakBefore [$w get] $cur]
- set after [tcl_wordBreakAfter [$w get] [expr {$anchor-1}]]
+ set after [tcl_wordBreakAfter [$w get] $anchor-1]
} else {
set before [tcl_wordBreakBefore [$w get] $anchor]
- set after [tcl_wordBreakAfter [$w get] [expr {$cur - 1}]]
+ set after [tcl_wordBreakAfter [$w get] $cur-1]
}
if {$before < 0} {
set before 0
diff --git a/library/tearoff.tcl b/library/tearoff.tcl
index 4c8b404..dece4df 100644
--- a/library/tearoff.tcl
+++ b/library/tearoff.tcl
@@ -153,7 +153,7 @@ proc ::tk::MenuDup {src dst type} {
# Copy tags to x, replacing each substring of src with dst.
- while {[set index [string first $src $tags]] != -1} {
+ while {[set index [string first $src $tags]] >= 0} {
if {$index > 0} {
append x [string range $tags 0 $index-1]$dst
}
@@ -170,7 +170,7 @@ proc ::tk::MenuDup {src dst type} {
# Copy script to x, replacing each substring of event with dst.
- while {[set index [string first $event $script]] != -1} {
+ while {[set index [string first $event $script]] >= 0} {
if {$index > 0} {
append x [string range $script 0 $index-1]
}
diff --git a/library/text.tcl b/library/text.tcl
index 0fa37e7..ec8f3d3 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -571,12 +571,7 @@ proc ::tk::TextButton1 {w x y} {
} else {
$w mark gravity $anchorname left
}
- # Allow focus in any case on Windows, because that will let the
- # selection be displayed even for state disabled text widgets.
- if {[tk windowingsystem] eq "win32" \
- || [$w cget -state] eq "normal"} {
- focus $w
- }
+ focus $w
if {[$w cget -autoseparators]} {
$w edit separator
}
diff --git a/library/ttk/fonts.tcl b/library/ttk/fonts.tcl
index a2781c6..bf4ccd0 100644
--- a/library/ttk/fonts.tcl
+++ b/library/ttk/fonts.tcl
@@ -82,7 +82,7 @@ switch -- [tk windowingsystem] {
set F(family) "MS Sans Serif"
}
} else {
- if {[lsearch -exact [font families] Tahoma] != -1} {
+ if {[lsearch -exact [font families] Tahoma] >= 0} {
set F(family) "Tahoma"
} else {
set F(family) "MS Sans Serif"
diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c
index 88036ee..258740b 100644
--- a/macosx/tkMacOSXHLEvents.c
+++ b/macosx/tkMacOSXHLEvents.c
@@ -39,6 +39,7 @@ typedef struct AppleEventInfo {
const char *procedure;
Tcl_DString command;
NSAppleEventDescriptor *replyEvent; /* Only used for DoScriptText. */
+ int retryCount;
} AppleEventInfo;
/*
@@ -148,6 +149,7 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEKeyword keyword;
Tcl_DString pathName;
+
/*
* Do nothing if we don't have an interpreter.
*/
@@ -215,7 +217,13 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = openDocumentProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+
+ if (Tcl_FindCommand(_eventInterp, "::tk::mac::OpenDocuments", NULL, 0)){
+ ProcessAppleEvent((ClientData)AEInfo);
+ } else {
+ Tcl_CreateTimerHandler(500, ProcessAppleEvent, (ClientData)AEInfo);
+ }
}
- (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event
@@ -232,7 +240,8 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = printDocProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
- (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event
@@ -293,7 +302,8 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptFileProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
}
} else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type,
@@ -317,12 +327,13 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
Tcl_DStringAppendElement(scriptTextCommand, data);
AEInfo->interp = _eventInterp;
AEInfo->procedure = scriptTextProc;
+ AEInfo->retryCount = 0;
if (Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
AEInfo->replyEvent = replyEvent;
ProcessAppleEvent((ClientData)AEInfo);
} else {
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ ProcessAppleEvent((ClientData)AEInfo);
}
}
}
@@ -343,7 +354,8 @@ static const char *scriptTextProc = "::tk::mac::DoScriptText";
AEInfo->interp = _eventInterp;
AEInfo->procedure = launchURLProc;
AEInfo->replyEvent = nil;
- Tcl_DoWhenIdle(ProcessAppleEvent, (ClientData)AEInfo);
+ AEInfo->retryCount = 0;
+ ProcessAppleEvent((ClientData)AEInfo);
}
@end
@@ -378,8 +390,26 @@ static void ProcessAppleEvent(
{
int code;
AppleEventInfo *AEInfo = (AppleEventInfo*) clientData;
- if (!AEInfo->interp ||
- !Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
+
+ if (!AEInfo->interp) {
+ return;
+ }
+
+ /*
+ * Apple events that are delivered during the app startup can arrive
+ * before the Tcl procedure for handling the events has been defined.
+ * If the command is not found we create a timer handler to process
+ * the event later, hopefully after the command has been created.
+ * We retry up to 2 times before giving up.
+ */
+
+ if (!Tcl_FindCommand(AEInfo->interp, AEInfo->procedure, NULL, 0)) {
+ if (AEInfo->retryCount < 2) {
+ AEInfo->retryCount++;
+ Tcl_CreateTimerHandler(200, ProcessAppleEvent, clientData);
+ } else {
+ ckfree(clientData);
+ }
return;
}
code = Tcl_EvalEx(AEInfo->interp, Tcl_DStringValue(&AEInfo->command),
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 51c1e37..bda5f46 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -14,10 +14,9 @@
*/
#include "tkMacOSXPrivate.h"
-
-#include <sys/stat.h>
#include <dlfcn.h>
#include <objc/objc-auto.h>
+#include <sys/stat.h>
static char tkLibPath[PATH_MAX + 1] = "";
@@ -145,7 +144,7 @@ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip,
*/
[NSApp _lockAutoreleasePool];
- while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {}
+ while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {}
[NSApp _unlockAutoreleasePool];
}
@@ -278,15 +277,15 @@ TkpInit(
static int initialized = 0;
/*
- * Since it is possible for TkInit to be called multiple times and we
- * don't want to do the following initialization multiple times we protect
- * against doing it more than once.
+ * TkpInit can be called multiple times with different interpreters. But
+ * The application initialization should only be done onece.
*/
if (!initialized) {
struct stat st;
-
- initialized = 1;
+ Bool shouldOpenConsole = NO;
+ Bool stdinIsNullish = (!isatty(0) &&
+ (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)));
/*
* Initialize/check OS version variable for runtime checks.
@@ -296,6 +295,8 @@ TkpInit(
# error Mac OS X 10.6 required
#endif
+ initialized = 1;
+
#ifdef TK_FRAMEWORK
/*
* When Tk is in a framework, force tcl_findLibrary to look in the
@@ -313,16 +314,6 @@ TkpInit(
#endif
/*
- * FIXME: Close stdin & stdout for remote debugging otherwise we will
- * fight with gdb for stdin & stdout
- */
-
- if (getenv("XCNOSTDIN") != NULL) {
- close(0);
- close(1);
- }
-
- /*
* Instantiate our NSApplication object. This needs to be done before
* we check whether to open a console window.
*/
@@ -337,20 +328,20 @@ TkpInit(
nil]];
[TKApplication sharedApplication];
[pool drain];
- [NSApp _setup:interp];
/*
- * WARNING: The finishLaunching method runs asynchronously, apparently
- * in a separate thread. This creates a race between the
- * initialization of the NSApplication and the initialization of Tk.
- * If Tk wins the race bad things happen with the root window (see
- * below). If the NSApplication wins then an AppleEvent created during
- * launch, e.g. by dropping a file icon on the application icon, will
- * be delivered before the procedure meant to to handle the AppleEvent
- * has been defined. This is now handled by processing the AppleEvent
- * as an idle task. See tkMacOSXHLEvents.c.
+ * WARNING: The finishLaunching method runs asynchronously. This
+ * creates a race between the initialization of the NSApplication and
+ * the initialization of Tk. If Tk wins the race bad things happen
+ * with the root window (see below). If the NSApplication wins then an
+ * AppleEvent created during launch, e.g. by dropping a file icon on
+ * the application icon, will be delivered before the procedure meant
+ * to to handle the AppleEvent has been defined. This is handled in
+ * tkMacOSXHLEvents.c by scheduling a timer event to handle the
+ * ApplEvent later, after the required procedure has been defined.
*/
+ [NSApp _setup:interp];
[NSApp finishLaunching];
/*
@@ -377,36 +368,52 @@ TkpInit(
Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT);
/*
- * If we don't have a TTY and stdin is a special character file of
- * length 0, (e.g. /dev/null, which is what Finder sets when double
- * clicking Wish) then use the Tk based console interpreter.
+ * Decide whether to open a console window. If the TK_CONSOLE
+ * environment variable is not defined we only show the console if
+ * stdin is not a tty and there is no startup script.
*/
- if (getenv("TK_CONSOLE") ||
- (!isatty(0) && (fstat(0, &st) ||
- (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) {
+ if (getenv("TK_CONSOLE")) {
+ shouldOpenConsole = YES;
+ } else if (stdinIsNullish && Tcl_GetStartupScript(NULL) == NULL) {
+ const char *intvar = Tcl_GetVar2(interp, "tcl_interactive",
+ NULL, TCL_GLOBAL_ONLY);
+ if (intvar == NULL) {
+ Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
+ TCL_GLOBAL_ONLY);
+ }
+ shouldOpenConsole = YES;
+ }
+ if (shouldOpenConsole) {
Tk_InitConsoleChannels(interp);
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT));
Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR));
+ if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ } else if (stdinIsNullish) {
/*
- * Only show the console if we don't have a startup script and
- * tcl_interactive hasn't been set already.
+ * When launched as a macOS application with no console,
+ * redirect stderr and stdout to /dev/null. This avoids waiting
+ * forever for those files to become writable if the underlying
+ * Tcl program tries to write to them with a puts command.
*/
- if (Tcl_GetStartupScript(NULL) == NULL) {
- const char *intvar = Tcl_GetVar2(interp,
- "tcl_interactive", NULL, TCL_GLOBAL_ONLY);
+ FILE *null = fopen("/dev/null", "w");
+ dup2(fileno(null), STDOUT_FILENO);
+ dup2(fileno(null), STDERR_FILENO);
+ }
- if (intvar == NULL) {
- Tcl_SetVar2(interp, "tcl_interactive", NULL, "1",
- TCL_GLOBAL_ONLY);
- }
- }
- if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) {
- return TCL_ERROR;
- }
+ /*
+ * FIXME: Close stdin & stdout for remote debugging if XCNOSTDIN is
+ * set. Otherwise we will fight with gdb for stdin & stdout
+ */
+
+ if (getenv("XCNOSTDIN") != NULL) {
+ close(0);
+ close(1);
}
/*
@@ -416,8 +423,28 @@ TkpInit(
*/
TkMacOSXServices_Init(interp);
+
+ /*
+ * The root window has been created and mapped, but XMapWindow deferred its
+ * call to makeKeyAndOrderFront because the first call to XMapWindow
+ * occurs too early in the initialization process for that. Process idle
+ * tasks now, so the root window is configured, then order it front.
+ */
+
+ while(Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {};
+ for (NSWindow *window in [NSApp windows]) {
+ TkWindow *winPtr = TkMacOSXGetTkWindow(window);
+ if (winPtr && Tk_IsMapped(winPtr)) {
+ [window makeKeyAndOrderFront:NSApp];
+ break;
+ }
+ }
}
+ /*
+ * Initialization steps that are needed for all interpreters.
+ */
+
if (tkLibPath[0] != '\0') {
Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY);
}
@@ -433,6 +460,7 @@ TkpInit(
TkMacOSXIconBitmapObjCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath",
TkMacOSXGetAppPathCmd, NULL, NULL);
+
return TCL_OK;
}
diff --git a/macosx/tkMacOSXMouseEvent.c b/macosx/tkMacOSXMouseEvent.c
index 9e57e7d..6f1b7cd 100644
--- a/macosx/tkMacOSXMouseEvent.c
+++ b/macosx/tkMacOSXMouseEvent.c
@@ -54,6 +54,7 @@ enum {
NSWindow *eventWindow = [theEvent window];
NSEventType eventType = [theEvent type];
NSRect viewFrame = [[eventWindow contentView] frame];
+ NSPoint location = [theEvent locationInWindow];
TkWindow *winPtr = NULL, *grabWinPtr;
Tk_Window tkwin = None, capture, target;
NSPoint local, global;
@@ -71,13 +72,12 @@ enum {
* If this event is not for a Tk toplevel, it should just be passed up the
* responder chain. However, there is an exception for synthesized events,
* which are used in testing. Those events are recognized by having their
- * (unused) pressure field set to the impossible value -1.0.
+ * both the windowNumber and the eventNumber set to -1.
*/
- if (![eventWindow isMemberOfClass:[TKWindow class]]) {
- if (eventWindow && [theEvent pressure] != -1.0) {
+ if (eventWindow && ![eventWindow isMemberOfClass:[TKWindow class]]) {
+ if ([theEvent windowNumber] != -1 || [theEvent eventNumber] != -1)
return theEvent;
- }
}
/*
@@ -85,8 +85,9 @@ enum {
*/
if (eventWindow) {
- inTitleBar = viewFrame.size.height < [theEvent locationInWindow].y;
+ inTitleBar = viewFrame.size.height < location.y;
}
+
button = [theEvent buttonNumber] + Button1;
switch (eventType) {
case NSRightMouseUp:
@@ -101,13 +102,16 @@ enum {
buttonState |= TkGetButtonMask(button);
break;
case NSMouseEntered:
- if (!inTitleBar) {
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ !inTitleBar) {
[(TKWindow *)eventWindow setMouseInResizeArea:YES];
}
break;
case NSMouseExited:
- [(TKWindow *)eventWindow setMouseInResizeArea:NO];
- break;
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)]) {
+ [(TKWindow *)eventWindow setMouseInResizeArea:NO];
+ break;
+ }
case NSLeftMouseUp:
case NSLeftMouseDown:
case NSMouseMoved:
@@ -128,9 +132,9 @@ enum {
* [39cbacb9e8].
*/
- if (eventType == NSLeftMouseDown || eventType == NSLeftMouseDragged) {
- if ([(TKWindow *)eventWindow mouseInResizeArea] &&
- ([eventWindow styleMask] & NSResizableWindowMask)) {
+ if (eventType == NSLeftMouseDown) {
+ if ([eventWindow respondsToSelector:@selector(mouseInResizeArea)] &&
+ [(TKWindow *) eventWindow mouseInResizeArea]) {
/*
* When the left button is pressed in the resize area, we receive
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index 002eae6..6ac766c 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -143,6 +143,7 @@ XMapWindow(
TkWindow *winPtr = macWin->winPtr;
NSWindow *win = TkMacOSXGetNSWindowForDrawable(window);
XEvent event;
+ static Bool initialized = NO;
/*
* Under certain situations it's possible for this function to be called
@@ -172,12 +173,14 @@ XMapWindow(
TkMacOSXApplyWindowAttributes(winPtr, win);
[win setExcludedFromWindowsMenu:NO];
- [NSApp activateIgnoringOtherApps:NO];
+ [NSApp activateIgnoringOtherApps:initialized];
[view addTkDirtyRect: [view bounds]];
- if ([win canBecomeKeyWindow]) {
- [win makeKeyAndOrderFront:NSApp];
- } else {
- [win orderFrontRegardless];
+ if (initialized) {
+ if ([win canBecomeKeyWindow]) {
+ [win makeKeyAndOrderFront:NSApp];
+ } else {
+ [win orderFrontRegardless];
+ }
}
} else {
TkWindow *contWinPtr = TkpGetOtherWindow(winPtr);
@@ -233,11 +236,15 @@ XMapWindow(
* Generate VisibilityNotify events for window and all mapped children.
*/
- event.xany.send_event = False;
- event.xany.display = display;
- event.xvisibility.type = VisibilityNotify;
- event.xvisibility.state = VisibilityUnobscured;
- NotifyVisibility(winPtr, &event);
+ if (initialized) {
+ event.xany.send_event = False;
+ event.xany.display = display;
+ event.xvisibility.type = VisibilityNotify;
+ event.xvisibility.state = VisibilityUnobscured;
+ NotifyVisibility(winPtr, &event);
+ } else {
+ initialized = YES;
+ }
return Success;
}
@@ -308,6 +315,7 @@ XUnmapWindow(
if (!Tk_IsEmbedded(winPtr) &&
winPtr->wmInfoPtr->hints.initial_state!=IconicState) {
[win orderOut:nil];
+ [win setExcludedFromWindowsMenu:YES];
}
TkMacOSXInvalClipRgns((Tk_Window)winPtr);
diff --git a/macosx/tkMacOSXTest.c b/macosx/tkMacOSXTest.c
index 52cda8f..7981f7e 100644
--- a/macosx/tkMacOSXTest.c
+++ b/macosx/tkMacOSXTest.c
@@ -178,8 +178,8 @@ TkTestLogDisplay(
* location. It injects NSEvents into the NSApplication event queue, as
* opposed to adding events to the Tcl queue as event generate would do.
* One application is for testing the grab command. These events have
- * pressure = -1.0 as a signal indicating that they should not be ignored
- * by [NSApp tkProcessMouseEvent].
+ * their unused context property set to 1 as a signal indicating that they
+ * should not be ignored by [NSApp tkProcessMouseEvent].
*
* Results:
* A standard Tcl result.
@@ -197,7 +197,8 @@ PressButtonObjCmd(
int objc,
Tcl_Obj *const objv[])
{
- int x = 0, y = 0, i, value, wNum;
+ int x = 0, y = 0, i, value;
+ NSInteger signal = -1;
CGPoint pt;
NSPoint loc;
NSEvent *motion, *press, *release;
@@ -231,35 +232,40 @@ PressButtonObjCmd(
pt.x = loc.x = x;
pt.y = y;
loc.y = ScreenHeight - y;
- wNum = 0;
+
+ /*
+ * We set the window number and the eventNumber to -1 as a signal to
+ * processMouseEvent.
+ */
+
CGWarpMouseCursorPosition(pt);
motion = [NSEvent mouseEventWithType:NSMouseMoved
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:0
+ eventNumber:signal
clickCount:1
- pressure:-1.0];
+ pressure:0.0];
[NSApp postEvent:motion atStart:NO];
press = [NSEvent mouseEventWithType:NSLeftMouseDown
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:1
+ eventNumber:signal
clickCount:1
- pressure:-1.0];
+ pressure:0.0];
[NSApp postEvent:press atStart:NO];
release = [NSEvent mouseEventWithType:NSLeftMouseUp
location:loc
modifierFlags:0
timestamp:GetCurrentEventTime()
- windowNumber:wNum
+ windowNumber:signal
context:nil
- eventNumber:2
+ eventNumber:signal
clickCount:1
pressure:-1.0];
[NSApp postEvent:release atStart:NO];
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 9e6c3dd..fcbd134 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -211,6 +211,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification;
TkWindow *winPtr = TkMacOSXGetTkWindow(window);
if (winPtr) {
TKContentView *view = [window contentView];
+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101500
if (@available(macOS 10.15, *)) {
[view viewDidChangeEffectiveAppearance];
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 6b7871f..b55f039 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -1827,7 +1827,7 @@ WmDeiconifyCmd(
ZoomState : NormalState);
[win setExcludedFromWindowsMenu:NO];
TkMacOSXApplyWindowAttributes(winPtr, win);
- [win orderFront:nil];
+ [win orderFront:NSApp];
if (wmPtr->icon) {
Tk_UnmapWindow((Tk_Window)wmPtr->icon);
}
@@ -6124,6 +6124,8 @@ TkMacOSXMakeRealWindowExist(
NSRect contentRect = NSMakeRect(5 - structureRect.origin.x,
TkMacOSXZeroScreenHeight() - (TkMacOSXZeroScreenTop() + 5 +
structureRect.origin.y + structureRect.size.height + 200), 200, 200);
+ if (wmPtr->hints.initial_state == WithdrawnState) {
+ }
TKWindow *window = [[winClass alloc] initWithContentRect:contentRect
styleMask:styleMask backing:NSBackingStoreBuffered defer:YES];
if (!window) {
@@ -6889,7 +6891,7 @@ ApplyContainerOverrideChanges(
}
} else {
if (wmPtr->macClass == kSimpleWindowClass &&
- oldAttributes == kWindowNoActivatesAttribute) {
+ (oldAttributes & kWindowNoActivatesAttribute)) {
wmPtr->macClass = kDocumentWindowClass;
wmPtr->attributes =
macClassAttrs[kDocumentWindowClass].defaultAttrs;
@@ -6921,7 +6923,7 @@ ApplyContainerOverrideChanges(
[macWindow setExcludedFromWindowsMenu:YES];
[macWindow setStyleMask:styleMask];
if (wmPtr->hints.initial_state == NormalState) {
- [macWindow orderFront:nil];
+ [macWindow orderFront:NSApp];
}
if (wmPtr->container != NULL) {
wmPtr->flags |= WM_TOPMOST;
diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c
index df597f4..3541dd8 100644
--- a/macosx/ttkMacOSXTheme.c
+++ b/macosx/ttkMacOSXTheme.c
@@ -303,9 +303,10 @@ static void GetBackgroundColor(
/*----------------------------------------------------------------------
- * +++ Single Arrow Buttons --
+ * +++ Single Arrow Images --
*
- * Used in ListHeaders and Comboboxes.
+ * Used in ListHeaders and Comboboxes as well as disclosure triangles in
+ * macOS 11.
*/
static void DrawDownArrow(
@@ -352,6 +353,48 @@ static void DrawUpArrow(
CGContextStrokePath(context);
}
+static void DrawClosedDisclosure(
+ CGContextRef context,
+ CGRect bounds,
+ CGFloat inset,
+ CGFloat size,
+ CGFloat *rgba)
+{
+ CGFloat x, y;
+
+ CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]);
+ CGContextSetLineWidth(context, 1.5);
+ x = bounds.origin.x + inset;
+ y = bounds.origin.y + trunc(bounds.size.height / 2);
+ CGContextBeginPath(context);
+ CGPoint arrow[3] = {
+ {x, y - size / 4 - 1}, {x + size / 2, y}, {x, y + size / 4 + 1}
+ };
+ CGContextAddLines(context, arrow, 3);
+ CGContextStrokePath(context);
+}
+
+static void DrawOpenDisclosure(
+ CGContextRef context,
+ CGRect bounds,
+ CGFloat inset,
+ CGFloat size,
+ CGFloat *rgba)
+{
+ CGFloat x, y;
+
+ CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]);
+ CGContextSetLineWidth(context, 1.5);
+ x = bounds.origin.x + inset;
+ y = bounds.origin.y + trunc(bounds.size.height / 2);
+ CGContextBeginPath(context);
+ CGPoint arrow[3] = {
+ {x, y - size / 4}, {x + size / 2, y + size / 2}, {x + size, y - size / 4}
+ };
+ CGContextAddLines(context, arrow, 3);
+ CGContextStrokePath(context);
+}
+
/*----------------------------------------------------------------------
* +++ Double Arrow Buttons --
*
@@ -2101,10 +2144,16 @@ static void TrackElementDraw(
Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value);
factor = RangeToFactor(to);
+ /*
+ * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate
+ * bounds variable avoids UBSan (-fsanitize=alignment) complaints.
+ */
+
+ CGRect bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind = data->kind,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = from * factor,
.max = to * factor,
.value = value * factor,
@@ -2239,13 +2288,19 @@ static void PbarElementDraw(
Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase);
factor = RangeToFactor(maximum);
+ /*
+ * HIThemeTrackDrawInfo uses 2-byte alignment; assigning to a separate
+ * bounds variable avoids UBSan (-fsanitize=alignment) complaints.
+ */
+
+ CGRect bounds = BoxToRect(d, b);
HIThemeTrackDrawInfo info = {
.version = 0,
.kind =
(!strcmp("indeterminate",
Tcl_GetString(pbar->modeObj)) && value) ?
kThemeIndeterminateBar : kThemeProgressBar,
- .bounds = BoxToRect(d, b),
+ .bounds = bounds,
.min = 0,
.max = maximum * factor,
.value = value * factor,
@@ -3001,8 +3056,21 @@ static void DisclosureElementDraw(
};
BEGIN_DRAWING(d)
- ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation,
+ if ([NSApp macOSVersion] >= 110000) {
+ CGFloat rgba[4];
+ NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace];
+ NSColor *stroke = [[NSColor textColor]
+ colorUsingColorSpace: deviceRGB];
+ [stroke getComponents: rgba];
+ if (state & TTK_TREEVIEW_STATE_OPEN) {
+ DrawOpenDisclosure(dc.context, bounds, 2, 8, rgba);
+ } else {
+ DrawClosedDisclosure(dc.context, bounds, 2, 12, rgba);
+ }
+ } else {
+ ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation,
NULL);
+ }
END_DRAWING
}
}
diff --git a/tests/all.tcl b/tests/all.tcl
index d15e5ca..3b6b75f 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -14,6 +14,7 @@ package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::configure -testdir [file normalize [file dirname [info script]]]
tcltest::configure -loadfile \
- [file join [tcltest::testsDirectory] constraints.tcl]
+ [file join [tcltest::testsDirectory] constraints.tcl]
tcltest::configure -singleproc 1
-tcltest::runAllTests
+set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/busy.test b/tests/busy.test
index cdce30e..98d83a8 100644
--- a/tests/busy.test
+++ b/tests/busy.test
@@ -6,7 +6,7 @@
#
# Copyright (c) 1998-2000 by Jos Decoster. All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
tcltest::configure {*}$argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
diff --git a/tests/canvMoveto.test b/tests/canvMoveto.test
index 79761a4..a6cf849 100644
--- a/tests/canvMoveto.test
+++ b/tests/canvMoveto.test
@@ -6,7 +6,7 @@
# Copyright (c) 2004 Neil McKay.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -33,7 +33,7 @@ test canvMoveto-1.5 {Bad args handling for "moveto" command} -body {
test canvMoveto-2.1 {Canvas "moveto" command coordinates} {
.c moveto test 200 150
.c bbox test
-} {200 150 272 232}
+} {200 150 272 232}
test canvMoveto-2.2 {Canvas "moveto" command, blank y coordinate} {
.c moveto test 200 150
.c moveto test 150 {}
diff --git a/tests/canvas.test b/tests/canvas.test
index 697badb..54bf500 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -7,7 +7,7 @@
# Copyright (c) 2008 Donal K. Fellows
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
imageInit
diff --git a/tests/color.test b/tests/color.test
index 4cdaf23..1e99a7d 100644
--- a/tests/color.test
+++ b/tests/color.test
@@ -5,7 +5,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -162,7 +162,7 @@ test color-1.4 {Tk_AllocColorFromObj - try other colors in list} colorsFree {
test color-1.5 {Color table} nonPortable {
set fd [open ../xlib/rgb.txt]
set result {}
- while {[gets $fd line] != -1} {
+ while {[gets $fd line] >= 0} {
if {[string index $line 0] == "!"} continue
set rgb [c255 [winfo rgb . [lrange $line 3 end]]]
if {$rgb != [lrange $line 0 2] } {
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index 9b48e8d..ee073cf 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -5,7 +5,7 @@ if {[namespace exists tk::test]} {
return
}
-package require Tk 8.4
+package require Tk
tk appname tktest
wm title . tktest
# If the main window isn't already mapped (e.g. because the tests are
@@ -17,7 +17,7 @@ if {![winfo ismapped .]} {
update
}
-package require tcltest 2.1
+package require tcltest 2.2
namespace eval tk {
namespace eval test {
diff --git a/tests/filebox.test b/tests/filebox.test
index 0114a07..fdb5614 100644
--- a/tests/filebox.test
+++ b/tests/filebox.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -167,7 +167,7 @@ foreach mode $modes {
catch {tk_getOpenFile -foo 1} msg
regsub -all , $msg "" options
regsub \"-foo\" $options "" options
-
+
foreach option $options {
if {[string index $option 0] eq "-"} {
test filebox-1.2-$mode$option "tk_getOpenFile command" -body {
diff --git a/tests/fontchooser.test b/tests/fontchooser.test
index 4dad5da..3fbc01f 100644
--- a/tests/fontchooser.test
+++ b/tests/fontchooser.test
@@ -2,7 +2,7 @@
#
# Copyright (c) 2008 Pat Thoyts
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index a2ebdfa..56484a6 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -503,8 +503,8 @@ test imageBmap-11.2 {ImgBmapDelete procedure} -body {
test imageBmap-12.1 {ImgBmapCmdDeletedProc procedure} -body {
image create bitmap i2 -file foo.bm -maskfile foo2.bm
rename i2 {}
- list [lsearch -exact [imageNames] i2] [catch {i2 foo} msg] $msg
-} -result {-1 1 {invalid command name "i2"}}
+ list [expr {"i2" in [imageNames]}] [catch {i2 foo} msg] $msg
+} -result {0 1 {invalid command name "i2"}}
removeFile foo.bm
removeFile foo2.bm
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 3c4c7a5..140d7fa 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -952,8 +952,8 @@ test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints {
} -body {
image create photo photo2 -file $teapotPhotoFile
rename photo2 {}
- list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg
-} -result {-1 1 {invalid command name "photo2"}}
+ list [expr {"photo2" in [imageNames]}] [catch {photo2 foo} msg] $msg
+} -result {0 1 {invalid command name "photo2"}}
test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup {
imageCleanup
diff --git a/tests/safePrimarySelection.test b/tests/safePrimarySelection.test
index e6ef487..8475ce3 100644
--- a/tests/safePrimarySelection.test
+++ b/tests/safePrimarySelection.test
@@ -17,8 +17,8 @@ tcltest::loadTestedCommands
# - Tests 3.*, 6.* test that the fix for ticket de156e9efe implemented in branch
# bug-de156e9efe has been applied and still works. They test that a Safe Base
# child interpreter cannot write to the PRIMARY selection.
-# - The other tests verify that the parent interpreter and an unsafe child CAN
-# write to the PRIMARY selection, and therefore that the test scripts
+# - The other tests verify that the parent interpreter and an child interpreter
+# CAN write to the PRIMARY selection, and therefore that the test scripts
# themselves are valid.
# - A text, entry, ttk::entry, listbox, spinbox or ttk::spinbox widget can have
# option -exportselection 1, meaning (in an unsafe interpreter) that a
@@ -33,7 +33,7 @@ namespace eval ::_test_tmp {}
# ------------------------------------------------------------------------------
# Proc ::_test_tmp::unsafeInterp
# ------------------------------------------------------------------------------
-# Command that creates an unsafe child interpreter and tries to load Tk.
+# Command that creates an child interpreter and tries to load Tk.
# - This is necessary for loading Tk if the tests are done in the build
# directory without installing Tk. In that case the usual auto_path loading
# mechanism cannot work because the tk binary is not where pkgIndex.tcl says
@@ -331,7 +331,7 @@ test safePrimarySelection-1.10 {parent interpreter, ttk::spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-2.1 {unsafe child interpreter, text, no existing selection} -setup {
+test safePrimarySelection-2.1 {child interpreter, text, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -348,7 +348,7 @@ test safePrimarySelection-2.1 {unsafe child interpreter, text, no existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.2 {unsafe child interpreter, entry, no existing selection} -setup {
+test safePrimarySelection-2.2 {child interpreter, entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -365,7 +365,7 @@ test safePrimarySelection-2.2 {unsafe child interpreter, entry, no existing sele
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.3 {unsafe child interpreter, ttk::entry, no existing selection} -setup {
+test safePrimarySelection-2.3 {child interpreter, ttk::entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -382,7 +382,7 @@ test safePrimarySelection-2.3 {unsafe child interpreter, ttk::entry, no existing
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.4 {unsafe child interpreter, listbox, no existing selection} -setup {
+test safePrimarySelection-2.4 {child interpreter, listbox, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -399,7 +399,7 @@ test safePrimarySelection-2.4 {unsafe child interpreter, listbox, no existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.5 {unsafe child interpreter, spinbox as entry, no existing selection} -setup {
+test safePrimarySelection-2.5 {child interpreter, spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -416,7 +416,7 @@ test safePrimarySelection-2.5 {unsafe child interpreter, spinbox as entry, no ex
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.6 {unsafe child interpreter, spinbox spun, no existing selection} -setup {
+test safePrimarySelection-2.6 {child interpreter, spinbox spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -433,7 +433,7 @@ test safePrimarySelection-2.6 {unsafe child interpreter, spinbox spun, no existi
::_test_tmp::clearPrimarySelection
} -result {2}
-test safePrimarySelection-2.7 {unsafe child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+test safePrimarySelection-2.7 {child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -450,7 +450,7 @@ test safePrimarySelection-2.7 {unsafe child interpreter, spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-2.8 {unsafe child interpreter, ttk::spinbox as entry, no existing selection} -setup {
+test safePrimarySelection-2.8 {child interpreter, ttk::spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -467,7 +467,7 @@ test safePrimarySelection-2.8 {unsafe child interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-2.9 {unsafe child interpreter, ttk::spinbox spun, no existing selection} -setup {
+test safePrimarySelection-2.9 {child interpreter, ttk::spinbox spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -484,7 +484,7 @@ test safePrimarySelection-2.9 {unsafe child interpreter, ttk::spinbox spun, no e
::_test_tmp::clearPrimarySelection
} -result {2}
-test safePrimarySelection-2.10 {unsafe child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+test safePrimarySelection-2.10 {child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -501,7 +501,7 @@ test safePrimarySelection-2.10 {unsafe child interpreter, ttk::spinbox spun/sele
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-3.1 {IMPORTANT, safe child interpreter, text, no existing selection} -setup {
+test safePrimarySelection-3.1 {IMPORTANT, safe interpreter, text, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -522,7 +522,7 @@ test safePrimarySelection-3.1 {IMPORTANT, safe child interpreter, text, no exist
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.2 {IMPORTANT, safe child interpreter, entry, no existing selection} -setup {
+test safePrimarySelection-3.2 {IMPORTANT, safe interpreter, entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -543,7 +543,7 @@ test safePrimarySelection-3.2 {IMPORTANT, safe child interpreter, entry, no exis
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.3 {IMPORTANT, safe child interpreter, ttk::entry, no existing selection} -setup {
+test safePrimarySelection-3.3 {IMPORTANT, safe interpreter, ttk::entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -564,7 +564,7 @@ test safePrimarySelection-3.3 {IMPORTANT, safe child interpreter, ttk::entry, no
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.4 {IMPORTANT, safe child interpreter, listbox, no existing selection} -setup {
+test safePrimarySelection-3.4 {IMPORTANT, safe interpreter, listbox, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -585,7 +585,7 @@ test safePrimarySelection-3.4 {IMPORTANT, safe child interpreter, listbox, no ex
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.5 {IMPORTANT, safe child interpreter, spinbox as entry, no existing selection} -setup {
+test safePrimarySelection-3.5 {IMPORTANT, safe interpreter, spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -606,7 +606,7 @@ test safePrimarySelection-3.5 {IMPORTANT, safe child interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.6 {IMPORTANT, safe child interpreter, spinbox spun, no existing selection} -setup {
+test safePrimarySelection-3.6 {IMPORTANT, safe interpreter, spinbox spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -627,7 +627,7 @@ test safePrimarySelection-3.6 {IMPORTANT, safe child interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.7 {IMPORTANT, safe child interpreter, spinbox spun/selected/spun, no existing selection} -setup {
+test safePrimarySelection-3.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -648,7 +648,7 @@ test safePrimarySelection-3.7 {IMPORTANT, safe child interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.8 {IMPORTANT, safe child interpreter, ttk::spinbox as entry, no existing selection} -setup {
+test safePrimarySelection-3.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -669,7 +669,7 @@ test safePrimarySelection-3.8 {IMPORTANT, safe child interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.9 {IMPORTANT, safe child interpreter, ttk::spinbox spun, no existing selection} -setup {
+test safePrimarySelection-3.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -690,7 +690,7 @@ test safePrimarySelection-3.9 {IMPORTANT, safe child interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {----}
-test safePrimarySelection-3.10 {IMPORTANT, safe child interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
+test safePrimarySelection-3.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, no existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::clearPrimarySelection
@@ -831,7 +831,7 @@ test safePrimarySelection-4.10 {parent interpreter, ttk::spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-5.1 {unsafe child interpreter, text, existing selection} -setup {
+test safePrimarySelection-5.1 {child interpreter, text, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -848,7 +848,7 @@ test safePrimarySelection-5.1 {unsafe child interpreter, text, existing selectio
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.2 {unsafe child interpreter, entry, existing selection} -setup {
+test safePrimarySelection-5.2 {child interpreter, entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -865,7 +865,7 @@ test safePrimarySelection-5.2 {unsafe child interpreter, entry, existing selecti
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.3 {unsafe child interpreter, ttk::entry, existing selection} -setup {
+test safePrimarySelection-5.3 {child interpreter, ttk::entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -882,7 +882,7 @@ test safePrimarySelection-5.3 {unsafe child interpreter, ttk::entry, existing se
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.4 {unsafe child interpreter, listbox, existing selection} -setup {
+test safePrimarySelection-5.4 {child interpreter, listbox, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -899,7 +899,7 @@ test safePrimarySelection-5.4 {unsafe child interpreter, listbox, existing selec
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.5 {unsafe child interpreter, spinbox as entry, existing selection} -setup {
+test safePrimarySelection-5.5 {child interpreter, spinbox as entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -916,7 +916,7 @@ test safePrimarySelection-5.5 {unsafe child interpreter, spinbox as entry, exist
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.6 {unsafe child interpreter, spinbox spun, existing selection} -setup {
+test safePrimarySelection-5.6 {child interpreter, spinbox spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -933,7 +933,7 @@ test safePrimarySelection-5.6 {unsafe child interpreter, spinbox spun, existing
::_test_tmp::clearPrimarySelection
} -result {2}
-test safePrimarySelection-5.7 {unsafe child interpreter, spinbox spun/selected/spun, existing selection} -setup {
+test safePrimarySelection-5.7 {child interpreter, spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -950,7 +950,7 @@ test safePrimarySelection-5.7 {unsafe child interpreter, spinbox spun/selected/s
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-5.8 {unsafe child interpreter, ttk::spinbox as entry, existing selection} -setup {
+test safePrimarySelection-5.8 {child interpreter, ttk::spinbox as entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -967,7 +967,7 @@ test safePrimarySelection-5.8 {unsafe child interpreter, ttk::spinbox as entry,
::_test_tmp::clearPrimarySelection
} -result {PAYLOAD}
-test safePrimarySelection-5.9 {unsafe child interpreter, ttk::spinbox spun, existing selection} -setup {
+test safePrimarySelection-5.9 {child interpreter, ttk::spinbox spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -984,7 +984,7 @@ test safePrimarySelection-5.9 {unsafe child interpreter, ttk::spinbox spun, exis
::_test_tmp::clearPrimarySelection
} -result {2}
-test safePrimarySelection-5.10 {unsafe child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+test safePrimarySelection-5.10 {child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1001,7 +1001,7 @@ test safePrimarySelection-5.10 {unsafe child interpreter, ttk::spinbox spun/sele
::_test_tmp::clearPrimarySelection
} -result {3}
-test safePrimarySelection-6.1 {IMPORTANT, safe child interpreter, text, existing selection} -setup {
+test safePrimarySelection-6.1 {IMPORTANT, safe interpreter, text, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1022,7 +1022,7 @@ test safePrimarySelection-6.1 {IMPORTANT, safe child interpreter, text, existing
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.2 {IMPORTANT, safe child interpreter, entry, existing selection} -setup {
+test safePrimarySelection-6.2 {IMPORTANT, safe interpreter, entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1043,7 +1043,7 @@ test safePrimarySelection-6.2 {IMPORTANT, safe child interpreter, entry, existin
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.3 {IMPORTANT, safe child interpreter, ttk::entry, existing selection} -setup {
+test safePrimarySelection-6.3 {IMPORTANT, safe interpreter, ttk::entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1064,7 +1064,7 @@ test safePrimarySelection-6.3 {IMPORTANT, safe child interpreter, ttk::entry, ex
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.4 {IMPORTANT, safe child interpreter, listbox, existing selection} -setup {
+test safePrimarySelection-6.4 {IMPORTANT, safe interpreter, listbox, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1085,7 +1085,7 @@ test safePrimarySelection-6.4 {IMPORTANT, safe child interpreter, listbox, exist
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.5 {IMPORTANT, safe child interpreter, spinbox as entry, existing selection} -setup {
+test safePrimarySelection-6.5 {IMPORTANT, safe interpreter, spinbox as entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1106,7 +1106,7 @@ test safePrimarySelection-6.5 {IMPORTANT, safe child interpreter, spinbox as ent
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.6 {IMPORTANT, safe child interpreter, spinbox spun, existing selection} -setup {
+test safePrimarySelection-6.6 {IMPORTANT, safe interpreter, spinbox spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1127,7 +1127,7 @@ test safePrimarySelection-6.6 {IMPORTANT, safe child interpreter, spinbox spun,
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.7 {IMPORTANT, safe child interpreter, spinbox spun/selected/spun, existing selection} -setup {
+test safePrimarySelection-6.7 {IMPORTANT, safe interpreter, spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1148,7 +1148,7 @@ test safePrimarySelection-6.7 {IMPORTANT, safe child interpreter, spinbox spun/s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.8 {IMPORTANT, safe child interpreter, ttk::spinbox as entry, existing selection} -setup {
+test safePrimarySelection-6.8 {IMPORTANT, safe interpreter, ttk::spinbox as entry, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1169,7 +1169,7 @@ test safePrimarySelection-6.8 {IMPORTANT, safe child interpreter, ttk::spinbox a
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.9 {IMPORTANT, safe child interpreter, ttk::spinbox spun, existing selection} -setup {
+test safePrimarySelection-6.9 {IMPORTANT, safe interpreter, ttk::spinbox spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
@@ -1190,7 +1190,7 @@ test safePrimarySelection-6.9 {IMPORTANT, safe child interpreter, ttk::spinbox s
::_test_tmp::clearPrimarySelection
} -result {OLD_VALUE----OLD_VALUE}
-test safePrimarySelection-6.10 {IMPORTANT, safe child interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
+test safePrimarySelection-6.10 {IMPORTANT, safe interpreter, ttk::spinbox spun/selected/spun, existing selection} -setup {
catch {interp delete child2}
destroy {*}[winfo children .]
::_test_tmp::setPrimarySelection
diff --git a/tests/scrollbar.test b/tests/scrollbar.test
index ae938dc..097ab79 100644
--- a/tests/scrollbar.test
+++ b/tests/scrollbar.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -23,7 +23,7 @@ proc getTroughSize {w} {
return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}]
} else {
return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}]
- }
+ }
} else {
if {[tk windowingsystem] eq "x11"} {
# Calculations here assume that the arrow area is a square.
@@ -60,7 +60,7 @@ proc getTroughSize {w} {
foreach {width height} [wm minsize .] {
set height [expr {($height < 200) ? 200 : $height}]
set width [expr {($width < 1) ? 1 : $width}]
-}
+}
frame .f -height $height -width $width
pack .f -side left
@@ -380,15 +380,15 @@ test scrollbar-3.59 {ScrollbarWidgetCmd procedure, "set" option} {
set result
} {0.0 0.3}
test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set 1.1 .4
+ .s set 1.1 .4
.s get
} {1.0 1.0}
test scrollbar-3.61 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set .5 -.3
+ .s set .5 -.3
.s get
} {0.5 0.5}
test scrollbar-3.62 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set .5 87
+ .s set .5 87
.s get
} {0.5 1.0}
test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} {
@@ -412,15 +412,15 @@ test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} {
list [catch {.s set 1 2 3 jkl} msg] $msg
} {1 {expected integer but got "jkl"}}
test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set -10 50 20 30
+ .s set -10 50 20 30
.s get
} {0 50 0 0}
test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set 100 -10 20 30
+ .s set 100 -10 20 30
.s get
} {100 0 20 30}
test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} {
- .s set 100 50 30 20
+ .s set 100 50 30 20
.s get
} {100 50 30 30}
test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} {
@@ -499,7 +499,7 @@ test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua {
.s identify 8 19
} {trough1}
test scrollbar-6.14 {ScrollbarPosition procedure} win {
- .s identify [expr {[winfo width .s] / 2}] 0
+ .s identify [expr {[winfo width .s] / 2}] 0
} {arrow1}
test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} {
.s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}]
@@ -610,7 +610,7 @@ test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua {
} {trough2}
test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} {
.t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s]
- - 1}] [expr {[winfo height .t.s] / 2}]
+ - 1}] [expr {[winfo height .t.s] / 2}]
} {slider}
test scrollbar-6.44 {ScrollbarPosition procedure} unix {
.t.s identify 100 18
@@ -759,7 +759,7 @@ test scrollbar-11.1 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi
update ; # shall not trigger error invalid command name ".top.s"
} -cleanup {
destroy .top.s .top
-} -result {}
+} -result {}
test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body {
proc destroy_scrollbar {{y 0}} {
if {[winfo exists .top.s]} {
@@ -778,7 +778,7 @@ test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destructi
update ; # shall not trigger error invalid command name ".top.s"
} -cleanup {
destroy .top.s .top
-} -result {}
+} -result {}
catch {destroy .s}
catch {destroy .t}
diff --git a/tests/send.test b/tests/send.test
index 403a207..7fdf0af 100644
--- a/tests/send.test
+++ b/tests/send.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 0881102..44297a0 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
@@ -612,7 +612,7 @@ if {$tcl_platform(platform) == "windows"} {
test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
# This test was failing on Windows because the title bar on .
# was a certain minimum size and it was interfering with the size
- # requested. The "overrideredirect" gets rid of the titlebar so
+ # requested. The "overrideredirect" gets rid of the titlebar so
# the toplevel can shrink to the appropriate size. On Unix, setting
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
@@ -644,7 +644,7 @@ set hlth [.t cget -highlightthickness]
test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
# This test was failing on Windows because the title bar on .
# was a certain minimum size and it was interfering with the size
- # requested. The "overrideredirect" gets rid of the titlebar so
+ # requested. The "overrideredirect" gets rid of the titlebar so
# the toplevel can shrink to the appropriate size. On Unix, setting
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
@@ -1912,7 +1912,7 @@ test textDisp-14.14 {TkTextXviewCmd procedure} {
.t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n"
.t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx"
.t xview moveto 0
- .t xview scroll 21 u
+ .t xview scroll 21 u
set x [.t index @0,22]
.t xview scroll -1 u
lappend x [.t index @0,22]
@@ -2369,7 +2369,7 @@ test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} {
.t xview moveto 0
.t scan mark 0 60
.t scan dragto 30 100
- .t scan dragto 25 95
+ .t scan dragto 25 95
.t index @0,0
} {4.7}
test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} {
@@ -2931,7 +2931,7 @@ test textDisp-20.1 {FindDLine} {
list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \
[.t dlineinfo 58.0]
} [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}]
-test textDisp-20.2 {FindDLine} {
+test textDisp-20.2 {FindDLine} {
.t yview 100.0
.t yview -pickplace 53.0
list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21]
@@ -2980,7 +2980,7 @@ test textDisp-21.4 {count -displaylines regression} {
Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines.
Connect with Tkcon. The command
-.u count -displaylines \
+.u count -displaylines \
3.10 2.173
should give answer -1; it gives me 5.
@@ -3884,7 +3884,7 @@ test textDisp-29.2.5 {miscellaneous: can show last character} {
set iWidth [lindex [.t2.t bbox end-2c] 2]
.t2.t xview scroll 2 units
set iWidth2 [lindex [.t2.t bbox end-2c] 2]
-
+
if {($iWidth == $iWidth2) && $iWidth >= 2} {
set result "correct"
} else {
diff --git a/tests/textIndex.test b/tests/textIndex.test
index 4db3548..bd4e955 100644
--- a/tests/textIndex.test
+++ b/tests/textIndex.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
namespace import -force tcltest::test
@@ -17,7 +17,7 @@ pack .t -expand 1 -fill both
update
.t debug on
wm geometry . {}
-
+
# The statements below reset the main window; it's needed if the window
# manager is mwm to make mwm forget about a previous minimum size setting.
diff --git a/tests/textWind.test b/tests/textWind.test
index db75c68..f2b5703 100644
--- a/tests/textWind.test
+++ b/tests/textWind.test
@@ -773,7 +773,7 @@ test textWind-10.6 {EmbWinLayoutProc procedure, error in creating window} -setup
.t delete 1.0 end
proc bgerror args {
global msg
- if {[lsearch -exact $msg $args] == -1} {
+ if {[lsearch -exact $msg $args] < 0} {
lappend msg $args
}
}
diff --git a/tests/tk.test b/tests/tk.test
index 748a6cf..30a36d9 100644
--- a/tests/tk.test
+++ b/tests/tk.test
@@ -157,7 +157,7 @@ test tk-6.5 {tk inactive} -body {
update
after 100
set i [tk inactive]
- expr {$i == -1 || ( $i > 90 && $i < 200 )}
+ expr {$i < 0 || ( $i > 90 && $i < 200 )}
} -result 1
test tk-7.1 {tk inactive in a safe interpreter} -body {
diff --git a/tests/ttk/all.tcl b/tests/ttk/all.tcl
index f03cd56..a75172f 100644
--- a/tests/ttk/all.tcl
+++ b/tests/ttk/all.tcl
@@ -16,5 +16,5 @@ tcltest::configure -testdir [file normalize [file dirname [info script]]]
tcltest::configure -loadfile \
[file join [file dirname [tcltest::testsDirectory]] constraints.tcl]
tcltest::configure -singleproc 1
-tcltest::runAllTests
-
+set ErrorOnFailures [info exists env(ERROR_ON_FAILURES)]
+if {[tcltest::runAllTests] && $ErrorOnFailures} {exit 1}
diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test
index 15d365f..8b8c9b7 100644
--- a/tests/ttk/checkbutton.test
+++ b/tests/ttk/checkbutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test checkbutton-1.1 "Checkbutton check" -body {
diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test
index c14db9b..ef77adb 100644
--- a/tests/ttk/combobox.test
+++ b/tests/ttk/combobox.test
@@ -2,8 +2,9 @@
# ttk::combobox widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test combobox-1.0 "Combobox tests -- setup" -body {
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index d5bcf45..6524d71 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -2,8 +2,9 @@
# Tile package: entry widget tests
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
variable scrollInfo
diff --git a/tests/ttk/image.test b/tests/ttk/image.test
index 5e48d5c..ea0ab1d 100644
--- a/tests/ttk/image.test
+++ b/tests/ttk/image.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test image-1.1 "Bad image element" -body {
diff --git a/tests/ttk/labelframe.test b/tests/ttk/labelframe.test
index 6b4761f..1f64d67 100644
--- a/tests/ttk/labelframe.test
+++ b/tests/ttk/labelframe.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test labelframe-1.0 "Setup" -body {
diff --git a/tests/ttk/layout.test b/tests/ttk/layout.test
index 52f44b4..5dfce9b 100644
--- a/tests/ttk/layout.test
+++ b/tests/ttk/layout.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test layout-1.1 "Size computations for mixed-orientation layouts" -body {
diff --git a/tests/ttk/notebook.test b/tests/ttk/notebook.test
index ac63088..fbab6bd 100644
--- a/tests/ttk/notebook.test
+++ b/tests/ttk/notebook.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test notebook-1.0 "Setup" -body {
diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test
index ad2865c..9d3cf77 100644
--- a/tests/ttk/panedwindow.test
+++ b/tests/ttk/panedwindow.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc propagate-geometry {} { update idletasks }
diff --git a/tests/ttk/progressbar.test b/tests/ttk/progressbar.test
index b9add86..abdb55a 100644
--- a/tests/ttk/progressbar.test
+++ b/tests/ttk/progressbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/radiobutton.test b/tests/ttk/radiobutton.test
index ba02954..09abcb8 100644
--- a/tests/ttk/radiobutton.test
+++ b/tests/ttk/radiobutton.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test radiobutton-1.1 "Radiobutton check" -body {
diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test
index 0743def..3c10853 100644
--- a/tests/ttk/scrollbar.test
+++ b/tests/ttk/scrollbar.test
@@ -1,5 +1,6 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}]
diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test
index 4bdabee..cd3b2ce 100644
--- a/tests/ttk/spinbox.test
+++ b/tests/ttk/spinbox.test
@@ -3,7 +3,8 @@
#
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
test spinbox-1.0 "Spinbox tests -- setup" -body {
diff --git a/tests/ttk/treetags.test b/tests/ttk/treetags.test
index f91673f..e3cd383 100644
--- a/tests/ttk/treetags.test
+++ b/tests/ttk/treetags.test
@@ -1,6 +1,7 @@
package require Tk
-package require tcltest ; namespace import -force tcltest::*
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
### treeview tag invariants:
diff --git a/tests/ttk/treeview.test b/tests/ttk/treeview.test
index f068243..51f20a5 100644
--- a/tests/ttk/treeview.test
+++ b/tests/ttk/treeview.test
@@ -3,8 +3,9 @@
# what it currently does)
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
# consistencyCheck --
diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test
index eb320e9..16d4506 100644
--- a/tests/ttk/ttk.test
+++ b/tests/ttk/ttk.test
@@ -1,6 +1,7 @@
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
proc skip args {}
diff --git a/tests/ttk/validate.test b/tests/ttk/validate.test
index 5755943..5430903 100644
--- a/tests/ttk/validate.test
+++ b/tests/ttk/validate.test
@@ -3,8 +3,8 @@
## Derived from core test suite entry-19.1 through entry-19.20
##
-package require Tk 8.5
-package require tcltest 2.1
+package require Tk
+package require tcltest 2.2
namespace import -force tcltest::*
loadTestedCommands
diff --git a/tests/ttk/vsapi.test b/tests/ttk/vsapi.test
index bb88fef..ec4e9e7 100644
--- a/tests/ttk/vsapi.test
+++ b/tests/ttk/vsapi.test
@@ -1,12 +1,13 @@
# -*- tcl -*-
#
-package require Tk 8.5
-package require tcltest ; namespace import -force tcltest::*
+package require Tk
+package require tcltest 2.2
+namespace import -force tcltest::*
loadTestedCommands
testConstraint xpnative \
- [expr {[lsearch -exact [ttk::style theme names] xpnative] != -1}]
+ [expr {"xpnative" in [ttk::style theme names]}]
test vsapi-1.1 "WINDOW WP_SMALLCLOSEBUTTON" -constraints {xpnative} -body {
ttk::style element create smallclose vsapi \
diff --git a/tests/unixEmbed.test b/tests/unixEmbed.test
index 0f9033f..cd7f15f 100644
--- a/tests/unixEmbed.test
+++ b/tests/unixEmbed.test
@@ -16,7 +16,7 @@ namespace eval ::_test_tmp {}
# ------------------------------------------------------------------------------
# Proc ::_test_tmp::testInterp
# ------------------------------------------------------------------------------
-# Command that creates an unsafe child interpreter and tries to load Tk.
+# Command that creates an child interpreter and tries to load Tk.
# This code is borrowed from safePrimarySelection.test
# This is necessary for loading Tktest if the tests are done in the build
# directory without installing Tk. In that case the usual auto_path loading
diff --git a/tests/unixFont.test b/tests/unixFont.test
index 177dab5..eb2a23b 100644
--- a/tests/unixFont.test
+++ b/tests/unixFont.test
@@ -12,7 +12,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/winSend.test b/tests/winSend.test
index 31c800e..d4860b4 100644
--- a/tests/winSend.test
+++ b/tests/winSend.test
@@ -7,7 +7,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
diff --git a/tests/wm.test b/tests/wm.test
index 58910dd..1eda872 100644
--- a/tests/wm.test
+++ b/tests/wm.test
@@ -11,7 +11,7 @@
# Window manager tests that only work on a specific platform should be placed
# in unixWm.test or winWm.test.
-package require tcltest 2.1
+package require tcltest 2.2
eval tcltest::configure $argv
tcltest::loadTestedCommands
@@ -1527,7 +1527,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body {
test wm-stackorder-5.2 {A normal toplevel can't be raised above an \
overrideredirect toplevel on unix} -constraints x11 -body {
toplevel .t
- tkwait visibility .t
+ tkwait visibility .t
wm overrideredirect .t 1
raise .
update
@@ -1539,7 +1539,7 @@ test wm-stackorder-5.2 {A normal toplevel can't be raised above an \
test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \
overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body {
toplevel .t
- tkwait visibility .t
+ tkwait visibility .t
wm overrideredirect .t 1
raise .
update
@@ -1551,7 +1551,7 @@ test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \
test wm-stackorder-5.3 {An overrideredirect window\
can be explicitly lowered} -body {
toplevel .t
- tkwait visibility .t
+ tkwait visibility .t
wm overrideredirect .t 1
lower .t
update
diff --git a/unix/tkUnixWm.c b/unix/tkUnixWm.c
index 00893f2..f1d1fe0 100644
--- a/unix/tkUnixWm.c
+++ b/unix/tkUnixWm.c
@@ -27,8 +27,8 @@ typedef struct ProtocolHandler {
/* Next in list of protocol handlers for the
* same top-level window, or NULL for end of
* list. */
- Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[1]; /* Tcl command to invoke when a client message
+ Tcl_Interp *interp; /* Interpreter in which to invoke command. */
+ char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message
* for this protocol arrives. The actual size
* of the structure varies to accommodate the
* needs of the actual command. THIS MUST BE
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 7967a61..1e1403f 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -654,8 +654,8 @@ TkpGetFontFamilies(
static int CALLBACK
WinFontFamilyEnumProc(
ENUMLOGFONTW *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
- int fontType, /* Type of font (not used). */
+ TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
+ TCL_UNUSED(int), /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
WCHAR *faceName = lfPtr->elfLogFont.lfFaceName;
@@ -1016,7 +1016,7 @@ TkpMeasureCharsInContext(
Tk_Font tkfont, /* Font in which characters will be drawn. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. */
- int numBytes, /* Maximum number of bytes to consider from
+ TCL_UNUSED(int), /* Maximum number of bytes to consider from
* source string in all. */
int rangeStart, /* Index of first byte to measure. */
int rangeLength, /* Length of range to measure in bytes. */
@@ -1038,8 +1038,6 @@ TkpMeasureCharsInContext(
int *lengthPtr) /* Filled with x-location just after the
* terminating character. */
{
- (void) numBytes; /*unused*/
-
return Tk_MeasureChars(tkfont, source + rangeStart, rangeLength,
maxLength, flags, lengthPtr);
}
@@ -1065,7 +1063,7 @@ Tk_DrawChars(
Display *display, /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
- Tk_Font tkfont, /* Font in which characters will be drawn;
+ TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn;
* must be the same as font used in GC. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
@@ -1212,7 +1210,7 @@ TkDrawAngledChars(
Display *display, /* Display on which to draw. */
Drawable drawable, /* Window or pixmap in which to draw. */
GC gc, /* Graphics context for drawing characters. */
- Tk_Font tkfont, /* Font in which characters will be drawn;
+ TCL_UNUSED(Tk_Font), /* Font in which characters will be drawn;
* must be the same as font used in GC. */
const char *source, /* UTF-8 string to be displayed. Need not be
* '\0' terminated. All Tk meta-characters
@@ -1390,7 +1388,7 @@ TkpDrawCharsInContext(
* is passed to this function. If they are not
* stripped out, they will be displayed as
* regular printing characters. */
- int numBytes, /* Number of bytes in string. */
+ TCL_UNUSED(int), /* Number of bytes in string. */
int rangeStart, /* Index of first byte to draw. */
int rangeLength, /* Length of range to draw in bytes. */
int x, int y) /* Coordinates at which to place origin of the
@@ -1398,7 +1396,6 @@ TkpDrawCharsInContext(
* drawing. */
{
int widthUntilStart;
- (void) numBytes; /*unused*/
Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
@@ -1498,9 +1495,9 @@ MultiFontTextOut(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
- familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
+ familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y,
(WCHAR *)Tcl_DStringValue(&runString),
- Tcl_DStringLength(&runString)>>familyPtr->isWideFont);
+ Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
familyPtr->getTextExtentPoint32Proc(hdc,
(WCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont,
@@ -1520,7 +1517,7 @@ MultiFontTextOut(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
(int) (p - source), &runString);
- familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y,
+ familyPtr->textOutProc(hdc, x-((double)tm.tmOverhang/2), y,
(WCHAR *)Tcl_DStringValue(&runString),
Tcl_DStringLength(&runString) >> familyPtr->isWideFont);
Tcl_DStringFree(&runString);
@@ -1771,7 +1768,7 @@ AllocFontFamily(
HDC hdc, /* HDC in which font can be selected. */
HFONT hFont, /* Screen font whose FontFamily is to be
* returned. */
- int base) /* Non-zero if this font family is to be used
+ TCL_UNUSED(int)) /* Non-zero if this font family is to be used
* in the base font of a font object. */
{
Tk_Uid faceName;
@@ -2069,8 +2066,8 @@ FindSubFontForChar(
static int CALLBACK
WinFontCanUseProc(
ENUMLOGFONTW *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
- int fontType, /* Type of font (not used). */
+ TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
+ TCL_UNUSED(int), /* Type of font (not used). */
LPARAM lParam) /* Result object to hold result. */
{
int ch;
@@ -2606,10 +2603,10 @@ FamilyOrAliasExists(
static int CALLBACK
WinFontExistProc(
- ENUMLOGFONTW *lfPtr, /* Logical-font data. */
- NEWTEXTMETRIC *tmPtr, /* Physical-font data (not used). */
- int fontType, /* Type of font (not used). */
- LPARAM lParam) /* EnumFontData to hold result. */
+ TCL_UNUSED(ENUMLOGFONTW *), /* Logical-font data. */
+ TCL_UNUSED(NEWTEXTMETRIC *), /* Physical-font data (not used). */
+ TCL_UNUSED(int), /* Type of font (not used). */
+ TCL_UNUSED(LPARAM)) /* EnumFontData to hold result. */
{
return 0;
}
diff --git a/win/tkWinWm.c b/win/tkWinWm.c
index 923a58f..ff83ad2 100644
--- a/win/tkWinWm.c
+++ b/win/tkWinWm.c
@@ -57,8 +57,8 @@ typedef struct ProtocolHandler {
/* Next in list of protocol handlers for the
* same top-level window, or NULL for end of
* list. */
- Tcl_Interp *interp; /* Interpreter in which to invoke command. */
- char command[1]; /* Tcl command to invoke when a client message
+ Tcl_Interp *interp; /* Interpreter in which to invoke command. */
+ char command[TKFLEXARRAY]; /* Tcl command to invoke when a client message
* for this protocol arrives. The actual size
* of the structure varies to accommodate the
* needs of the actual command. THIS MUST BE