From 79f1680934a9a65f01fb704010a12bd598c48062 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Jan 2021 09:32:44 +0000 Subject: [PATCH 1/2] When generating stubs, always read *.decls and *Decls.h files in UTF-8. This corrects possible invalid UTF-8. --- tools/genStubs.tcl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index bc0d70014222..5b7278c70356 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -257,8 +257,9 @@ proc genStubs::rewriteFile {file text} { return } set in [open ${file} r] + fconfigure $in -eofchar "\032 {}" -encoding utf-8 set out [open ${file}.new w] - fconfigure $out -translation lf + fconfigure $out -translation lf -encoding utf-8 while {![eof $in]} { set line [gets $in] @@ -1191,7 +1192,7 @@ proc genStubs::init {} { set outDir [lindex $argv 0] foreach file [lrange $argv 1 end] { - source $file + source -encoding utf-8 $file } foreach name [lsort [array names interfaces]] { From 9bdfc33536ff44fa87fa085fb39c6061921e2913 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 27 Jan 2021 10:13:51 +0000 Subject: [PATCH 2/2] *.decls files are now in UTF-8. Use "in" operator in stead of "lsearch -exact". --- generic/tcl.decls | 6 +++--- generic/tclInt.decls | 6 +++--- generic/tclOO.decls | 2 +- generic/tclTomMath.decls | 2 +- tools/genStubs.tcl | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/generic/tcl.decls b/generic/tcl.decls index 23e8f6af437b..13e7326bbd72 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -5,9 +5,9 @@ # This file is used to generate the tclDecls.h, tclPlatDecls.h # and tclStubInit.c files. # -# Copyright (c) 1998-1999 by Scriptics Corporation. -# Copyright (c) 2001, 2002 by Kevin B. Kenny. All rights reserved. -# Copyright (c) 2007 Daniel A. Steffen +# Copyright © 1998-1999 Scriptics Corporation. +# Copyright © 2001, 2002 Kevin B. Kenny. All rights reserved. +# Copyright © 2007 Daniel A. Steffen # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/generic/tclInt.decls b/generic/tclInt.decls index b858dfa43a8b..b6f7b752e9e3 100644 --- a/generic/tclInt.decls +++ b/generic/tclInt.decls @@ -5,9 +5,9 @@ # is used to generate the tclIntDecls.h, tclIntPlatDecls.h # and tclStubInit.c files # -# Copyright (c) 1998-1999 by Scriptics Corporation. -# Copyright (c) 2001 by Kevin B. Kenny. All rights reserved. -# Copyright (c) 2007 Daniel A. Steffen +# Copyright © 1998-1999 Scriptics Corporation. +# Copyright © 2001 Kevin B. Kenny. All rights reserved. +# Copyright © 2007 Daniel A. Steffen # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/generic/tclOO.decls b/generic/tclOO.decls index 265ba88dcef0..5d37994b790a 100644 --- a/generic/tclOO.decls +++ b/generic/tclOO.decls @@ -5,7 +5,7 @@ # library via the stubs table. This file is used to generate the # tclOODecls.h, tclOOIntDecls.h and tclOOStubInit.c files. # -# Copyright (c) 2008-2013 by Donal K. Fellows. +# Copyright © 2008-2013 Donal K. Fellows. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/generic/tclTomMath.decls b/generic/tclTomMath.decls index 2511e3ac0136..02d358147a9c 100644 --- a/generic/tclTomMath.decls +++ b/generic/tclTomMath.decls @@ -7,7 +7,7 @@ # If you edit this file, advance the revision number (and the epoch # if the new stubs are not backward compatible) in tclTomMathDecls.h # -# Copyright (c) 2005 by Kevin B. Kenny. All rights reserved. +# Copyright © 2005 Kevin B. Kenny. All rights reserved. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. diff --git a/tools/genStubs.tcl b/tools/genStubs.tcl index 5b7278c70356..47b8ad4390fc 100644 --- a/tools/genStubs.tcl +++ b/tools/genStubs.tcl @@ -1101,7 +1101,7 @@ proc genStubs::emitInit {name textVar} { } foreach intf [array names interfaces] { if {[info exists hooks($intf)]} { - if {[lsearch -exact $hooks($intf) $name] >= 0} { + if {$name in $hooks($intf)} { set root 0 break }