summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-31 16:52:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-31 16:52:01 (GMT)
commit0bffbe8dfe9cd138fc970a3b8d026558f2f57847 (patch)
tree6b746a87b185ebdb1d5eb856075f278f6b0456dd
parentc4cd98fad6a0607ff3a895300539284b141a3dac (diff)
parenta5cb5cdaf088782fcccf2534e950c39a12c16f02 (diff)
downloadtk-0bffbe8dfe9cd138fc970a3b8d026558f2f57847.zip
tk-0bffbe8dfe9cd138fc970a3b8d026558f2f57847.tar.gz
tk-0bffbe8dfe9cd138fc970a3b8d026558f2f57847.tar.bz2
Merge 8.7
-rw-r--r--doc/SetOptions.34
-rw-r--r--generic/tk.h9
-rw-r--r--generic/tkCmds.c6
-rw-r--r--generic/tkConfig.c10
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkOption.c10
-rw-r--r--generic/tkWindow.c2
-rw-r--r--tests/place.test4
8 files changed, 31 insertions, 18 deletions
diff --git a/doc/SetOptions.3 b/doc/SetOptions.3
index 65fe8cd..0b58dc8 100644
--- a/doc/SetOptions.3
+++ b/doc/SetOptions.3
@@ -420,8 +420,8 @@ internal representation is set to zero.
The value must be standard relief such as \fBraised\fR.
The internal form is an integer relief value such as
\fBTK_RELIEF_RAISED\fR. This option type supports the \fBTK_OPTION_NULL_OK\fR
-flag; if the empty string is specified as the value for the option,
-the integer relief value is set to \fBTK_RELIEF_NULL\fR.
+flag; if a NULL value is set, the internal representation is set to
+\fBTK_RELIEF_NULL\fR.
.TP
\fBTK_OPTION_STRING\fR
The value may be any string. The internal form is a (char *) pointer
diff --git a/generic/tk.h b/generic/tk.h
index 3f87a43..8a3ed95 100644
--- a/generic/tk.h
+++ b/generic/tk.h
@@ -835,8 +835,13 @@ typedef struct Tk_FakeWin {
XIC dummy9; /* inputContext */
#endif /* TK_USE_INPUT_METHODS */
ClientData *dummy10; /* tagPtr */
- int dummy11; /* numTags */
- int dummy12; /* optionLevel */
+#if TCL_MAJOR_VERSION > 8
+ size_t dummy11; /* numTags */
+ size_t dummy12; /* optionLevel */
+#else
+ int dummy11;
+ int dummy12;
+#endif
char *dummy13; /* selHandlerList */
char *dummy14; /* geomMgrPtr */
ClientData dummy15; /* geomData */
diff --git a/generic/tkCmds.c b/generic/tkCmds.c
index 36981af..b745a96 100644
--- a/generic/tkCmds.c
+++ b/generic/tkCmds.c
@@ -269,7 +269,7 @@ TkBindEventProc(
#define MAX_OBJS 20
ClientData objects[MAX_OBJS], *objPtr;
TkWindow *topLevPtr;
- int i, count;
+ TkSizeT i, count;
const char *p;
Tcl_HashEntry *hPtr;
@@ -349,7 +349,7 @@ Tk_BindtagsObjCmd(
{
Tk_Window tkwin = (Tk_Window)clientData;
TkWindow *winPtr, *winPtr2;
- int i, length;
+ TkSizeT i, length;
const char *p;
Tcl_Obj *listPtr, **tags;
@@ -444,7 +444,7 @@ void
TkFreeBindingTags(
TkWindow *winPtr) /* Window whose tags are to be released. */
{
- int i;
+ TkSizeT i;
const char *p;
for (i = 0; i < winPtr->numTags; i++) {
diff --git a/generic/tkConfig.c b/generic/tkConfig.c
index 8b8703c..1545ad1 100644
--- a/generic/tkConfig.c
+++ b/generic/tkConfig.c
@@ -663,7 +663,15 @@ DoObjConfig(
valuePtr = NULL;
newDbl = 0;
} else {
- if (Tcl_GetDoubleFromObj(interp, valuePtr, &newDbl) != TCL_OK) {
+ if (Tcl_GetDoubleFromObj(nullOK ? NULL : interp, valuePtr, &newDbl) != TCL_OK) {
+ if (nullOK && interp) {
+ Tcl_Obj *msg = Tcl_NewStringObj("expected floating-point number or \"\" but got \"", -1);
+
+ Tcl_AppendLimitedToObj(msg, Tcl_GetString(valuePtr), -1, 50, "");
+ Tcl_AppendToObj(msg, "\"", -1);
+ Tcl_SetObjResult(interp, msg);
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "NUMBER", NULL);
+ }
return TCL_ERROR;
}
}
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 058eee3..4ff5dce 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -838,13 +838,13 @@ typedef struct TkWindow {
ClientData *tagPtr; /* Points to array of tags used for bindings
* on this window. Each tag is a Tk_Uid.
* Malloc'ed. NULL means no tags. */
- int numTags; /* Number of tags at *tagPtr. */
+ TkSizeT numTags; /* Number of tags at *tagPtr. */
/*
* Information used by tkOption.c to manage options for the window.
*/
- int optionLevel; /* -1 means no option information is currently
+ TkSizeT optionLevel; /* TCL_INDEX_NONE means no option information is currently
* cached for this window. Otherwise this
* gives the level in the option stack at
* which info is cached. */
diff --git a/generic/tkOption.c b/generic/tkOption.c
index 4668f28..4ba7830 100644
--- a/generic/tkOption.c
+++ b/generic/tkOption.c
@@ -751,11 +751,11 @@ TkOptionDeadWindow(
* XXX: tsd. Tk shutdown needs to be verified to handle this correctly.
*/
- if (tsdPtr->initialized && (winPtr->optionLevel != -1)) {
+ if (tsdPtr->initialized && (winPtr->optionLevel != TCL_INDEX_NONE)) {
int i;
for (i = 1; i <= tsdPtr->curLevel; i++) {
- tsdPtr->levels[i].winPtr->optionLevel = -1;
+ tsdPtr->levels[i].winPtr->optionLevel = TCL_INDEX_NONE;
}
tsdPtr->curLevel = -1;
tsdPtr->cachedWindow = NULL;
@@ -799,7 +799,7 @@ TkOptionClassChanged(
ThreadSpecificData *tsdPtr = (ThreadSpecificData *)
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
- if (winPtr->optionLevel == -1) {
+ if (winPtr->optionLevel == TCL_INDEX_NONE) {
return;
}
@@ -811,7 +811,7 @@ TkOptionClassChanged(
for (i = 1; i <= tsdPtr->curLevel; i++) {
if (tsdPtr->levels[i].winPtr == winPtr) {
for (j = i; j <= tsdPtr->curLevel; j++) {
- tsdPtr->levels[j].winPtr->optionLevel = -1;
+ tsdPtr->levels[j].winPtr->optionLevel = TCL_INDEX_NONE;
}
tsdPtr->curLevel = i-1;
basePtr = tsdPtr->levels[i].bases;
@@ -1269,7 +1269,7 @@ SetupStacks(
if (tsdPtr->curLevel >= level) {
while (tsdPtr->curLevel >= level) {
- tsdPtr->levels[tsdPtr->curLevel].winPtr->optionLevel = -1;
+ tsdPtr->levels[tsdPtr->curLevel].winPtr->optionLevel = TCL_INDEX_NONE;
tsdPtr->curLevel--;
}
levelPtr = &tsdPtr->levels[level];
diff --git a/generic/tkWindow.c b/generic/tkWindow.c
index 8aaf3e6..904a336 100644
--- a/generic/tkWindow.c
+++ b/generic/tkWindow.c
@@ -658,7 +658,7 @@ TkAllocWindow(
winPtr->inputContext = NULL;
winPtr->tagPtr = NULL;
winPtr->numTags = 0;
- winPtr->optionLevel = -1;
+ winPtr->optionLevel = TCL_INDEX_NONE;
winPtr->selHandlerList = NULL;
winPtr->geomMgrPtr = NULL;
winPtr->geomData = NULL;
diff --git a/tests/place.test b/tests/place.test
index f0dd513..49edeb0 100644
--- a/tests/place.test
+++ b/tests/place.test
@@ -79,7 +79,7 @@ test place-2.3 {ConfigureContent procedure, -height option} -setup {
test place-3.1 {ConfigureContent procedure, -relheight option} -body {
place .t.f2 -relheight abcd
-} -returnCodes error -result {expected floating-point number but got "abcd"}
+} -returnCodes error -result {expected floating-point number or "" but got "abcd"}
test place-3.2 {ConfigureContent procedure, -relheight option} -setup {
place forget .t.f2
} -body {
@@ -144,7 +144,7 @@ test place-4.7 {prevent management loops} -setup {
test place-5.1 {ConfigureContent procedure, -relwidth option} -body {
place .t.f2 -relwidth abcd
-} -returnCodes error -result {expected floating-point number but got "abcd"}
+} -returnCodes error -result {expected floating-point number or "" but got "abcd"}
test place-5.2 {ConfigureContent procedure, -relwidth option} -setup {
place forget .t.f2
} -body {