summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2022-11-03 21:46:28 (GMT)
committerfvogel <fvogelnew1@free.fr>2022-11-03 21:46:28 (GMT)
commit6a9db1dd4c7f1274d9d14bdb5900ec0a107a560b (patch)
tree164cb06b2e0a0eeb133aeecab95eb8ee3d3153bb
parent223e32b9ec73d1af56f46d750d010bb4d2056a37 (diff)
parente0a9d8d3100de26a961418e9ab3fc6087014e00b (diff)
downloadtk-6a9db1dd4c7f1274d9d14bdb5900ec0a107a560b.zip
tk-6a9db1dd4c7f1274d9d14bdb5900ec0a107a560b.tar.gz
tk-6a9db1dd4c7f1274d9d14bdb5900ec0a107a560b.tar.bz2
merge 8.6
-rw-r--r--generic/tkImgBmap.c50
-rw-r--r--generic/tkInt.h4
-rw-r--r--generic/tkText.h2
-rw-r--r--library/demos/cscroll.tcl2
-rw-r--r--library/demos/entry2.tcl6
-rw-r--r--library/demos/goldberg.tcl2
-rw-r--r--library/demos/items.tcl2
-rw-r--r--library/demos/menu.tcl2
-rw-r--r--tests/imgBmap.test2
-rw-r--r--tests/textDisp.test12
-rw-r--r--tests/winfo.test2
11 files changed, 39 insertions, 47 deletions
diff --git a/generic/tkImgBmap.c b/generic/tkImgBmap.c
index a8e4517..a7fd14e 100644
--- a/generic/tkImgBmap.c
+++ b/generic/tkImgBmap.c
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
- * Copyright (c) 1999 by Scriptics Corporation.
+ * Copyright (c) 1999 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -169,7 +169,6 @@ static int NextBitmapWord(ParseInfo *parseInfoPtr);
*----------------------------------------------------------------------
*/
- /* ARGSUSED */
static int
ImgBmapCreate(
Tcl_Interp *interp, /* Interpreter for application containing
@@ -178,13 +177,13 @@ ImgBmapCreate(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[], /* Argument objects for options (doesn't
* include image name or type). */
- const Tk_ImageType *typePtr,/* Pointer to our type record (not used). */
- Tk_ImageModel model, /* Token for image, to be used by us in later
+ TCL_UNUSED(const Tk_ImageType *),/* Pointer to our type record (not used). */
+ Tk_ImageModel model, /* Token for image, to be used by us in later
* callbacks. */
ClientData *clientDataPtr) /* Store manager's token for image here; it
* will be returned in later callbacks. */
{
- BitmapModel *modelPtr = ckalloc(sizeof(BitmapModel));
+ BitmapModel *modelPtr = (BitmapModel *)ckalloc(sizeof(BitmapModel));
modelPtr->tkModel = model;
modelPtr->interp = interp;
@@ -239,19 +238,11 @@ ImgBmapConfigureModel(
{
BitmapInstance *instancePtr;
int maskWidth, maskHeight, dummy1, dummy2;
- const char **argv = ckalloc((objc+1) * sizeof(char *));
-
- for (dummy1 = 0; dummy1 < objc; dummy1++) {
- argv[dummy1] = Tcl_GetString(objv[dummy1]);
- }
- argv[objc] = NULL;
if (Tk_ConfigureWidget(modelPtr->interp, Tk_MainWindow(modelPtr->interp),
- configSpecs, objc, argv, (char *) modelPtr, flags) != TCL_OK) {
- ckfree(argv);
+ configSpecs, objc, (const char **) objv, (char *) modelPtr, flags|TK_CONFIG_OBJS) != TCL_OK) {
return TCL_ERROR;
}
- ckfree(argv);
/*
* Parse the bitmap and/or mask to create binary data. Make sure that the
@@ -500,13 +491,15 @@ TkGetBitmapData(
Tcl_SetErrorCode(interp, "TK", "SAFE", "BITMAP_FILE", NULL);
return NULL;
}
- expandedFileName = Tcl_TranslateFileName(interp, fileName, &buffer);
+ expandedFileName = Tcl_TranslateFileName(NULL, fileName, &buffer);
if (expandedFileName == NULL) {
- return NULL;
+ Tcl_SetErrno(ENOENT);
+ goto cannotRead;
}
pi.chan = Tcl_OpenFileChannel(interp, expandedFileName, "r", 0);
Tcl_DStringFree(&buffer);
if (pi.chan == NULL) {
+ cannotRead:
if (interp != NULL) {
Tcl_ResetResult(interp);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
@@ -620,7 +613,7 @@ TkGetBitmapData(
goto error;
}
numBytes = ((width+7)/8) * height;
- data = ckalloc(numBytes);
+ data = (char *)ckalloc(numBytes);
for (p = data; numBytes > 0; p++, numBytes--) {
if (NextBitmapWord(&pi) != TCL_OK) {
goto error;
@@ -757,7 +750,7 @@ ImgBmapCmd(
Tcl_Obj *const objv[]) /* Argument objects. */
{
static const char *const bmapOptions[] = {"cget", "configure", NULL};
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
int index;
if (objc < 2) {
@@ -819,7 +812,7 @@ ImgBmapGet(
ClientData modelData) /* Pointer to our model structure for the
* image. */
{
- BitmapModel *modelPtr = modelData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
BitmapInstance *instancePtr;
/*
@@ -840,7 +833,7 @@ ImgBmapGet(
* the image.
*/
- instancePtr = ckalloc(sizeof(BitmapInstance));
+ instancePtr = (BitmapInstance *)ckalloc(sizeof(BitmapInstance));
instancePtr->refCount = 1;
instancePtr->modelPtr = modelPtr;
instancePtr->tkwin = tkwin;
@@ -894,7 +887,7 @@ ImgBmapDisplay(
/* Coordinates within drawable that correspond
* to imageX and imageY. */
{
- BitmapInstance *instancePtr = clientData;
+ BitmapInstance *instancePtr = (BitmapInstance *)clientData;
int masking;
/*
@@ -948,11 +941,10 @@ ImgBmapFree(
* instance to be displayed. */
Display *display) /* Display containing window that used image. */
{
- BitmapInstance *instancePtr = clientData;
+ BitmapInstance *instancePtr = (BitmapInstance *)clientData;
BitmapInstance *prevPtr;
- instancePtr->refCount--;
- if (instancePtr->refCount > 0) {
+ if (instancePtr->refCount-- > 1) {
return;
}
@@ -1010,7 +1002,7 @@ ImgBmapDelete(
ClientData modelData) /* Pointer to BitmapModel structure for
* image. Must not have any more instances. */
{
- BitmapModel *modelPtr = modelData;
+ BitmapModel *modelPtr = (BitmapModel *)modelData;
if (modelPtr->instancePtr != NULL) {
Tcl_Panic("tried to delete bitmap image when instances still exist");
@@ -1051,7 +1043,7 @@ ImgBmapCmdDeletedProc(
ClientData clientData) /* Pointer to BitmapModel structure for
* image. */
{
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
modelPtr->imageCmd = NULL;
if (modelPtr->tkModel != NULL) {
@@ -1080,10 +1072,8 @@ GetByte(
Tcl_Channel chan) /* The channel we read from. */
{
char buffer;
- int size;
- size = Tcl_Read(chan, &buffer, 1);
- if (size != 1) {
+ if (Tcl_Read(chan, &buffer, 1) != 1) {
return EOF;
} else {
return buffer;
@@ -1198,7 +1188,7 @@ ImgBmapPostscript(
int x, int y, int width, int height,
int prepass)
{
- BitmapModel *modelPtr = clientData;
+ BitmapModel *modelPtr = (BitmapModel *)clientData;
Tcl_InterpState interpState;
Tcl_Obj *psObj;
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 72fd9b4..35b7e67 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -86,7 +86,9 @@
# endif
#endif
-#if defined(__GNUC__) && (__GNUC__ > 2)
+#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
+# define TKFLEXARRAY
+#elif defined(__GNUC__) && (__GNUC__ > 2)
# define TKFLEXARRAY 0
#else
# define TKFLEXARRAY 1
diff --git a/generic/tkText.h b/generic/tkText.h
index 9898462..d3c1cc9 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[TKFLEXARRAY]; /* Characters that make up character info.
+ char chars[TCL_UTF_MAX]; /* Characters that make up character info.
* Actual length varies to hold as many
* characters as needed.*/
TkTextToggle toggle; /* Information about tag toggle. */
diff --git a/library/demos/cscroll.tcl b/library/demos/cscroll.tcl
index c88bfa9..98a4be2 100644
--- a/library/demos/cscroll.tcl
+++ b/library/demos/cscroll.tcl
@@ -25,7 +25,7 @@ set btns [addSeeDismiss $w.buttons $w]
pack $btns -side bottom -fill x
frame $w.grid
-scrollbar $w.hscroll -orient horiz -command "$c xview"
+scrollbar $w.hscroll -orient horizontal -command "$c xview"
scrollbar $w.vscroll -command "$c yview"
canvas $c -relief sunken -borderwidth 2 -scrollregion {-11c -11c 50c 20c} \
-xscrollcommand "$w.hscroll set" \
diff --git a/library/demos/entry2.tcl b/library/demos/entry2.tcl
index 6405d85..a4009a7 100644
--- a/library/demos/entry2.tcl
+++ b/library/demos/entry2.tcl
@@ -27,15 +27,15 @@ frame $w.frame -borderwidth 10
pack $w.frame -side top -fill x -expand 1
entry $w.frame.e1 -xscrollcommand "$w.frame.s1 set"
-ttk::scrollbar $w.frame.s1 -orient horiz -command \
+ttk::scrollbar $w.frame.s1 -orient horizontal -command \
"$w.frame.e1 xview"
frame $w.frame.spacer1 -width 20 -height 10
entry $w.frame.e2 -xscrollcommand "$w.frame.s2 set"
-ttk::scrollbar $w.frame.s2 -orient horiz -command \
+ttk::scrollbar $w.frame.s2 -orient horizontal -command \
"$w.frame.e2 xview"
frame $w.frame.spacer2 -width 20 -height 10
entry $w.frame.e3 -xscrollcommand "$w.frame.s3 set"
-ttk::scrollbar $w.frame.s3 -orient horiz -command \
+ttk::scrollbar $w.frame.s3 -orient horizontal -command \
"$w.frame.e3 xview"
pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \
$w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x
diff --git a/library/demos/goldberg.tcl b/library/demos/goldberg.tcl
index 7bedfa9..90815fb 100644
--- a/library/demos/goldberg.tcl
+++ b/library/demos/goldberg.tcl
@@ -136,7 +136,7 @@ proc DoCtrlFrame {w} {
ttk::labelframe $w.message -text "Message"
ttk::entry $w.message.e -textvariable S(message) -justify center
ttk::labelframe $w.speed -text "Speed: 0"
- ttk::scale $w.speed.scale -orient h -from 1 -to 10 -variable S(speed)
+ ttk::scale $w.speed.scale -orient horizontal -from 1 -to 10 -variable S(speed)
ttk::button $w.about -text About -command [list About $w]
grid $w.start -in $w.ctrl -row 0 -sticky ew
diff --git a/library/demos/items.tcl b/library/demos/items.tcl
index 1297046..19cd4f4 100644
--- a/library/demos/items.tcl
+++ b/library/demos/items.tcl
@@ -32,7 +32,7 @@ canvas $c -scrollregion {0c 0c 30c 24c} -width 15c -height 10c \
-xscrollcommand "$w.frame.hscroll set" \
-yscrollcommand "$w.frame.vscroll set"
ttk::scrollbar $w.frame.vscroll -command "$c yview"
-ttk::scrollbar $w.frame.hscroll -orient horiz -command "$c xview"
+ttk::scrollbar $w.frame.hscroll -orient horizontal -command "$c xview"
grid $c -in $w.frame \
-row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news
diff --git a/library/demos/menu.tcl b/library/demos/menu.tcl
index dc5ce9b..4f5d703 100644
--- a/library/demos/menu.tcl
+++ b/library/demos/menu.tcl
@@ -55,7 +55,7 @@ menu $m -tearoff 0
$m add command -label "Long entry that does nothing"
if {[tk windowingsystem] eq "aqua"} {
set modifier Command
-} elseif {[tk windowingsystem] == "win32"} {
+} elseif {[tk windowingsystem] eq "win32"} {
set modifier Control
} else {
set modifier Meta
diff --git a/tests/imgBmap.test b/tests/imgBmap.test
index 56484a6..bb54012 100644
--- a/tests/imgBmap.test
+++ b/tests/imgBmap.test
@@ -221,7 +221,7 @@ test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} -s
test imageBmap-5.1 {GetBitmapData procedure} -body {
list [catch {image create bitmap -file ~bad_user/a/b} msg] \
[string tolower $msg]
-} -result {1 {user "bad_user" doesn't exist}}
+} -result {1 {couldn't read bitmap file "~bad_user/a/b": no such file or directory}}
test imageBmap-5.2 {GetBitmapData procedure} -body {
list [catch {image create bitmap -file bad_name} msg] [string tolower $msg]
} -result {1 {couldn't read bitmap file "bad_name": no such file or directory}}
diff --git a/tests/textDisp.test b/tests/textDisp.test
index 613a990..17c3e07 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -713,7 +713,7 @@ test textDisp-4.4 {UpdateDisplayInfo, wrap-mode "none"} {
[list [xchar 0] [yline 3] $fixedWidth $fixedHeight] \
{1.0 2.0 3.0}]
test textDisp-4.5 {UpdateDisplayInfo, tiny window} {
- if {[tk windowingsystem] == "win32"} {
+ if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 1
}
wm geom . 103x$height
@@ -727,7 +727,7 @@ test textDisp-4.5 {UpdateDisplayInfo, tiny window} {
{} \
[list [xchar 0] [yline 3] 1 $fixedHeight] \
{1.0 2.0 3.0}]
-if {[tk windowingsystem] == "win32"} {
+if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 0
}
test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
@@ -738,7 +738,7 @@ test textDisp-4.6 {UpdateDisplayInfo, tiny window} {
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
- if {[tk windowingsystem] == "win32"} {
+ if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 1
}
frame .f2 -width 20 -height 100
@@ -767,7 +767,7 @@ test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} {
# the overrideredirect on "." confuses the window manager and
# causes subsequent tests to fail.
- if {[tk windowingsystem] == "win32"} {
+ if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 1
}
.t delete 1.0 end
@@ -3729,7 +3729,7 @@ test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {
lequal [list [.t bbox 1.19] [.t bbox 1.20]] $expected
} {1}
test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {
- if {[tk windowingsystem] == "win32"} {
+ if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 1
}
.t configure -wrap char
@@ -3743,7 +3743,7 @@ test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {
} [list [list [xchar 0] [yline 1] 1 $fixedHeight] \
[list [xchar 0] [yline 2] 1 $fixedHeight] \
[list [xchar 0] [yline 3] 1 $fixedHeight]]
-if {[tk windowingsystem] == "win32"} {
+if {[tk windowingsystem] eq "win32"} {
wm overrideredirect . 0
}
test textDisp-24.17 {TkTextCharLayoutProc, -wrap word} {
diff --git a/tests/winfo.test b/tests/winfo.test
index 750444f..045696d 100644
--- a/tests/winfo.test
+++ b/tests/winfo.test
@@ -399,7 +399,7 @@ test winfo-13.1 {root coordinates of embedded toplevel} -setup {
# Windows does not destroy the container when an embedded window is
# destroyed. Unix and macOS do destroy it. See ticket [67384bce7d].
-if {[tk windowingsystem] == "win32"} {
+if {[tk windowingsystem] eq "win32"} {
set result_13_2 {embedded 0 container 1}
} else {
set result_13_2 {embedded 0 container 0}