summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-08 23:11:16 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-11-08 23:11:16 (GMT)
commit5ad22cafaf30e790570411e299b644551c4826a5 (patch)
tree2bf6833eff476bdd45350195b780a3ca0d56c4cf
parentf3ce97fe147b1c809f1aba0267c6aa3de12b1597 (diff)
parentfa56430c8b7ebbd159d6e3b45ecfd04f2a193d9b (diff)
downloadtcl-5ad22cafaf30e790570411e299b644551c4826a5.zip
tcl-5ad22cafaf30e790570411e299b644551c4826a5.tar.gz
tcl-5ad22cafaf30e790570411e299b644551c4826a5.tar.bz2
Merge 8.7
-rw-r--r--changes307
-rw-r--r--doc/ByteArrObj.3201
-rw-r--r--doc/binary.n2
-rw-r--r--generic/tcl.decls22
-rw-r--r--generic/tclBinary.c267
-rw-r--r--generic/tclDecls.h47
-rw-r--r--generic/tclDictObj.c1
-rw-r--r--generic/tclEncoding.c30
-rw-r--r--generic/tclInt.decls5
-rw-r--r--generic/tclInt.h19
-rw-r--r--generic/tclIntDecls.h10
-rw-r--r--generic/tclObj.c51
-rw-r--r--generic/tclStubInit.c7
-rw-r--r--generic/tclTest.c4
-rw-r--r--generic/tclZipfs.c47
-rw-r--r--generic/tclZlib.c2
-rw-r--r--library/manifest.txt2
-rw-r--r--library/platform/pkgIndex.tcl2
-rw-r--r--library/platform/platform.tcl13
-rw-r--r--library/tzdata/Asia/Gaza158
-rw-r--r--library/tzdata/Asia/Hebron158
-rw-r--r--tests/cmdIL.test2
-rw-r--r--tests/format.test4
-rw-r--r--tests/io.test2
-rw-r--r--tests/lset.test2
-rw-r--r--tests/var.test2
-rw-r--r--unix/Makefile.in4
-rwxr-xr-xunix/configure45
-rw-r--r--unix/tcl.m452
-rw-r--r--win/Makefile.in4
-rw-r--r--win/README6
31 files changed, 818 insertions, 660 deletions
diff --git a/changes b/changes
index 96350a1..52e6f81 100644
--- a/changes
+++ b/changes
@@ -8990,136 +8990,10 @@ in this changeset (new minor version) rather than bug fixes:
2019-11-15 (bug)[135804] segfault in [next] after destroy (coulter,sebres)
-- Released 8.6.10, Nov 21, 2019 - details at https://core.tcl-lang.org/tcl/ -
-
-2019-12-03 (bug)[3cd9be] Corner case in surrogate handling (nijtmans)
-
-2019-12-09 (new) Add tcltest::(Setup|Eval|Cleanup|)Test (coulter,sebres)
-=> tcltest 2.5.2
-
-2019-12-12 (new) Add 3 libtommath functions to stub table (nijtmans)
-
-2019-12-23 (bug)[ce3b9f] compilation errors with clang, windows msys2 (nijtmans)
-
-2019-12-27 (bug)[1de6b0] [expr 1e2147483648] => 0.0 (kbk)
-
-2020-01-04 (bug)[912886] tis-620 encoding fails to load (coulter)
-
-2020-01-13 (bug)[0b9332] Win: support system encoding init to utf-8 (jedlička)
-
-2020-01-17 (bug)[8cd2fe] [unload] corrupted list of loaded packages (berc)
-
-2020-01-17 (bug)[5d989f] segfault in lsort for large list length (sebres)
-
-2020-01-30 (bug) Reset WSAGetLastError()/errno in channel close (nijtmans)
-
-2020-02-17 (bug) Win: avoid create of legacy error-vars on init phase (sebres)
-
-2020-02-25 (bug) release refs when setting class's superclasses fails (dkf)
-
-2020-02-26 (bug) C++ compiler compatibility for registry and dde (nijtmans)
-=> registry 1.3.5
-=> dde 1.4.3
-
-2020-03-05 (new) Update to Unicode-13 (nijtmans)
-
-2020-03-16 (bug)[8f89e2] Win: env var encoding, env-2.5 (sebres, nijtmans)
-
-2020-03-27 (bug)[767e07] Tcl_Get(Range|UniChar) validate index inputs (nijtmans)
-
-2020-03-28 (bug)[8edfce] [binary encode base64] & multi-byte wrapchars (dgp)
-
-2020-03-28 (bug)[ffeb20] [binary decode base64] ignore invalid chars (dgp)
-See RFC 2045
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-03-31 (bug)[b8e82d] some -maxlen values break uuencode round trip (dgp)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-04-01 (bug)[f58371] Fileevent run in proper thread (bron,sebres)
-
-2020-04-13 (bug)[afa4b2] TclNeedSpace bug; tests util-8.5 .. util-8.11 (dgp)
-
-2020-04-13 (bug)[085913] Tcl_DStringAppendElement # quoting precision (dgp)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-04-13 (bug)[a7f685] test util-5.52 (dgp)
-
-2020-04-13 (bug)[c61818] Tcl_UtfPrev regression (dgp)
-
-2020-04-15 (bug)[8af92d] zlib transform issue, bad inflate (sebres)
-
-2020-04-16 (bug)[5e6346] Tcl_UtfPrev handling of overlong sequences (dgp)
-
-2020-04-27 (bug)[45ca23] [string tolower] inconsistency (dgp)
-
-2020-04-30 (bug)[da2352] init [info hostname] with DNS, not NetBIOS (nadkarni)
-
-2020-05-11 (bug)[d402ff] Win32 potential crash when using main() (werner)
-
-2020-05-13 (bug)[81242a] revised documentation for Tcl_UtfAtIndex() (nijtmans)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-05-13 (bug)[ed2980] Tcl_UtfToUniChar reads > TCL_UTF_MAX bytes (nijtmans)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-06-02 (bug) prevent segfault in parser (sebres)
-
-2020-06-21 (bug)[f81bec] http POST a binary file (alakendu,nash)
-=> http 2.9.2
-
-2020-06-23 (bug)[41c985] auto_path nonsense in Safe Base (nash)
-
-2020-06-24 (bug)[f70ce1] zlib multi-stream inflate acts only on first (sebres)
-
-2020-07-09 (bug)[a1bd37] [clock scan] new ISO format (clock-34.(19-24)) (sebres)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-07-10 (bug)[501974] [clock scan] +time zone (clock-34.(53-68)) (sebres)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-07-15 (bug)[3c6e47] compiled [lappend] performance, avoid copy (sebres)
-
-2020-07-16 (bug)[5bbd04] Fix index underflow (schwab)
-
-2020-07-27 (bug)[cb0373] http::geturl -keepalive fixes (nash)
-=> http 2.9.3
-
-2020-08-10 (bug)[29e884] cmd resolution cycle (namespace-57.0) (coulter,sebres)
-
-2020-08-12 (bug)[e87000] Tcl_BadChannelOption tolerate NULL (werner,nijtmans)
-
-2020-08-31 (TIP #581) disfavor Master/Slave terminology (nijtmans)
-=> opt 0.4.8
-
-2020-09-11 (bug)[3bc0f4] UBSan complains about body.chars[] usage (nijtmans)
-
-2020-09-17 (bug)[835c93] Support TIP 525 exit code for -singleproc 1 (nijtmans)
-=> tcltest 2.5.3
-
-2020-09-25 (new) force -eofchar \032 when evaluating library scripts (nijtmans)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-09-29 (bug)[0063cb] http::geturl -headers must be dict (oehlmann,nijtmans)
-
-2020-10-19 (bug)[cb4582] Update install-sh script (stu,nijtmans)
-
-2020-10-22 (bug)[c97593] Usage of gnu_printf in latest mingw-w64 (nijtmans)
-
-2020-10-26 (new)[48898a] improve error message consistency (stu)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-11-06 (new) revised case of module names (nijtmans)
- *** POTENTIAL INCOMPATIBILITY ***
-
-2020-12-10 (bug)[ed5be7] Win: recognize "comx:" as serial port (oehlmann)
+2019-11-18 (bug)[13657a] application/json us text, not binary (noe,nijtmans)
+=> http 2.9.1
-2020-12-11 (new) support for msys2, Big Sur (nijtmans)
-=> platform 1.0.15
-
-2020-12-23 tzdata updated to Olson's tzdata2020e (jima)
-
-- Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ -
+- Released 8.6.10, Nov 21, 2019 - details at https://core.tcl-lang.org/tcl/ -
Changes to 8.7a3 include all changes to the 8.6 line through 8.6.10,
plus the following, which focuses on the high-level feature changes
@@ -9251,7 +9125,136 @@ in this changeset (new minor version) rather than bug fixes:
2019-09-14 [TIP 548] wchar_t conversion functions
-- Released 8.7a3, Nov 21, 2019 --- http://core.tcl-lang.org/tcl/ for details -
+- Released 8.7a3, Nov 21, 2019 --- https://core.tcl-lang.org/tcl/ for details -
+
+2019-12-03 (bug)[3cd9be] Corner case in surrogate handling (nijtmans)
+
+2019-12-09 (new) Add tcltest::(Setup|Eval|Cleanup|)Test (coulter,sebres)
+=> tcltest 2.5.2
+
+2019-12-12 (new) Add 3 libtommath functions to stub table (nijtmans)
+
+2019-12-23 (bug)[ce3b9f] compilation errors with clang, windows msys2 (nijtmans)
+
+2019-12-27 (bug)[1de6b0] [expr 1e2147483648] => 0.0 (kbk)
+
+2020-01-04 (bug)[912886] tis-620 encoding fails to load (coulter)
+
+2020-01-13 (bug)[0b9332] Win: support system encoding init to utf-8 (jedlička)
+
+2020-01-17 (bug)[8cd2fe] [unload] corrupted list of loaded packages (berc)
+
+2020-01-17 (bug)[5d989f] segfault in lsort for large list length (sebres)
+
+2020-01-30 (bug) Reset WSAGetLastError()/errno in channel close (nijtmans)
+
+2020-02-17 (bug) Win: avoid create of legacy error-vars on init phase (sebres)
+
+2020-02-25 (bug) release refs when setting class's superclasses fails (dkf)
+
+2020-02-26 (bug) C++ compiler compatibility for registry and dde (nijtmans)
+=> registry 1.3.5
+=> dde 1.4.3
+
+2020-03-05 (new) Update to Unicode-13 (nijtmans)
+
+2020-03-16 (bug)[8f89e2] Win: env var encoding, env-2.5 (sebres, nijtmans)
+
+2020-03-27 (bug)[767e07] Tcl_Get(Range|UniChar) validate index inputs (nijtmans)
+
+2020-03-28 (bug)[8edfce] [binary encode base64] & multi-byte wrapchars (dgp)
+
+2020-03-28 (bug)[ffeb20] [binary decode base64] ignore invalid chars (dgp)
+See RFC 2045
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-03-31 (bug)[b8e82d] some -maxlen values break uuencode round trip (dgp)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-04-01 (bug)[f58371] Fileevent run in proper thread (bron,sebres)
+
+2020-04-13 (bug)[afa4b2] TclNeedSpace bug; tests util-8.5 .. util-8.11 (dgp)
+
+2020-04-13 (bug)[085913] Tcl_DStringAppendElement # quoting precision (dgp)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-04-13 (bug)[a7f685] test util-5.52 (dgp)
+
+2020-04-13 (bug)[c61818] Tcl_UtfPrev regression (dgp)
+
+2020-04-15 (bug)[8af92d] zlib transform issue, bad inflate (sebres)
+
+2020-04-16 (bug)[5e6346] Tcl_UtfPrev handling of overlong sequences (dgp)
+
+2020-04-27 (bug)[45ca23] [string tolower] inconsistency (dgp)
+
+2020-04-30 (bug)[da2352] init [info hostname] with DNS, not NetBIOS (nadkarni)
+
+2020-05-11 (bug)[d402ff] Win32 potential crash when using main() (werner)
+
+2020-05-13 (bug)[81242a] revised documentation for Tcl_UtfAtIndex() (nijtmans)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-05-13 (bug)[ed2980] Tcl_UtfToUniChar reads > TCL_UTF_MAX bytes (nijtmans)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-06-02 (bug) prevent segfault in parser (sebres)
+
+2020-06-21 (bug)[f81bec] http POST a binary file (alakendu,nash)
+=> http 2.9.2
+
+2020-06-23 (bug)[41c985] auto_path nonsense in Safe Base (nash)
+
+2020-06-24 (bug)[f70ce1] zlib multi-stream inflate acts only on first (sebres)
+
+2020-07-09 (bug)[a1bd37] [clock scan] new ISO format (clock-34.(19-24)) (sebres)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-07-10 (bug)[501974] [clock scan] +time zone (clock-34.(53-68)) (sebres)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-07-15 (bug)[3c6e47] compiled [lappend] performance, avoid copy (sebres)
+
+2020-07-16 (bug)[5bbd04] Fix index underflow (schwab)
+
+2020-07-27 (bug)[cb0373] http::geturl -keepalive fixes (nash)
+=> http 2.9.3
+
+2020-08-10 (bug)[29e884] cmd resolution cycle (namespace-57.0) (coulter,sebres)
+
+2020-08-12 (bug)[e87000] Tcl_BadChannelOption tolerate NULL (werner,nijtmans)
+
+2020-08-31 (TIP #581) disfavor Master/Slave terminology (nijtmans)
+=> opt 0.4.8
+
+2020-09-11 (bug)[3bc0f4] UBSan complains about body.chars[] usage (nijtmans)
+
+2020-09-17 (bug)[835c93] Support TIP 525 exit code for -singleproc 1 (nijtmans)
+=> tcltest 2.5.3
+
+2020-09-25 (new) force -eofchar \032 when evaluating library scripts (nijtmans)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-09-29 (bug)[0063cb] http::geturl -headers must be dict (oehlmann,nijtmans)
+
+2020-10-19 (bug)[cb4582] Update install-sh script (stu,nijtmans)
+
+2020-10-22 (bug)[c97593] Usage of gnu_printf in latest mingw-w64 (nijtmans)
+
+2020-10-26 (new)[48898a] improve error message consistency (stu)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-11-06 (new) revised case of module names (nijtmans)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2020-12-10 (bug)[ed5be7] Win: recognize "comx:" as serial port (oehlmann)
+
+2020-12-11 (new) support for msys2, Big Sur (nijtmans)
+=> platform 1.0.15
+
+2020-12-23 tzdata updated to Olson's tzdata2020e (jima)
+
+- Released 8.6.11, Dec 31, 2020 - details at https://core.tcl-lang.org/tcl/ -
Changes to 8.7a5 include all changes to the 8.6 line through 8.6.11,
plus the following, which focuses on the high-level feature changes
@@ -9329,4 +9332,46 @@ in this changeset (new minor version) rather than bug fixes:
2021-05-18 (bug)[688fcc,28027d] namespace teardown reform (coulter)
-- Released 8.7a5, Jun 18, 2021 --- http://core.tcl-lang.org/tcl/ for details -
+- Released 8.7a5, Jun 18, 2021 --- https://core.tcl-lang.org/tcl/ for details -
+
+2021-02-02 (new) support for MacOS Big Sur updates (nijtmans)
+=> platform 1.0.17
+
+2021-02-15 (bug)[d43f96] [string trim*] broken for Emoji (werner)
+
+2021-02-16 (bug)[22324b] [string reverse] broken for Emoji (werner)
+
+2021-02-19 (bug)[1dab71,7c64aa] BRE broken by uninitialized value use (lane)
+
+2021-03-09 (bug)[8419c5] Unix tty channels tolerate EINTR (nijtmans)
+ *** POTENTIAL INCOMPATIBILITY ***
+
+2021-03-10 (bug)[4c591f] [string compare] EIAS violation (nijtmans)
+
+2021-04-08 (new) dde package installation compatible with Tcl 9 (nijtmans)
+=> dde 1.4.4
+
+2021-04-14 (bug)[266494] [concat foo [list #]] EIAS violation (porter)
+
+2021-05-03 (bug)[24b918] Save IO buffers from modern optimizers (rupprecht)
+
+2021-05-06 (new) support for POSIX error EILSEQ (nijtmans)
+
+2021-05-17 (bug)[688fcc] segfault during traced delete of alias (coulter)
+
+2021-06-22 (bug)[bad6cc] More secure build tool. CVE-2021-35331 (nijtmans)
+
+2021-07-17 (bug)[592a25] Win: segfault in Tcl_PutEnv() (danckaert,nijtmans)
+
+2021-09-02 (bug)[ccc448] segfault in ensemble rewrite machinery (coulter)
+
+2021-09-14 (new) Update to Unicode-14 (nijtmans)
+
+2021-10-08 (bug)[a8579d] failed proc argument spec processing (russell,coulter)
+
+2021-10-27 (new) support for MacOS Monterey (nijtmans)
+=> platform 1.0.18
+
+2021-10-27 tzdata updated to Olson's tzdata2021e (nijtmans)
+
+- Released 8.6.12, Nov 5, 2021 - details at https://core.tcl-lang.org/tcl/ -
diff --git a/doc/ByteArrObj.3 b/doc/ByteArrObj.3
index 2a7d7a3..fd7f245 100644
--- a/doc/ByteArrObj.3
+++ b/doc/ByteArrObj.3
@@ -8,83 +8,170 @@
.so man.macros
.BS
.SH NAME
-Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength \- manipulate Tcl values as a arrays of bytes
+Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetBytesFromObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength \- manipulate a Tcl value as an array of bytes
.SH SYNOPSIS
.nf
\fB#include <tcl.h>\fR
.sp
Tcl_Obj *
-\fBTcl_NewByteArrayObj\fR(\fIbytes, length\fR)
+\fBTcl_NewByteArrayObj\fR(\fIbytes, numBytes\fR)
.sp
void
-\fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, length\fR)
+\fBTcl_SetByteArrayObj\fR(\fIobjPtr, bytes, numBytes\fR)
.sp
+.VS TIP568
unsigned char *
-\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, lengthPtr\fR)
+\fBTcl_GetBytesFromObj\fR(\fIinterp, objPtr, numBytesPtr\fR)
+.VE TIP568
.sp
unsigned char *
-\fBTcl_SetByteArrayLength\fR(\fIobjPtr, length\fR)
+\fBTcl_GetByteArrayFromObj\fR(\fIobjPtr, numBytesPtr\fR)
+.sp
+unsigned char *
+\fBTcl_SetByteArrayLength\fR(\fIobjPtr, numBytes\fR)
.SH ARGUMENTS
-.AS "const unsigned char" *lengthPtr in/out
+.AS "const unsigned char" *numBytesPtr in/out
.AP "const unsigned char" *bytes in
The array of bytes used to initialize or set a byte-array value. May be NULL
-even if \fIlength\fR is non-zero.
-.AP int length in
-The length of the array of bytes. It must be >= 0.
+even if \fInumBytes\fR is non-zero.
+.AP int numBytes in
+The number of bytes in the array. It must be >= 0.
.AP Tcl_Obj *objPtr in/out
-For \fBTcl_SetByteArrayObj\fR, this points to the value to be converted to
-byte-array type. For \fBTcl_GetByteArrayFromObj\fR and
-\fBTcl_SetByteArrayLength\fR, this points to the value from which to get
-the byte-array value; if \fIobjPtr\fR does not already point to a byte-array
-value, it will be converted to one.
-.AP size_t | int *lengthPtr out
-Filled with the length of the array of bytes in the value.
-May be (int *)NULL when not used.
+For \fBTcl_SetByteArrayObj\fR, this points to an unshared value to be
+overwritten by a byte-array value. For \fBTcl_GetBytesFromObj\fR,
+\fBTcl_GetByteArrayFromObj\fR and \fBTcl_SetByteArrayLength\fR, this points
+to the value from which to extract an array of bytes.
+.AP Tcl_Interp *interp in
+Interpreter to use for error reporting.
+.AP "size_t | int" *numBytesPtr out
+Points to space where the number of bytes in the array may be written.
+Caller may pass NULL when it does not need this information.
.BE
.SH DESCRIPTION
.PP
-These procedures are used to create, modify, and read Tcl byte-array values
-from C code. Byte-array values are typically used to hold the
-results of binary IO operations or data structures created with the
-\fBbinary\fR command. In Tcl, an array of bytes is not equivalent to a
-string. Conceptually, a string is an array of Unicode characters, while a
-byte-array is an array of 8-bit quantities with no implicit meaning.
-Accessor functions are provided to get the string representation of a
-byte-array or to convert an arbitrary value to a byte-array. Obtaining the
+These routines are used to create, modify, store, transfer, and retrieve
+arbitrary binary data in Tcl values. Specifically, data that can be
+represented as a sequence of arbitrary byte values is supported.
+This includes data read from binary channels, values created by the
+\fBbinary\fR command, encrypted data, or other information representable as
+a finite byte sequence.
+.PP
+A byte is an 8-bit quantity with no inherent meaning. When the 8 bits are
+interpreted as an integer value, the range of possible values is (0-255).
+The C type best suited to store a byte is the \fBunsigned char\fR.
+An \fBunsigned char\fR array of size \fIN\fR stores an aribtrary binary
+value of size \fIN\fR bytes. We call this representation a byte-array.
+Here we document the routines that allow us to operate on Tcl values as
+byte-arrays.
+.PP
+All Tcl values must correspond to a string representation.
+When a byte-array value must be processed as a string, the sequence
+of \fIN\fR bytes is transformed into the corresponding sequence
+of \fIN\fR characters, where each byte value transforms to the same
+character codepoint value in the range (U+0000 - U+00FF). Obtaining the
string representation of a byte-array value (by calling
-\fBTcl_GetStringFromObj\fR) produces a properly formed UTF-8 sequence with a
-one-to-one mapping between the bytes in the internal representation and the
-UTF-8 characters in the string representation.
+\fBTcl_GetStringFromObj\fR) produces this string in Tcl's usual
+Modified UTF-8 encoding.
.PP
-\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR will
-create a new value of byte-array type or modify an existing value to have a
-byte-array type. Both of these procedures set the value's type to be
-byte-array and set the value's internal representation to a copy of the
-array of bytes given by \fIbytes\fR. \fBTcl_NewByteArrayObj\fR returns a
-pointer to a newly allocated value with a reference count of zero.
-\fBTcl_SetByteArrayObj\fR invalidates any old string representation and, if
-the value is not already a byte-array value, frees any old internal
-representation. If \fIbytes\fR is NULL then the new byte array contains
-arbitrary values.
+\fBTcl_NewByteArrayObj\fR and \fBTcl_SetByteArrayObj\fR
+create a new value or overwrite an existing unshared value, respectively,
+to hold a byte-array value of \fInumBytes\fR bytes. When a caller
+passes a non-NULL value of \fIbytes\fR, it must point to memory from
+which \fInumBytes\fR bytes can be read. These routines
+allocate \fInumBytes\fR bytes of memory, copy \fInumBytes\fR
+bytes from \fIbytes\fR into it, and keep the result in the internal
+representation of the new or overwritten value.
+When the caller passes a NULL value of \fIbytes\fR, the data copying
+step is skipped, and the bytes stored in the value are undefined.
+A \fIbytes\fR value of NULL is useful only when the caller will arrange
+to write known contents into the byte-array through a pointer retrieved
+by a call to one of the routines explained below. \fBTcl_NewByteArrayObj\fR
+returns a pointer to the created value with a reference count of zero.
+\fBTcl_SetByteArrayObj\fR overwrites and invalidates any old contents
+of the unshared \fIobjPtr\fR as appropriate, and keeps its reference
+count (0 or 1) unchanged. The value produced by these routines has no
+string representation. Any memory allocation failure may cause a panic.
+Note that the type of the \fInumBytes\fR argument is \fBint\fR; consequently
+the largest byte-array value that can be produced by these routines is one
+holding \fBINT_MAX\fR bytes. Note also that the string representation of
+any Tcl value is limited to \fBINT_MAX\fR bytes, so caution should be
+taken with any byte-array of more than \fBINT_MAX / 2\fR bytes.
.PP
-\fBTcl_GetByteArrayFromObj\fR converts a Tcl value to byte-array type and
-returns a pointer to the value's new internal representation as an array of
-bytes. The length of this array is stored in \fIlengthPtr\fR if
-\fIlengthPtr\fR is non-NULL. The storage for the array of bytes is owned by
-the value and should not be freed. The contents of the array may be
-modified by the caller only if the value is not shared and the caller
-invalidates the string representation.
+\fBTcl_GetBytesFromObj\fR performs the opposite function of
+\fBTcl_SetByteArrayObj\fR, providing access to read a byte-array from
+a Tcl value that was previously written into it. When \fIobjPtr\fR
+is a value previously produced by \fBTcl_NewByteArrayObj\fR or
+\fBTcl_SetByteArrayObj\fR, then \fBTcl_GetBytesFromObj\fR returns
+a pointer to the byte-array kept in the value's internal representation.
+If the caller provides a non-NULL value for \fInumBytesPtr\fR, it must
+point to memory where \fBTcl_GetBytesFromObj\fR can write the number
+of bytes in the value's internal byte-array. With both pieces of
+information, the caller is able to retrieve any information about the
+contents of that byte-array that it seeks. When \fIobjPtr\fR does
+not already contain an internal byte-array, \fBTcl_GetBytesFromObj\fR
+will try to create one from the value's string representation. Any
+string value that does not include any character codepoints outside
+the range (U+0000 - U+00FF) will successfully translate to a unique
+byte-array value. With the created byte-array, the routine returns
+as before. For any string representation which does contain
+a forbidden character codepoint, the conversion fails, and
+\fBTcl_GetBytesFromObj\fR returns NULL to signal that failure. On
+failure, nothing will be written to \fInumBytesPtr\fR, and if
+the \fIinterp\fR argument is non-NULL, then error messages and
+codes are left in it recording the error.
.PP
-\fBTcl_SetByteArrayLength\fR converts the Tcl value to byte-array type
-and changes the length of the value's internal representation as an
-array of bytes. If \fIlength\fR is greater than the space currently
-allocated for the array, the array is reallocated to the new length; the
-newly allocated bytes at the end of the array have arbitrary values. If
-\fIlength\fR is less than the space currently allocated for the array,
-the length of array is reduced to the new length. The return value is a
-pointer to the value's new array of bytes.
-
+\fBTcl_GetByteArrayFromObj\fR performs nearly the same function as
+\fBTcl_GetBytesFromObj\fR. They differ only in the circumstance when
+a byte-array internal value must be created by transformation of
+a string representation, and that string representation contains a
+character with codepoint greater than U+00FF. Instead of failing
+the conversion, \fBTcl_GetByteArrayFromObj\fR will use the 8 least
+significant bits of each codepoint to produce a valid byte value
+from any character codepoint value. In any other circumstance,
+\fBTcl_GetByteArrayFromObj\fR performs just as \fBTcl_GetBytesFromObj\fR
+does. Since the conversion cannot fail, \fBTcl_GetByteArrayFromObj\fR
+has no need for an \fIinterp\fR argument to record any errors and
+the caller can assume \fBTcl_GetByteArrayFromObj\fR does not return NULL.
+.PP
+\fBTcl_GetByteArrayFromObj\fR must be used with caution. Because of the
+truncation on conversion, the byte-array made available to the caller
+cannot reliably complete a round-trip back to the original string
+representation. This creates opportunities for bugs due to blindness
+to differences in values. This routine exists in this form primarily
+for compatibility with codebases written for earlier releases of Tcl.
+It is expected this routine will incompatibly change in Tcl 9 so that
+it also signals failed conversions with a NULL return.
+.PP
+On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR
+return a pointer into the internal representation of a \fBTcl_Obj\fR.
+That pointer must not be freed by the caller, and should not be retained
+for use beyond the known time the internal representation of the value
+has not been disturbed. The pointer may be used to overwrite the byte
+contents of the internal representation, so long as the value is unshared
+and any string representation is invalidated.
+.PP
+On success, both \fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR
+write the number of bytes in the byte-array value of \fIobjPtr\fR
+to the space pointed to by \fInumBytesPtr\fR. This space may be of type
+\fBsize_t\fR or of type \fBint\fR. In Tcl 8, the largest number of
+bytes possible is \fBINT_MAX\fR, so either type can receive the value.
+In codebases meant to migrate to Tcl 9, the option to write to a space
+of type \fBsize_t\fR may aid in the migration.
+.PP
+\fBTcl_SetByteArrayLength\fR enables a caller to change the size of a
+byte-array in the internal representation of an unshared \fIobjPtr\fR to
+become \fInumBytes\fR bytes. This is most often useful after the
+bytes of the internal byte-array have been directly overwritten and it
+has been discovered that the required size differs from the first
+estimate used in the allocation. \fBTcl_SetByteArrayLength\fR returns
+a pointer to the resized byte-array. Because resizing the byte-array
+changes the internal representation, \fBTcl_SetByteArrayLength\fR
+also invalidates any string representation in \fIobjPtr\fR. If resizing
+grows the byte-array, the new byte values are undefined. If \fIobjPtr\fR
+does not already possess an internal byte-array, one is produced in the
+same way that \fBTcl_GetByteArrayFromObj\fR does, with all the cautions
+that go along with that.
.SH "REFERENCE COUNT MANAGEMENT"
.PP
\fBTcl_NewByteArrayObj\fR always returns a zero-reference object, much
@@ -94,11 +181,11 @@ like \fBTcl_NewObj\fR.
reference count of their \fIobjPtr\fR arguments, but do require that the
object be unshared.
.PP
-\fBTcl_GetByteArrayFromObj\fR does not modify the reference count of its
-\fIobjPtr\fR argument; it only reads.
+\fBTcl_GetBytesFromObj\fR and \fBTcl_GetByteArrayFromObj\fR do not modify
+the reference count of \fIobjPtr\fR; they only read.
.SH "SEE ALSO"
Tcl_GetStringFromObj, Tcl_NewObj, Tcl_IncrRefCount, Tcl_DecrRefCount
.SH KEYWORDS
-value, binary data, byte array, utf, unicode, internationalization
+value, binary data, byte array, utf, unicode
diff --git a/doc/binary.n b/doc/binary.n
index 4a5d6c8..9ab694e 100644
--- a/doc/binary.n
+++ b/doc/binary.n
@@ -81,7 +81,7 @@ RFC 2045 calls for base64 decoders to be non-strict.
\fBhex\fR
.
The \fBhex\fR binary encoding converts each byte to a pair of hexadecimal
-digits in big-endian form.
+digits that represent the byte value as a hexadecimal integer.
.RS
.PP
No options are supported during encoding. During decoding, the following
diff --git a/generic/tcl.decls b/generic/tcl.decls
index 498adf0..bd9800a 100644
--- a/generic/tcl.decls
+++ b/generic/tcl.decls
@@ -108,7 +108,7 @@ declare 22 {deprecated {No longer in use, changed to macro}} {
Tcl_Obj *Tcl_DbNewBooleanObj(int boolValue, const char *file, int line)
}
declare 23 {
- Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int length,
+ Tcl_Obj *Tcl_DbNewByteArrayObj(const unsigned char *bytes, int numBytes,
const char *file, int line)
}
declare 24 {
@@ -143,7 +143,7 @@ declare 32 {
int *boolPtr)
}
declare 33 {
- unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *lengthPtr)
+ unsigned char *Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr, int *numBytesPtr)
}
declare 34 {
int Tcl_GetDouble(Tcl_Interp *interp, const char *src, double *doublePtr)
@@ -202,7 +202,7 @@ declare 49 {deprecated {No longer in use, changed to macro}} {
Tcl_Obj *Tcl_NewBooleanObj(int boolValue)
}
declare 50 {
- Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int length)
+ Tcl_Obj *Tcl_NewByteArrayObj(const unsigned char *bytes, int numBytes)
}
declare 51 {
Tcl_Obj *Tcl_NewDoubleObj(double doubleValue)
@@ -226,11 +226,11 @@ declare 57 {deprecated {No longer in use, changed to macro}} {
void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue)
}
declare 58 {
- unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length)
+ unsigned char *Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int numBytes)
}
declare 59 {
void Tcl_SetByteArrayObj(Tcl_Obj *objPtr, const unsigned char *bytes,
- int length)
+ int numBytes)
}
declare 60 {
void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue)
@@ -2402,6 +2402,16 @@ declare 648 {
int length, Tcl_DString *dsPtr)
}
+# TIP #568
+declare 649 {
+ unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
+ int *numBytesPtr)
+}
+declare 650 {
+ unsigned char *Tcl_GetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
+ size_t *numBytesPtr)
+}
+
# TIP #481
declare 651 {
char *TclGetStringFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
@@ -2410,7 +2420,7 @@ declare 652 {
Tcl_UniChar *TclGetUnicodeFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
}
declare 653 {
- unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lengthPtr)
+ unsigned char *TclGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *numBytesPtr)
}
# TIP #575
diff --git a/generic/tclBinary.c b/generic/tclBinary.c
index 633bc1e..a586f18 100644
--- a/generic/tclBinary.c
+++ b/generic/tclBinary.c
@@ -2,7 +2,7 @@
* tclBinary.c --
*
* This file contains the implementation of the "binary" Tcl built-in
- * command and the Tcl binary data object.
+ * command and the Tcl value internal representation for binary data.
*
* Copyright © 1997 Sun Microsystems, Inc.
* Copyright © 1998-1999 Scriptics Corporation.
@@ -75,31 +75,15 @@ static int NeedReversing(int format);
static void CopyNumber(const void *from, void *to,
unsigned length, int type);
/* Binary ensemble commands */
-static int BinaryFormatCmd(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int BinaryScanCmd(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc BinaryFormatCmd;
+static Tcl_ObjCmdProc BinaryScanCmd;
/* Binary encoding sub-ensemble commands */
-static int BinaryEncodeHex(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int BinaryDecodeHex(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int BinaryEncode64(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int BinaryDecode64(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
-static int BinaryEncodeUu(ClientData clientData,
- Tcl_Interp *interp, int objc,
- Tcl_Obj *const objv[]);
-static int BinaryDecodeUu(ClientData clientData,
- Tcl_Interp *interp,
- int objc, Tcl_Obj *const objv[]);
+static Tcl_ObjCmdProc BinaryEncodeHex;
+static Tcl_ObjCmdProc BinaryDecodeHex;
+static Tcl_ObjCmdProc BinaryEncode64;
+static Tcl_ObjCmdProc BinaryDecode64;
+static Tcl_ObjCmdProc BinaryEncodeUu;
+static Tcl_ObjCmdProc BinaryDecodeUu;
/*
* The following tables are used by the binary encoders
@@ -165,12 +149,11 @@ static const EnsembleImplMap decodeMap[] = {
* images to name just two.
*
* It's strange to have two Tcl_ObjTypes in place for this task when one would
- * do, so a bit of detail and history how we got to this point and where we
- * might go from here.
+ * do, so a bit of detail and history will aid understanding.
*
* A bytearray is an ordered sequence of bytes. Each byte is an integer value
* in the range [0-255]. To be a Tcl value type, we need a way to encode each
- * value in the value set as a Tcl string. The simplest encoding is to
+ * value in the value set as a Tcl string. A simple encoding is to
* represent each byte value as the same codepoint value. A bytearray of N
* bytes is encoded into a Tcl string of N characters where the codepoint of
* each character is the value of corresponding byte. This approach creates a
@@ -181,9 +164,7 @@ static const EnsembleImplMap decodeMap[] = {
* question arises what to do with strings outside that subset? That is,
* those Tcl strings containing at least one codepoint greater than 255? The
* obviously correct answer is to raise an error! That string value does not
- * represent any valid bytearray value. Full Stop. The setFromAnyProc
- * signature has a completion code return value for just this reason, to
- * reject invalid inputs.
+ * represent any valid bytearray value.
*
* Unfortunately this was not the path taken by the authors of the original
* tclByteArrayType. They chose to accept all Tcl string values as acceptable
@@ -191,33 +172,10 @@ static const EnsembleImplMap decodeMap[] = {
* high bits of any codepoint value at all. This meant that every bytearray
* value had multiple accepted string representations.
*
- * The implications of this choice are truly ugly. When a Tcl value has a
- * string representation, we are required to accept that as the true value.
- * Bytearray values that possess a string representation cannot be processed
- * as bytearrays because we cannot know which true value that bytearray
- * represents. The consequence is that we drag around an internal rep that we
- * cannot make any use of. This painful price is extracted at any point after
- * a string rep happens to be generated for the value. This happens even when
- * the troublesome codepoints outside the byte range never show up. This
- * happens rather routinely in normal Tcl operations unless we burden the
- * script writer with the cognitive burden of avoiding it. The price is also
- * paid by callers of the C interface. The routine
- *
- * unsigned char *Tcl_GetByteArrayFromObj(objPtr, lenPtr)
- *
- * has a guarantee to always return a non-NULL value, but that value points to
- * a byte sequence that cannot be used by the caller to process the Tcl value
- * absent some sideband testing that objPtr is "pure". Tcl offers no public
- * interface to perform this test, so callers either break encapsulation or
- * are unavoidably buggy. Tcl has defined a public interface that cannot be
- * used correctly. The Tcl source code itself suffers the same problem, and
- * has been buggy, but progressively less so as more and more portions of the
- * code have been retrofitted with the required "purity testing". The set of
- * values able to pass the purity test can be increased via the introduction
- * of a "canonical" flag marker, but the only way the broken interface itself
- * can be discarded is to start over and define the Tcl_ObjType properly.
- * Bytearrays should simply be usable as bytearrays without a kabuki dance of
- * testing.
+ * The implications of this choice are truly ugly, and motivated the proposal
+ * of TIP 568 to migrate away from it and to the more sensible design where
+ * each bytearray value has only one string representation. Full details are
+ * recorded in that TIP for those who seek them.
*
* The Tcl_ObjType "properByteArrayType" is (nearly) a correct implementation
* of bytearrays. Any Tcl value with the type properByteArrayType can have
@@ -226,21 +184,24 @@ static const EnsembleImplMap decodeMap[] = {
* implies a side testing burden -- past mistakes will not let us avoid that
* immediately, but it is at least a conventional test of type, and can be
* implemented entirely by examining the objPtr fields, with no need to query
- * the internalrep, as a canonical flag would require.
- *
- * Until Tcl_GetByteArrayFromObj() and Tcl_SetByteArrayLength() can be revised
- * to admit the possibility of returning NULL when the true value is not a
- * valid bytearray, we need a mechanism to retain compatibility with the
- * deployed callers of the broken interface. That's what the retained
- * "tclByteArrayType" provides. In those unusual circumstances where we
- * convert an invalid bytearray value to a bytearray type, it is to this
- * legacy type. Essentially any time this legacy type gets used, it's a
- * signal of a bug being ignored. A TIP should be drafted to remove this
- * connection to the broken past so that Tcl 9 will no longer have any trace
- * of it. Prescribing a migration path will be the key element of that work.
- * The internal changes now in place are the limit of what can be done short
- * of interface repair. They provide a great expansion of the histories over
- * which bytearray values can be useful in the meanwhile.
+ * the internalrep, as a canonical flag would require. This benefit is made
+ * available to extensions through the public routine Tcl_GetBytesFromObj(),
+ * first available in Tcl 8.7.
+ *
+ * The public routines Tcl_GetByteArrayFromObj() and Tcl_SetByteArrayLength()
+ * must continue to follow their documented behavior through the 8.* series of
+ * releases. To support that legacy operation, we need a mechanism to retain
+ * compatibility with the deployed callers of the broken interface. That's
+ * what the retained "tclByteArrayType" provides. In those unusual
+ * circumstances where we convert an invalid bytearray value to a bytearray
+ * type, it is to this legacy type. Essentially any time this legacy type
+ * shows up, it's a signal of a bug being ignored.
+ *
+ * In Tcl 9, the incompatibility in the behavior of these public routines
+ * has been approved, and the legacy internal rep is no longer retained.
+ * The internal changes seen below are the limit of what can be done
+ * in a Tcl 8.* release. They provide a great expansion of the histories
+ * over which bytearray values can be useful.
*/
static const Tcl_ObjType properByteArrayType = {
@@ -267,15 +228,16 @@ const Tcl_ObjType tclByteArrayType = {
*/
typedef struct ByteArray {
- unsigned int bad; /* Index of the character that is a nonbyte.
- * If all characters are bytes, bad = used,
- * though then we should never read it. */
+ unsigned int bad; /* Index of first character that is a nonbyte.
+ * If all characters are bytes, bad = used. */
unsigned int used; /* The number of bytes used in the byte
- * array. */
- unsigned int allocated; /* The amount of space actually allocated
- * minus 1 byte. */
- unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this
- * field depends on the 'allocated' field
+ * array. Must be <= allocated. The bytes
+ * used to store the value are indexed from
+ * 0 to used-1. */
+ unsigned int allocated; /* The number of bytes of space allocated. */
+ unsigned char bytes[TCLFLEXARRAY];
+ /* The array of bytes. The actual size of this
+ * field is stored in the 'allocated' field
* above. */
} ByteArray;
@@ -301,7 +263,7 @@ TclIsPureByteArray(
* from the given array of bytes.
*
* Results:
- * The newly create object is returned. This object will have no initial
+ * The newly created object is returned. This object has no initial
* string representation. The returned object has a ref count of 0.
*
* Side effects:
@@ -316,16 +278,16 @@ Tcl_Obj *
Tcl_NewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- int length) /* Length of the array of bytes, which must be
- * >= 0. */
+ int numBytes) /* Number of bytes in the array,
+ * must be >= 0. */
{
#ifdef TCL_MEM_DEBUG
- return Tcl_DbNewByteArrayObj(bytes, length, "unknown", 0);
+ return Tcl_DbNewByteArrayObj(bytes, numBytes, "unknown", 0);
#else /* if not TCL_MEM_DEBUG */
Tcl_Obj *objPtr;
TclNewObj(objPtr);
- Tcl_SetByteArrayObj(objPtr, bytes, length);
+ Tcl_SetByteArrayObj(objPtr, bytes, numBytes);
return objPtr;
#endif /* TCL_MEM_DEBUG */
}
@@ -346,7 +308,7 @@ Tcl_NewByteArrayObj(
* result of calling Tcl_NewByteArrayObj.
*
* Results:
- * The newly create object is returned. This object will have no initial
+ * The newly created object is returned. This object has no initial
* string representation. The returned object has a ref count of 0.
*
* Side effects:
@@ -360,8 +322,8 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- int length, /* Length of the array of bytes, which must be
- * >= 0. */
+ int numBytes, /* Number of bytes in the array,
+ * must be >= 0. */
const char *file, /* The name of the source file calling this
* procedure; used for debugging. */
int line) /* Line number in the source file; used for
@@ -370,7 +332,7 @@ Tcl_DbNewByteArrayObj(
Tcl_Obj *objPtr;
TclDbNewObj(objPtr, file, line);
- Tcl_SetByteArrayObj(objPtr, bytes, length);
+ Tcl_SetByteArrayObj(objPtr, bytes, numBytes);
return objPtr;
}
#else /* if not TCL_MEM_DEBUG */
@@ -378,12 +340,12 @@ Tcl_Obj *
Tcl_DbNewByteArrayObj(
const unsigned char *bytes, /* The array of bytes used to initialize the
* new object. */
- int length, /* Length of the array of bytes, which must be
- * >= 0. */
+ int numBytes, /* Number of bytes in the array,
+ * must be >= 0. */
TCL_UNUSED(const char *) /*file*/,
TCL_UNUSED(int) /*line*/)
{
- return Tcl_NewByteArrayObj(bytes, length);
+ return Tcl_NewByteArrayObj(bytes, numBytes);
}
#endif /* TCL_MEM_DEBUG */
@@ -409,9 +371,9 @@ void
Tcl_SetByteArrayObj(
Tcl_Obj *objPtr, /* Object to initialize as a ByteArray. */
const unsigned char *bytes, /* The array of bytes to use as the new value.
- * May be NULL even if length > 0. */
- int length) /* Length of the array of bytes, which must
- * be >= 0. */
+ * May be NULL even if numBytes > 0. */
+ int numBytes) /* Number of bytes in the array,
+ * must be >= 0. */
{
ByteArray *byteArrayPtr;
Tcl_ObjInternalRep ir;
@@ -421,16 +383,14 @@ Tcl_SetByteArrayObj(
}
TclInvalidateStringRep(objPtr);
- if (length < 0) {
- length = 0;
- }
- byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
- byteArrayPtr->bad = length;
- byteArrayPtr->used = length;
- byteArrayPtr->allocated = length;
+ assert(numBytes >= 0);
+ byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(numBytes));
+ byteArrayPtr->bad = numBytes;
+ byteArrayPtr->used = numBytes;
+ byteArrayPtr->allocated = numBytes;
- if ((bytes != NULL) && (length > 0)) {
- memcpy(byteArrayPtr->bytes, bytes, length);
+ if ((bytes != NULL) && (numBytes > 0)) {
+ memcpy(byteArrayPtr->bytes, bytes, numBytes);
}
SET_BYTEARRAY(&ir, byteArrayPtr);
@@ -440,16 +400,16 @@ Tcl_SetByteArrayObj(
/*
*----------------------------------------------------------------------
*
- * TclGetBytesFromObj --
+ * Tcl_GetBytesFromObj/TclGetBytesFromObj --
*
* Attempt to extract the value from objPtr in the representation
* of a byte sequence. On success return the extracted byte sequence.
- * On failures, return NULL and record error message and code in
+ * On failure, return NULL and record error message and code in
* interp (if not NULL).
*
* Results:
- * Pointer to array of bytes, or NULL. representing the ByteArray object.
- * Writes number of bytes in array to *lengthPtr.
+ * NULL or pointer to array of bytes representing the ByteArray object.
+ * Writes number of bytes in array to *numBytesPtr.
*
*----------------------------------------------------------------------
*/
@@ -458,8 +418,47 @@ unsigned char *
TclGetBytesFromObj(
Tcl_Interp *interp, /* For error reporting */
Tcl_Obj *objPtr, /* Value to extract from */
- int *lengthPtr) /* If non-NULL, filled with length of the
- * array of bytes in the ByteArray object. */
+ int *numBytesPtr) /* If non-NULL, write the number of bytes
+ * in the array here */
+{
+ ByteArray *baPtr;
+ const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType);
+
+ if (irPtr == NULL) {
+ SetByteArrayFromAny(NULL, objPtr);
+ irPtr = TclFetchInternalRep(objPtr, &properByteArrayType);
+ if (irPtr == NULL) {
+ if (interp) {
+ const char *nonbyte;
+ int ucs4;
+
+ irPtr = TclFetchInternalRep(objPtr, &tclByteArrayType);
+ baPtr = GET_BYTEARRAY(irPtr);
+ nonbyte = Tcl_UtfAtIndex(Tcl_GetString(objPtr), baPtr->bad);
+ TclUtfToUCS4(nonbyte, &ucs4);
+
+ Tcl_SetObjResult(interp, Tcl_ObjPrintf(
+ "expected byte sequence but character %d "
+ "was '%1s' (U+%06X)", baPtr->bad, nonbyte, ucs4));
+ Tcl_SetErrorCode(interp, "TCL", "VALUE", "BYTES", NULL);
+ }
+ return NULL;
+ }
+ }
+ baPtr = GET_BYTEARRAY(irPtr);
+
+ if (numBytesPtr != NULL) {
+ *numBytesPtr = baPtr->used;
+ }
+ return baPtr->bytes;
+}
+#undef Tcl_GetBytesFromObj
+unsigned char *
+Tcl_GetBytesFromObj(
+ Tcl_Interp *interp, /* For error reporting */
+ Tcl_Obj *objPtr, /* Value to extract from */
+ size_t *numBytesPtr) /* If non-NULL, write the number of bytes
+ * in the array here */
{
ByteArray *baPtr;
const Tcl_ObjInternalRep *irPtr = TclFetchInternalRep(objPtr, &properByteArrayType);
@@ -487,8 +486,8 @@ TclGetBytesFromObj(
}
baPtr = GET_BYTEARRAY(irPtr);
- if (lengthPtr != NULL) {
- *lengthPtr = baPtr->used;
+ if (numBytesPtr != NULL) {
+ *numBytesPtr = baPtr->used;
}
return baPtr->bytes;
}
@@ -515,12 +514,12 @@ TclGetBytesFromObj(
unsigned char *
Tcl_GetByteArrayFromObj(
Tcl_Obj *objPtr, /* The ByteArray object. */
- int *lengthPtr) /* If non-NULL, filled with length of the
- * array of bytes in the ByteArray object. */
+ int *numBytesPtr) /* If non-NULL, write the number of bytes
+ * in the array here */
{
ByteArray *baPtr;
const Tcl_ObjInternalRep *irPtr;
- unsigned char *result = TclGetBytesFromObj(NULL, objPtr, lengthPtr);
+ unsigned char *result = TclGetBytesFromObj(NULL, objPtr, numBytesPtr);
if (result) {
return result;
@@ -531,8 +530,8 @@ Tcl_GetByteArrayFromObj(
baPtr = GET_BYTEARRAY(irPtr);
- if (lengthPtr != NULL) {
- *lengthPtr = baPtr->used;
+ if (numBytesPtr != NULL) {
+ *numBytesPtr = baPtr->used;
}
return (unsigned char *) baPtr->bytes;
}
@@ -540,12 +539,12 @@ Tcl_GetByteArrayFromObj(
unsigned char *
TclGetByteArrayFromObj(
Tcl_Obj *objPtr, /* The ByteArray object. */
- size_t *lengthPtr) /* If non-NULL, filled with length of the
- * array of bytes in the ByteArray object. */
+ size_t *numBytesPtr) /* If non-NULL, write the number of bytes
+ * in the array here */
{
ByteArray *baPtr;
const Tcl_ObjInternalRep *irPtr;
- unsigned char *result = TclGetBytesFromObj(NULL, objPtr, (int *)NULL);
+ unsigned char *result = Tcl_GetBytesFromObj(NULL, objPtr, numBytesPtr);
if (result) {
return result;
@@ -556,11 +555,12 @@ TclGetByteArrayFromObj(
baPtr = GET_BYTEARRAY(irPtr);
- if (lengthPtr != NULL) {
+ if (numBytesPtr != NULL) {
#if TCL_MAJOR_VERSION > 8
- *lengthPtr = baPtr->used;
+ *numBytesPtr = baPtr->used;
#else
- *lengthPtr = ((size_t)(unsigned)(baPtr->used + 1)) - 1;
+ /* TODO: What's going on here? Document or eliminate. */
+ *numBytesPtr = ((size_t)(unsigned)(baPtr->used + 1)) - 1;
#endif
}
return baPtr->bytes;
@@ -591,14 +591,14 @@ TclGetByteArrayFromObj(
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
- int length) /* New length for internal byte array. */
+ int numBytes) /* Number of bytes in resized array */
{
ByteArray *byteArrayPtr;
unsigned newLength;
Tcl_ObjInternalRep *irPtr;
- assert(length >= 0);
- newLength = (unsigned int)length;
+ assert(numBytes >= 0);
+ newLength = (unsigned int)numBytes;
if (Tcl_IsShared(objPtr)) {
Tcl_Panic("%s called with shared object", "Tcl_SetByteArrayLength");
@@ -616,6 +616,9 @@ Tcl_SetByteArrayLength(
}
}
+ /* Note that during truncation, the implementation does not free
+ * memory that is no longer needed. */
+
byteArrayPtr = GET_BYTEARRAY(irPtr);
if (newLength > byteArrayPtr->allocated) {
byteArrayPtr = (ByteArray *)ckrealloc(byteArrayPtr, BYTEARRAY_SIZE(newLength));
@@ -668,6 +671,9 @@ SetByteArrayFromAny(
length = bad = objPtr->length;
srcEnd = src + length;
+ /* Note the allocation is over-sized, possibly by a factor of four,
+ * or even a factor of two with a proper byte array value. */
+
byteArrayPtr = (ByteArray *)ckalloc(BYTEARRAY_SIZE(length));
for (dst = byteArrayPtr->bytes; src < srcEnd; ) {
src += TclUtfToUniChar(src, &ch);
@@ -836,7 +842,6 @@ UpdateStringOfByteArray(
for (i = 0; i < length; i++) {
dst += Tcl_UniCharToUtf(src[i], dst);
}
- (void) Tcl_InitStringRep(objPtr, NULL, size);
}
}
@@ -1503,7 +1508,7 @@ BinaryFormatCmd(
*----------------------------------------------------------------------
*/
-int
+static int
BinaryScanCmd(
TCL_UNUSED(ClientData),
Tcl_Interp *interp, /* Current interpreter. */
@@ -2123,7 +2128,7 @@ CopyNumber(
*
* FormatNumber --
*
- * This routine is called by Tcl_BinaryObjCmd to format a number into a
+ * This routine is called by BinaryFormatCmd to format a number into a
* location pointed at by cursor.
*
* Results:
@@ -2292,7 +2297,7 @@ FormatNumber(
*
* ScanNumber --
*
- * This routine is called by Tcl_BinaryObjCmd to scan a number out of a
+ * This routine is called by BinaryScanCmd to scan a number out of a
* buffer.
*
* Results:
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 59818f4..6ca7633 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -124,7 +124,7 @@ Tcl_Obj * Tcl_DbNewBooleanObj(int boolValue, const char *file,
int line);
/* 23 */
EXTERN Tcl_Obj * Tcl_DbNewByteArrayObj(const unsigned char *bytes,
- int length, const char *file, int line);
+ int numBytes, const char *file, int line);
/* 24 */
EXTERN Tcl_Obj * Tcl_DbNewDoubleObj(double doubleValue,
const char *file, int line);
@@ -152,7 +152,7 @@ EXTERN int Tcl_GetBooleanFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, int *boolPtr);
/* 33 */
EXTERN unsigned char * Tcl_GetByteArrayFromObj(Tcl_Obj *objPtr,
- int *lengthPtr);
+ int *numBytesPtr);
/* 34 */
EXTERN int Tcl_GetDouble(Tcl_Interp *interp, const char *src,
double *doublePtr);
@@ -205,7 +205,7 @@ TCL_DEPRECATED("No longer in use, changed to macro")
Tcl_Obj * Tcl_NewBooleanObj(int boolValue);
/* 50 */
EXTERN Tcl_Obj * Tcl_NewByteArrayObj(const unsigned char *bytes,
- int length);
+ int numBytes);
/* 51 */
EXTERN Tcl_Obj * Tcl_NewDoubleObj(double doubleValue);
/* 52 */
@@ -224,10 +224,10 @@ EXTERN Tcl_Obj * Tcl_NewStringObj(const char *bytes, int length);
TCL_DEPRECATED("No longer in use, changed to macro")
void Tcl_SetBooleanObj(Tcl_Obj *objPtr, int boolValue);
/* 58 */
-EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int length);
+EXTERN unsigned char * Tcl_SetByteArrayLength(Tcl_Obj *objPtr, int numBytes);
/* 59 */
EXTERN void Tcl_SetByteArrayObj(Tcl_Obj *objPtr,
- const unsigned char *bytes, int length);
+ const unsigned char *bytes, int numBytes);
/* 60 */
EXTERN void Tcl_SetDoubleObj(Tcl_Obj *objPtr, double doubleValue);
/* 61 */
@@ -1920,8 +1920,12 @@ EXTERN char * Tcl_UniCharToUtfDString(const int *uniStr,
/* 648 */
EXTERN int * Tcl_UtfToUniCharDString(const char *src, int length,
Tcl_DString *dsPtr);
-/* Slot 649 is reserved */
-/* Slot 650 is reserved */
+/* 649 */
+EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, int *numBytesPtr);
+/* 650 */
+EXTERN unsigned char * Tcl_GetBytesFromObj(Tcl_Interp *interp,
+ Tcl_Obj *objPtr, size_t *numBytesPtr);
/* 651 */
EXTERN char * TclGetStringFromObj(Tcl_Obj *objPtr,
size_t *lengthPtr);
@@ -1930,7 +1934,7 @@ EXTERN Tcl_UniChar * TclGetUnicodeFromObj(Tcl_Obj *objPtr,
size_t *lengthPtr);
/* 653 */
EXTERN unsigned char * TclGetByteArrayFromObj(Tcl_Obj *objPtr,
- size_t *lengthPtr);
+ size_t *numBytesPtr);
/* 654 */
EXTERN int Tcl_UtfCharComplete(const char *src, int length);
/* 655 */
@@ -1994,7 +1998,7 @@ typedef struct TclStubs {
void (*tcl_DbIncrRefCount) (Tcl_Obj *objPtr, const char *file, int line); /* 20 */
int (*tcl_DbIsShared) (Tcl_Obj *objPtr, const char *file, int line); /* 21 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewBooleanObj) (int boolValue, const char *file, int line); /* 22 */
- Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int length, const char *file, int line); /* 23 */
+ Tcl_Obj * (*tcl_DbNewByteArrayObj) (const unsigned char *bytes, int numBytes, const char *file, int line); /* 23 */
Tcl_Obj * (*tcl_DbNewDoubleObj) (double doubleValue, const char *file, int line); /* 24 */
Tcl_Obj * (*tcl_DbNewListObj) (int objc, Tcl_Obj *const *objv, const char *file, int line); /* 25 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_DbNewLongObj) (long longValue, const char *file, int line); /* 26 */
@@ -2004,7 +2008,7 @@ typedef struct TclStubs {
void (*tclFreeObj) (Tcl_Obj *objPtr); /* 30 */
int (*tcl_GetBoolean) (Tcl_Interp *interp, const char *src, int *boolPtr); /* 31 */
int (*tcl_GetBooleanFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *boolPtr); /* 32 */
- unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *lengthPtr); /* 33 */
+ unsigned char * (*tcl_GetByteArrayFromObj) (Tcl_Obj *objPtr, int *numBytesPtr); /* 33 */
int (*tcl_GetDouble) (Tcl_Interp *interp, const char *src, double *doublePtr); /* 34 */
int (*tcl_GetDoubleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, double *doublePtr); /* 35 */
TCL_DEPRECATED_API("No longer in use, changed to macro") int (*tcl_GetIndexFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const *tablePtr, const char *msg, int flags, int *indexPtr); /* 36 */
@@ -2021,7 +2025,7 @@ typedef struct TclStubs {
int (*tcl_ListObjLength) (Tcl_Interp *interp, Tcl_Obj *listPtr, int *lengthPtr); /* 47 */
int (*tcl_ListObjReplace) (Tcl_Interp *interp, Tcl_Obj *listPtr, int first, int count, int objc, Tcl_Obj *const objv[]); /* 48 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewBooleanObj) (int boolValue); /* 49 */
- Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int length); /* 50 */
+ Tcl_Obj * (*tcl_NewByteArrayObj) (const unsigned char *bytes, int numBytes); /* 50 */
Tcl_Obj * (*tcl_NewDoubleObj) (double doubleValue); /* 51 */
TCL_DEPRECATED_API("No longer in use, changed to macro") Tcl_Obj * (*tcl_NewIntObj) (int intValue); /* 52 */
Tcl_Obj * (*tcl_NewListObj) (int objc, Tcl_Obj *const objv[]); /* 53 */
@@ -2029,8 +2033,8 @@ typedef struct TclStubs {
Tcl_Obj * (*tcl_NewObj) (void); /* 55 */
Tcl_Obj * (*tcl_NewStringObj) (const char *bytes, int length); /* 56 */
TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetBooleanObj) (Tcl_Obj *objPtr, int boolValue); /* 57 */
- unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int length); /* 58 */
- void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int length); /* 59 */
+ unsigned char * (*tcl_SetByteArrayLength) (Tcl_Obj *objPtr, int numBytes); /* 58 */
+ void (*tcl_SetByteArrayObj) (Tcl_Obj *objPtr, const unsigned char *bytes, int numBytes); /* 59 */
void (*tcl_SetDoubleObj) (Tcl_Obj *objPtr, double doubleValue); /* 60 */
TCL_DEPRECATED_API("No longer in use, changed to macro") void (*tcl_SetIntObj) (Tcl_Obj *objPtr, int intValue); /* 61 */
void (*tcl_SetListObj) (Tcl_Obj *objPtr, int objc, Tcl_Obj *const objv[]); /* 62 */
@@ -2628,11 +2632,11 @@ typedef struct TclStubs {
int (*tcl_UtfToUniChar) (const char *src, int *chPtr); /* 646 */
char * (*tcl_UniCharToUtfDString) (const int *uniStr, int uniLength, Tcl_DString *dsPtr); /* 647 */
int * (*tcl_UtfToUniCharDString) (const char *src, int length, Tcl_DString *dsPtr); /* 648 */
- void (*reserved649)(void);
- void (*reserved650)(void);
+ unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *numBytesPtr); /* 649 */
+ unsigned char * (*tcl_GetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, size_t *numBytesPtr); /* 650 */
char * (*tclGetStringFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 651 */
Tcl_UniChar * (*tclGetUnicodeFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 652 */
- unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *lengthPtr); /* 653 */
+ unsigned char * (*tclGetByteArrayFromObj) (Tcl_Obj *objPtr, size_t *numBytesPtr); /* 653 */
int (*tcl_UtfCharComplete) (const char *src, int length); /* 654 */
const char * (*tcl_UtfNext) (const char *src); /* 655 */
const char * (*tcl_UtfPrev) (const char *src, const char *start); /* 656 */
@@ -3968,8 +3972,10 @@ extern const TclStubs *tclStubsPtr;
(tclStubsPtr->tcl_UniCharToUtfDString) /* 647 */
#define Tcl_UtfToUniCharDString \
(tclStubsPtr->tcl_UtfToUniCharDString) /* 648 */
-/* Slot 649 is reserved */
-/* Slot 650 is reserved */
+#define TclGetBytesFromObj \
+ (tclStubsPtr->tclGetBytesFromObj) /* 649 */
+#define Tcl_GetBytesFromObj \
+ (tclStubsPtr->tcl_GetBytesFromObj) /* 650 */
#define TclGetStringFromObj \
(tclStubsPtr->tclGetStringFromObj) /* 651 */
#define TclGetUnicodeFromObj \
@@ -4202,12 +4208,15 @@ extern const TclStubs *tclStubsPtr;
Tcl_GetStringFromObj(objPtr, (int *)NULL)
#define Tcl_GetUnicode(objPtr) \
Tcl_GetUnicodeFromObj(objPtr, (int *)NULL)
+#undef Tcl_GetBytesFromObj
#ifdef TCL_NO_DEPRECATED
#undef Tcl_GetStringFromObj
#undef Tcl_GetUnicodeFromObj
#undef Tcl_GetByteArrayFromObj
#endif
#if defined(USE_TCL_STUBS)
+#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
+ (sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tclGetBytesFromObj(interp, objPtr, (int *)sizePtr) : tclStubsPtr->tcl_GetBytesFromObj(interp, objPtr, (size_t *)sizePtr))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetStringFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetStringFromObj(objPtr, (size_t *)sizePtr))
@@ -4217,6 +4226,8 @@ extern const TclStubs *tclStubsPtr;
(sizeof(*sizePtr) <= sizeof(int) ? tclStubsPtr->tcl_GetUnicodeFromObj(objPtr, (int *)sizePtr) : tclStubsPtr->tclGetUnicodeFromObj(objPtr, (size_t *)sizePtr))
#endif
#else
+#define Tcl_GetBytesFromObj(interp, objPtr, sizePtr) \
+ (sizeof(*sizePtr) <= sizeof(int) ? (TclGetBytesFromObj)(interp, objPtr, (int *)sizePtr) : (Tcl_GetBytesFromObj)(interp, objPtr, (size_t *)sizePtr))
#ifdef TCL_NO_DEPRECATED
#define Tcl_GetStringFromObj(objPtr, sizePtr) \
(sizeof(*sizePtr) <= sizeof(int) ? (Tcl_GetStringFromObj)(objPtr, (int *)sizePtr) : (TclGetStringFromObj)(objPtr, (size_t *)sizePtr))
diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c
index 900974f..b4249b8 100644
--- a/generic/tclDictObj.c
+++ b/generic/tclDictObj.c
@@ -566,6 +566,7 @@ UpdateStringOfDict(
dst += TclConvertElement(elem, length, dst, flagPtr[i+1]);
*dst++ = ' ';
}
+ /* Last space overwrote the terminating NUL; cal T_ISR again to restore */
(void)Tcl_InitStringRep(dictPtr, NULL, bytesNeeded - 1);
if (flagPtr != localFlags) {
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 8d9ae15..57c6148 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -517,7 +517,7 @@ FillEncodingFileMap(void)
/* Those flags must not conflict with other TCL_ENCODING_* flags in tcl.h */
/* Since TCL_ENCODING_MODIFIED is only used for utf-8/cesu-8 and
- * TCL_ENCODING_LE is only used for utf-16/ucs-2. re-use the same value */
+ * TCL_ENCODING_LE is only used for utf-16/utf-32/ucs-2. re-use the same value */
#define TCL_ENCODING_MODIFIED 0x20 /* Converting NULL bytes to 0xC0 0x80 */
#define TCL_ENCODING_LE TCL_ENCODING_MODIFIED /* Little-endian encoding */
#define TCL_ENCODING_UTF 0x200 /* For UTF-8 encoding, allow 4-byte output sequences */
@@ -2254,15 +2254,15 @@ UtfToUtfProc(
result = TCL_CONVERT_NOSPACE;
break;
}
- if (UCHAR(*src) < 0x80 && !(UCHAR(*src) == 0 && (flags & TCL_ENCODING_MODIFIED))) {
+ if (UCHAR(*src) < 0x80 && !((UCHAR(*src) == 0) && (flags & TCL_ENCODING_MODIFIED))) {
/*
* Copy 7bit characters, but skip null-bytes when we are in input
* mode, so that they get converted to 0xC080.
*/
*dst++ = *src++;
- } else if (UCHAR(*src) == 0xC0 && (src + 1 < srcEnd)
- && UCHAR(src[1]) == 0x80 && !(flags & TCL_ENCODING_MODIFIED)) {
+ } else if ((UCHAR(*src) == 0xC0) && (src + 1 < srcEnd)
+ && (UCHAR(src[1]) == 0x80) && !(flags & TCL_ENCODING_MODIFIED)) {
/*
* Convert 0xC080 to real nulls when we are in output mode.
*/
@@ -2354,7 +2354,7 @@ UtfToUtfProc(
*dstCharsPtr = numChars;
return result;
}
-
+
/*
*-------------------------------------------------------------------------
*
@@ -2450,7 +2450,7 @@ Utf32ToUtfProc(
*dstCharsPtr = numChars;
return result;
}
-
+
/*
*-------------------------------------------------------------------------
*
@@ -2531,13 +2531,13 @@ UtfToUtf32Proc(
src += len;
if (flags & TCL_ENCODING_LE) {
*dst++ = (ch & 0xFF);
- *dst++ = ((ch >> 8) & 0xff);
- *dst++ = ((ch >> 16) & 0xff);
- *dst++ = ((ch >> 24) & 0xff);
+ *dst++ = ((ch >> 8) & 0xFF);
+ *dst++ = ((ch >> 16) & 0xFF);
+ *dst++ = ((ch >> 24) & 0xFF);
} else {
- *dst++ = ((ch >> 24) & 0xff);
- *dst++ = ((ch >> 16) & 0xff);
- *dst++ = ((ch >> 8) & 0xff);
+ *dst++ = ((ch >> 24) & 0xFF);
+ *dst++ = ((ch >> 16) & 0xFF);
+ *dst++ = ((ch >> 8) & 0xFF);
*dst++ = (ch & 0xFF);
}
}
@@ -3049,11 +3049,7 @@ TableFromUtfProc(
len = TclUtfToUniChar(src, &ch);
#if TCL_UTF_MAX > 3
- /*
- * This prevents a crash condition. More evaluation is required for
- * full support of int Tcl_UniChar. [Bug 1004065]
- */
-
+ /* Unicode chars > +U0FFFF cannot be represented in any table encoding */
if (ch & 0xFFFF0000) {
word = 0;
} else
diff --git a/generic/tclInt.decls b/generic/tclInt.decls
index aad7db3..0b3ea9e 100644
--- a/generic/tclInt.decls
+++ b/generic/tclInt.decls
@@ -1037,11 +1037,6 @@ declare 258 {
}
declare 259 {
- unsigned char *TclGetBytesFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
- int *lengthPtr)
-}
-
-declare 260 {
void TclUnusedStubEntry(void)
}
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 08445a5..4e26bf3 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4486,15 +4486,22 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
/*
*----------------------------------------------------------------
* Macro used by the Tcl core to set a Tcl_Obj's string representation to a
- * copy of the "len" bytes starting at "bytePtr". This code works even if the
- * byte array contains NULLs as long as the length is correct. Because "len"
- * is referenced multiple times, it should be as simple an expression as
- * possible. The ANSI C "prototype" for this macro is:
+ * copy of the "len" bytes starting at "bytePtr". The value of "len" must
+ * not be negative. When "len" is 0, then it is acceptable to pass
+ * "bytePtr" = NULL. When "len" > 0, "bytePtr" must not be NULL, and it
+ * must point to a location from which "len" bytes may be read. These
+ * constraints are not checked here. The validity of the bytes copied
+ * as a value string representation is also not verififed. This macro
+ * must not be called while "objPtr" is being freed or when "objPtr"
+ * already has a string representation. The caller must use
+ * this macro properly. Improper use can lead to dangerous results.
+ * Because "len" is referenced multiple times, take care that it is an
+ * expression with the same value each use.
+ *
+ * The ANSI C "prototype" for this macro is:
*
* MODULE_SCOPE void TclInitStringRep(Tcl_Obj *objPtr, char *bytePtr, int len);
*
- * This macro should only be called on an unshared objPtr where
- * objPtr->typePtr->freeIntRepProc == NULL
*----------------------------------------------------------------
*/
diff --git a/generic/tclIntDecls.h b/generic/tclIntDecls.h
index 5ae92e4..75f4a68 100644
--- a/generic/tclIntDecls.h
+++ b/generic/tclIntDecls.h
@@ -659,9 +659,6 @@ EXTERN void TclStaticLibrary(Tcl_Interp *interp,
EXTERN Tcl_Obj * TclpCreateTemporaryDirectory(Tcl_Obj *dirObj,
Tcl_Obj *basenameObj);
/* 259 */
-EXTERN unsigned char * TclGetBytesFromObj(Tcl_Interp *interp,
- Tcl_Obj *objPtr, int *lengthPtr);
-/* 260 */
EXTERN void TclUnusedStubEntry(void);
typedef struct TclIntStubs {
@@ -927,8 +924,7 @@ typedef struct TclIntStubs {
int (*tclPtrUnsetVar) (Tcl_Interp *interp, Tcl_Var varPtr, Tcl_Var arrayPtr, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, const int flags); /* 256 */
void (*tclStaticLibrary) (Tcl_Interp *interp, const char *prefix, Tcl_LibraryInitProc *initProc, Tcl_LibraryInitProc *safeInitProc); /* 257 */
Tcl_Obj * (*tclpCreateTemporaryDirectory) (Tcl_Obj *dirObj, Tcl_Obj *basenameObj); /* 258 */
- unsigned char * (*tclGetBytesFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *lengthPtr); /* 259 */
- void (*tclUnusedStubEntry) (void); /* 260 */
+ void (*tclUnusedStubEntry) (void); /* 259 */
} TclIntStubs;
extern const TclIntStubs *tclIntStubsPtr;
@@ -1374,10 +1370,8 @@ extern const TclIntStubs *tclIntStubsPtr;
(tclIntStubsPtr->tclStaticLibrary) /* 257 */
#define TclpCreateTemporaryDirectory \
(tclIntStubsPtr->tclpCreateTemporaryDirectory) /* 258 */
-#define TclGetBytesFromObj \
- (tclIntStubsPtr->tclGetBytesFromObj) /* 259 */
#define TclUnusedStubEntry \
- (tclIntStubsPtr->tclUnusedStubEntry) /* 260 */
+ (tclIntStubsPtr->tclUnusedStubEntry) /* 259 */
#endif /* defined(USE_TCL_STUBS) */
diff --git a/generic/tclObj.c b/generic/tclObj.c
index e5ec838..92c6655 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -1815,32 +1815,48 @@ Tcl_InitStringRep(
Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
}
- /* Allocate */
if (objPtr->bytes == NULL) {
- /* Allocate only as empty - extend later if bytes copied */
- objPtr->length = 0;
- if (numBytes) {
+ /* Start with no string rep */
+ if (numBytes == 0) {
+ TclInitStringRep(objPtr, NULL, 0);
+ return objPtr->bytes;
+ } else {
objPtr->bytes = (char *)attemptckalloc(numBytes + 1);
- if (objPtr->bytes == NULL) {
- return NULL;
- }
- if (bytes) {
- /* Copy */
- memcpy(objPtr->bytes, bytes, numBytes);
+ if (objPtr->bytes) {
objPtr->length = (int) numBytes;
+ if (bytes) {
+ memcpy(objPtr->bytes, bytes, numBytes);
+ }
+ objPtr->bytes[objPtr->length] = '\0';
}
+ }
+ } else if (objPtr->bytes == &tclEmptyString) {
+ /* Start with empty string rep (not allocated) */
+ if (numBytes == 0) {
+ return objPtr->bytes;
} else {
- TclInitStringRep(objPtr, NULL, 0);
+ objPtr->bytes = (char *)attemptckalloc(numBytes + 1);
+ if (objPtr->bytes) {
+ objPtr->length = (int) numBytes;
+ objPtr->bytes[objPtr->length] = '\0';
+ }
}
} else {
- /* objPtr->bytes != NULL bytes == NULL - Truncate */
- objPtr->bytes = (char *)ckrealloc(objPtr->bytes, numBytes + 1);
- objPtr->length = (int)numBytes;
+ /* Start with non-empty string rep (allocated) */
+ if (numBytes == 0) {
+ ckfree(objPtr->bytes);
+ TclInitStringRep(objPtr, NULL, 0);
+ return objPtr->bytes;
+ } else {
+ objPtr->bytes = (char *)attemptckrealloc(objPtr->bytes,
+ numBytes + 1);
+ if (objPtr->bytes) {
+ objPtr->length = (int) numBytes;
+ objPtr->bytes[objPtr->length] = '\0';
+ }
+ }
}
- /* Terminate */
- objPtr->bytes[objPtr->length] = '\0';
-
return objPtr->bytes;
}
@@ -3517,7 +3533,6 @@ UpdateStringOfBignum(
if (MP_OKAY != mp_to_radix(&bignumVal, stringVal, size, NULL, 10)) {
Tcl_Panic("conversion failure in UpdateStringOfBignum");
}
- (void) Tcl_InitStringRep(objPtr, NULL, size - 1);
}
/*
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 533e2c7..a1878c1 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -1041,8 +1041,7 @@ static const TclIntStubs tclIntStubs = {
TclPtrUnsetVar, /* 256 */
TclStaticLibrary, /* 257 */
TclpCreateTemporaryDirectory, /* 258 */
- TclGetBytesFromObj, /* 259 */
- TclUnusedStubEntry, /* 260 */
+ TclUnusedStubEntry, /* 259 */
};
static const TclIntPlatStubs tclIntPlatStubs = {
@@ -1933,8 +1932,8 @@ const TclStubs tclStubs = {
Tcl_UtfToUniChar, /* 646 */
Tcl_UniCharToUtfDString, /* 647 */
Tcl_UtfToUniCharDString, /* 648 */
- 0, /* 649 */
- 0, /* 650 */
+ TclGetBytesFromObj, /* 649 */
+ Tcl_GetBytesFromObj, /* 650 */
TclGetStringFromObj, /* 651 */
TclGetUnicodeFromObj, /* 652 */
TclGetByteArrayFromObj, /* 653 */
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 08785fc..46a1459 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -5061,7 +5061,7 @@ TestbytestringObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* The argument objects. */
{
- int n = 0;
+ size_t n = 0;
const char *p;
if (objc != 2) {
@@ -5069,7 +5069,7 @@ TestbytestringObjCmd(
return TCL_ERROR;
}
- p = (const char *)TclGetBytesFromObj(interp, objv[1], &n);
+ p = (const char *)Tcl_GetBytesFromObj(interp, objv[1], &n);
if (p == NULL) {
return TCL_ERROR;
}
diff --git a/generic/tclZipfs.c b/generic/tclZipfs.c
index 4b7aafa..98a2820 100644
--- a/generic/tclZipfs.c
+++ b/generic/tclZipfs.c
@@ -308,13 +308,11 @@ static inline int ListMountPoints(Tcl_Interp *interp);
static void SerializeCentralDirectoryEntry(
const unsigned char *start,
const unsigned char *end, unsigned char *buf,
- ZipEntry *z, size_t nameLength,
- long long dataStartOffset);
+ ZipEntry *z, size_t nameLength);
static void SerializeCentralDirectorySuffix(
const unsigned char *start,
const unsigned char *end, unsigned char *buf,
- int entryCount, long long dataStartOffset,
- long long directoryStartOffset,
+ int entryCount, long long directoryStartOffset,
long long suffixStartOffset);
static void SerializeLocalEntryHeader(
const unsigned char *start,
@@ -1187,7 +1185,7 @@ ZipFSFindTOC(
int needZip,
ZipFile *zf)
{
- size_t i;
+ size_t i, minoff;
const unsigned char *p, *q;
const unsigned char *start = zf->data;
const unsigned char *end = zf->data + zf->length;
@@ -1245,6 +1243,8 @@ ZipFSFindTOC(
q = zf->data + ZipReadInt(start, end, p + ZIP_CENTRAL_DIRSTART_OFFS);
p -= ZipReadInt(start, end, p + ZIP_CENTRAL_DIRSIZE_OFFS);
+ zf->baseOffset = zf->passOffset = (p>q) ? p - q : 0;
+ zf->directoryOffset = q - zf->data + zf->baseOffset;
if ((p < q) || (p < zf->data) || (p > zf->data + zf->length)
|| (q < zf->data) || (q > zf->data + zf->length)) {
if (!needZip) {
@@ -1260,11 +1260,11 @@ ZipFSFindTOC(
* Read the central directory.
*/
- zf->baseOffset = zf->passOffset = p - q;
- zf->directoryOffset = p - zf->data;
q = p;
+ minoff = zf->length;
for (i = 0; i < zf->numFiles; i++) {
int pathlen, comlen, extra;
+ size_t localhdr_off = zf->length;
if (q + ZIP_CENTRAL_HEADER_LEN > end) {
ZIPFS_ERROR(interp, "wrong header length");
@@ -1279,16 +1279,27 @@ ZipFSFindTOC(
pathlen = ZipReadShort(start, end, q + ZIP_CENTRAL_PATHLEN_OFFS);
comlen = ZipReadShort(start, end, q + ZIP_CENTRAL_FCOMMENTLEN_OFFS);
extra = ZipReadShort(start, end, q + ZIP_CENTRAL_EXTRALEN_OFFS);
+ localhdr_off = ZipReadInt(start, end, q + ZIP_CENTRAL_LOCALHDR_OFFS);
+ if (ZipReadInt(start, end, zf->data + zf->baseOffset + localhdr_off) != ZIP_LOCAL_HEADER_SIG) {
+ ZIPFS_ERROR(interp, "Failed to find local header");
+ ZIPFS_ERROR_CODE(interp, "LCL_HDR");
+ goto error;
+ }
+ if (localhdr_off < minoff) {
+ minoff = localhdr_off;
+ }
q += pathlen + comlen + extra + ZIP_CENTRAL_HEADER_LEN;
}
+ zf->passOffset = minoff + zf->baseOffset;
+
/*
* If there's also an encoded password, extract that too (but don't decode
* yet).
*/
- q = zf->data + zf->baseOffset;
- if ((zf->baseOffset >= 6) &&
+ q = zf->data + zf->passOffset;
+ if ((zf->passOffset >= 6) && (start < q-4) &&
(ZipReadInt(start, end, q - 4) == ZIP_PASSWORD_END_SIG)) {
const unsigned char *passPtr;
@@ -1300,6 +1311,7 @@ ZipFSFindTOC(
zf->passOffset -= i ? (5 + i) : 0;
}
}
+
return TCL_OK;
error:
@@ -2991,8 +3003,6 @@ ZipFSMkZipOrImg(
Tcl_Channel out;
int pwlen = 0, slen = 0, count, ret = TCL_ERROR, lobjc;
size_t len, i = 0;
- long long dataStartOffset; /* The overall file offset of the start of the
- * data section of the file. */
long long directoryStartOffset;
/* The overall file offset of the start of the
* central directory. */
@@ -3169,7 +3179,6 @@ ZipFSMkZipOrImg(
*/
Tcl_InitHashTable(&fileHash, TCL_STRING_KEYS);
- dataStartOffset = Tcl_Tell(out);
if (mappingList == NULL && stripPrefix != NULL) {
strip = Tcl_GetStringFromObj(stripPrefix, &slen);
if (!slen) {
@@ -3210,7 +3219,7 @@ ZipFSMkZipOrImg(
name = Tcl_UtfToExternalDString(ZipFS.utf8, z->name, -1, &ds);
len = Tcl_DStringLength(&ds);
SerializeCentralDirectoryEntry(start, end, (unsigned char *) buf,
- z, len, dataStartOffset);
+ z, len);
if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN)
!= ZIP_CENTRAL_HEADER_LEN)
|| ((size_t) Tcl_Write(out, name, len) != len)) {
@@ -3230,7 +3239,7 @@ ZipFSMkZipOrImg(
Tcl_Flush(out);
suffixStartOffset = Tcl_Tell(out);
SerializeCentralDirectorySuffix(start, end, (unsigned char *) buf,
- count, dataStartOffset, directoryStartOffset, suffixStartOffset);
+ count, directoryStartOffset, suffixStartOffset);
if (Tcl_Write(out, buf, ZIP_CENTRAL_END_LEN) != ZIP_CENTRAL_END_LEN) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"write error: %s", Tcl_PosixError(interp)));
@@ -3387,9 +3396,7 @@ SerializeCentralDirectoryEntry(
const unsigned char *end, /* The end of writable memory. */
unsigned char *buf, /* Where to serialize to */
ZipEntry *z, /* The description of what to serialize. */
- size_t nameLength, /* The length of the name. */
- long long dataStartOffset) /* The overall file offset of the start of the
- * data section of the file. */
+ size_t nameLength) /* The length of the name. */
{
ZipWriteInt(start, end, buf + ZIP_CENTRAL_SIG_OFFS,
ZIP_CENTRAL_HEADER_SIG);
@@ -3414,7 +3421,7 @@ SerializeCentralDirectoryEntry(
ZipWriteShort(start, end, buf + ZIP_CENTRAL_IATTR_OFFS, 0);
ZipWriteInt(start, end, buf + ZIP_CENTRAL_EATTR_OFFS, 0);
ZipWriteInt(start, end, buf + ZIP_CENTRAL_LOCALHDR_OFFS,
- z->offset - dataStartOffset);
+ z->offset);
}
static void
@@ -3423,8 +3430,6 @@ SerializeCentralDirectorySuffix(
const unsigned char *end, /* The end of writable memory. */
unsigned char *buf, /* Where to serialize to */
int entryCount, /* The number of entries in the directory */
- long long dataStartOffset, /* The overall file offset of the start of the
- * data section of the file. */
long long directoryStartOffset,
/* The overall file offset of the start of the
* central directory. */
@@ -3441,7 +3446,7 @@ SerializeCentralDirectorySuffix(
ZipWriteInt(start, end, buf + ZIP_CENTRAL_DIRSIZE_OFFS,
suffixStartOffset - directoryStartOffset);
ZipWriteInt(start, end, buf + ZIP_CENTRAL_DIRSTART_OFFS,
- directoryStartOffset - dataStartOffset);
+ directoryStartOffset);
ZipWriteShort(start, end, buf + ZIP_CENTRAL_COMMENTLEN_OFFS, 0);
}
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 440bb9a..c9bc77f 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -1154,7 +1154,7 @@ Tcl_ZlibStreamSetCompressionDictionary(
ZlibStreamHandle *zshPtr = (ZlibStreamHandle *) zshandle;
if (compressionDictionaryObj && (NULL == TclGetBytesFromObj(NULL,
- compressionDictionaryObj, NULL))) {
+ compressionDictionaryObj, (int *)NULL))) {
/* Missing or invalid compression dictionary */
compressionDictionaryObj = NULL;
}
diff --git a/library/manifest.txt b/library/manifest.txt
index afd44cf..fdae645 100644
--- a/library/manifest.txt
+++ b/library/manifest.txt
@@ -10,7 +10,7 @@ apply {{dir} {
1 opt 0.4.8 {opt optparse.tcl}
0 cookiejar 0.2.0 {cookiejar cookiejar.tcl}
0 tcl::idna 1.0.1 {cookiejar idna.tcl}
- 0 platform 1.0.17 {platform platform.tcl}
+ 0 platform 1.0.18 {platform platform.tcl}
0 platform::shell 1.1.4 {platform shell.tcl}
1 tcltest 2.5.4 {tcltest tcltest.tcl}
} {
diff --git a/library/platform/pkgIndex.tcl b/library/platform/pkgIndex.tcl
index 7983831..de28fd1 100644
--- a/library/platform/pkgIndex.tcl
+++ b/library/platform/pkgIndex.tcl
@@ -1,3 +1,3 @@
-package ifneeded platform 1.0.17 [list source [file join $dir platform.tcl]]
+package ifneeded platform 1.0.18 [list source [file join $dir platform.tcl]]
package ifneeded platform::shell 1.1.4 [list source [file join $dir shell.tcl]]
diff --git a/library/platform/platform.tcl b/library/platform/platform.tcl
index e01334e..752f069 100644
--- a/library/platform/platform.tcl
+++ b/library/platform/platform.tcl
@@ -364,6 +364,17 @@ proc ::platform::patterns {id} {
foreach {major minor} [split $v .] break
set res {}
+ if {$major eq 12} {
+ # Add 12.0 to 12.minor to patterns.
+ for {set j $minor} {$j >= 0} {incr j -1} {
+ lappend res macosx${major}.${j}-${cpu}
+ foreach a $alt {
+ lappend res macosx${major}.${j}-$a
+ }
+ }
+ set major 11
+ set minor 5
+ }
if {$major eq 11} {
# Add 11.0 to 11.minor to patterns.
for {set j $minor} {$j >= 0} {incr j -1} {
@@ -409,7 +420,7 @@ proc ::platform::patterns {id} {
# ### ### ### ######### ######### #########
## Ready
-package provide platform 1.0.17
+package provide platform 1.0.18
# ### ### ### ######### ######### #########
## Demo application
diff --git a/library/tzdata/Asia/Gaza b/library/tzdata/Asia/Gaza
index 95523c9..86282fa 100644
--- a/library/tzdata/Asia/Gaza
+++ b/library/tzdata/Asia/Gaza
@@ -124,161 +124,161 @@ set TZData(:Asia/Gaza) {
{1585346400 10800 1 EEST}
{1603490400 7200 0 EET}
{1616796000 10800 1 EEST}
- {1635544800 7200 0 EET}
+ {1635458400 7200 0 EET}
{1648245600 10800 1 EEST}
- {1666994400 7200 0 EET}
+ {1666908000 7200 0 EET}
{1679695200 10800 1 EEST}
- {1698444000 7200 0 EET}
+ {1698357600 7200 0 EET}
{1711749600 10800 1 EEST}
- {1729893600 7200 0 EET}
+ {1729807200 7200 0 EET}
{1743199200 10800 1 EEST}
- {1761343200 7200 0 EET}
+ {1761861600 7200 0 EET}
{1774648800 10800 1 EEST}
- {1792792800 7200 0 EET}
+ {1793311200 7200 0 EET}
{1806098400 10800 1 EEST}
- {1824847200 7200 0 EET}
+ {1824760800 7200 0 EET}
{1837548000 10800 1 EEST}
- {1856296800 7200 0 EET}
+ {1856210400 7200 0 EET}
{1868997600 10800 1 EEST}
- {1887746400 7200 0 EET}
+ {1887660000 7200 0 EET}
{1901052000 10800 1 EEST}
- {1919196000 7200 0 EET}
+ {1919109600 7200 0 EET}
{1932501600 10800 1 EEST}
- {1950645600 7200 0 EET}
+ {1951164000 7200 0 EET}
{1963951200 10800 1 EEST}
- {1982700000 7200 0 EET}
+ {1982613600 7200 0 EET}
{1995400800 10800 1 EEST}
- {2014149600 7200 0 EET}
+ {2014063200 7200 0 EET}
{2026850400 10800 1 EEST}
- {2045599200 7200 0 EET}
+ {2045512800 7200 0 EET}
{2058300000 10800 1 EEST}
- {2077048800 7200 0 EET}
+ {2076962400 7200 0 EET}
{2090354400 10800 1 EEST}
- {2108498400 7200 0 EET}
+ {2109016800 7200 0 EET}
{2121804000 10800 1 EEST}
- {2139948000 7200 0 EET}
+ {2140466400 7200 0 EET}
{2153253600 10800 1 EEST}
- {2172002400 7200 0 EET}
+ {2171916000 7200 0 EET}
{2184703200 10800 1 EEST}
- {2203452000 7200 0 EET}
+ {2203365600 7200 0 EET}
{2216152800 10800 1 EEST}
- {2234901600 7200 0 EET}
+ {2234815200 7200 0 EET}
{2248207200 10800 1 EEST}
- {2266351200 7200 0 EET}
+ {2266264800 7200 0 EET}
{2279656800 10800 1 EEST}
- {2297800800 7200 0 EET}
+ {2298319200 7200 0 EET}
{2311106400 10800 1 EEST}
- {2329250400 7200 0 EET}
+ {2329768800 7200 0 EET}
{2342556000 10800 1 EEST}
- {2361304800 7200 0 EET}
+ {2361218400 7200 0 EET}
{2374005600 10800 1 EEST}
- {2392754400 7200 0 EET}
+ {2392668000 7200 0 EET}
{2405455200 10800 1 EEST}
- {2424204000 7200 0 EET}
+ {2424117600 7200 0 EET}
{2437509600 10800 1 EEST}
- {2455653600 7200 0 EET}
+ {2455567200 7200 0 EET}
{2468959200 10800 1 EEST}
- {2487103200 7200 0 EET}
+ {2487621600 7200 0 EET}
{2500408800 10800 1 EEST}
- {2519157600 7200 0 EET}
+ {2519071200 7200 0 EET}
{2531858400 10800 1 EEST}
- {2550607200 7200 0 EET}
+ {2550520800 7200 0 EET}
{2563308000 10800 1 EEST}
- {2582056800 7200 0 EET}
+ {2581970400 7200 0 EET}
{2595362400 10800 1 EEST}
- {2613506400 7200 0 EET}
+ {2613420000 7200 0 EET}
{2626812000 10800 1 EEST}
- {2644956000 7200 0 EET}
+ {2645474400 7200 0 EET}
{2658261600 10800 1 EEST}
- {2676405600 7200 0 EET}
+ {2676924000 7200 0 EET}
{2689711200 10800 1 EEST}
- {2708460000 7200 0 EET}
+ {2708373600 7200 0 EET}
{2721160800 10800 1 EEST}
- {2739909600 7200 0 EET}
+ {2739823200 7200 0 EET}
{2752610400 10800 1 EEST}
- {2771359200 7200 0 EET}
+ {2771272800 7200 0 EET}
{2784664800 10800 1 EEST}
- {2802808800 7200 0 EET}
+ {2802722400 7200 0 EET}
{2816114400 10800 1 EEST}
- {2834258400 7200 0 EET}
+ {2834776800 7200 0 EET}
{2847564000 10800 1 EEST}
- {2866312800 7200 0 EET}
+ {2866226400 7200 0 EET}
{2879013600 10800 1 EEST}
- {2897762400 7200 0 EET}
+ {2897676000 7200 0 EET}
{2910463200 10800 1 EEST}
- {2929212000 7200 0 EET}
+ {2929125600 7200 0 EET}
{2941912800 10800 1 EEST}
- {2960661600 7200 0 EET}
+ {2960575200 7200 0 EET}
{2973967200 10800 1 EEST}
- {2992111200 7200 0 EET}
+ {2992629600 7200 0 EET}
{3005416800 10800 1 EEST}
- {3023560800 7200 0 EET}
+ {3024079200 7200 0 EET}
{3036866400 10800 1 EEST}
- {3055615200 7200 0 EET}
+ {3055528800 7200 0 EET}
{3068316000 10800 1 EEST}
- {3087064800 7200 0 EET}
+ {3086978400 7200 0 EET}
{3099765600 10800 1 EEST}
- {3118514400 7200 0 EET}
+ {3118428000 7200 0 EET}
{3131820000 10800 1 EEST}
- {3149964000 7200 0 EET}
+ {3149877600 7200 0 EET}
{3163269600 10800 1 EEST}
- {3181413600 7200 0 EET}
+ {3181932000 7200 0 EET}
{3194719200 10800 1 EEST}
- {3212863200 7200 0 EET}
+ {3213381600 7200 0 EET}
{3226168800 10800 1 EEST}
- {3244917600 7200 0 EET}
+ {3244831200 7200 0 EET}
{3257618400 10800 1 EEST}
- {3276367200 7200 0 EET}
+ {3276280800 7200 0 EET}
{3289068000 10800 1 EEST}
- {3307816800 7200 0 EET}
+ {3307730400 7200 0 EET}
{3321122400 10800 1 EEST}
- {3339266400 7200 0 EET}
+ {3339180000 7200 0 EET}
{3352572000 10800 1 EEST}
- {3370716000 7200 0 EET}
+ {3371234400 7200 0 EET}
{3384021600 10800 1 EEST}
- {3402770400 7200 0 EET}
+ {3402684000 7200 0 EET}
{3415471200 10800 1 EEST}
- {3434220000 7200 0 EET}
+ {3434133600 7200 0 EET}
{3446920800 10800 1 EEST}
- {3465669600 7200 0 EET}
+ {3465583200 7200 0 EET}
{3478975200 10800 1 EEST}
- {3497119200 7200 0 EET}
+ {3497032800 7200 0 EET}
{3510424800 10800 1 EEST}
- {3528568800 7200 0 EET}
+ {3529087200 7200 0 EET}
{3541874400 10800 1 EEST}
- {3560018400 7200 0 EET}
+ {3560536800 7200 0 EET}
{3573324000 10800 1 EEST}
- {3592072800 7200 0 EET}
+ {3591986400 7200 0 EET}
{3604773600 10800 1 EEST}
- {3623522400 7200 0 EET}
+ {3623436000 7200 0 EET}
{3636223200 10800 1 EEST}
- {3654972000 7200 0 EET}
+ {3654885600 7200 0 EET}
{3668277600 10800 1 EEST}
- {3686421600 7200 0 EET}
+ {3686335200 7200 0 EET}
{3699727200 10800 1 EEST}
- {3717871200 7200 0 EET}
+ {3718389600 7200 0 EET}
{3731176800 10800 1 EEST}
- {3749925600 7200 0 EET}
+ {3749839200 7200 0 EET}
{3762626400 10800 1 EEST}
- {3781375200 7200 0 EET}
+ {3781288800 7200 0 EET}
{3794076000 10800 1 EEST}
- {3812824800 7200 0 EET}
+ {3812738400 7200 0 EET}
{3825525600 10800 1 EEST}
- {3844274400 7200 0 EET}
+ {3844188000 7200 0 EET}
{3857580000 10800 1 EEST}
- {3875724000 7200 0 EET}
+ {3876242400 7200 0 EET}
{3889029600 10800 1 EEST}
- {3907173600 7200 0 EET}
+ {3907692000 7200 0 EET}
{3920479200 10800 1 EEST}
- {3939228000 7200 0 EET}
+ {3939141600 7200 0 EET}
{3951928800 10800 1 EEST}
- {3970677600 7200 0 EET}
+ {3970591200 7200 0 EET}
{3983378400 10800 1 EEST}
- {4002127200 7200 0 EET}
+ {4002040800 7200 0 EET}
{4015432800 10800 1 EEST}
- {4033576800 7200 0 EET}
+ {4033490400 7200 0 EET}
{4046882400 10800 1 EEST}
- {4065026400 7200 0 EET}
+ {4065544800 7200 0 EET}
{4078332000 10800 1 EEST}
- {4096476000 7200 0 EET}
+ {4096994400 7200 0 EET}
}
diff --git a/library/tzdata/Asia/Hebron b/library/tzdata/Asia/Hebron
index 3fdcd65..7559347 100644
--- a/library/tzdata/Asia/Hebron
+++ b/library/tzdata/Asia/Hebron
@@ -123,161 +123,161 @@ set TZData(:Asia/Hebron) {
{1585346400 10800 1 EEST}
{1603490400 7200 0 EET}
{1616796000 10800 1 EEST}
- {1635544800 7200 0 EET}
+ {1635458400 7200 0 EET}
{1648245600 10800 1 EEST}
- {1666994400 7200 0 EET}
+ {1666908000 7200 0 EET}
{1679695200 10800 1 EEST}
- {1698444000 7200 0 EET}
+ {1698357600 7200 0 EET}
{1711749600 10800 1 EEST}
- {1729893600 7200 0 EET}
+ {1729807200 7200 0 EET}
{1743199200 10800 1 EEST}
- {1761343200 7200 0 EET}
+ {1761861600 7200 0 EET}
{1774648800 10800 1 EEST}
- {1792792800 7200 0 EET}
+ {1793311200 7200 0 EET}
{1806098400 10800 1 EEST}
- {1824847200 7200 0 EET}
+ {1824760800 7200 0 EET}
{1837548000 10800 1 EEST}
- {1856296800 7200 0 EET}
+ {1856210400 7200 0 EET}
{1868997600 10800 1 EEST}
- {1887746400 7200 0 EET}
+ {1887660000 7200 0 EET}
{1901052000 10800 1 EEST}
- {1919196000 7200 0 EET}
+ {1919109600 7200 0 EET}
{1932501600 10800 1 EEST}
- {1950645600 7200 0 EET}
+ {1951164000 7200 0 EET}
{1963951200 10800 1 EEST}
- {1982700000 7200 0 EET}
+ {1982613600 7200 0 EET}
{1995400800 10800 1 EEST}
- {2014149600 7200 0 EET}
+ {2014063200 7200 0 EET}
{2026850400 10800 1 EEST}
- {2045599200 7200 0 EET}
+ {2045512800 7200 0 EET}
{2058300000 10800 1 EEST}
- {2077048800 7200 0 EET}
+ {2076962400 7200 0 EET}
{2090354400 10800 1 EEST}
- {2108498400 7200 0 EET}
+ {2109016800 7200 0 EET}
{2121804000 10800 1 EEST}
- {2139948000 7200 0 EET}
+ {2140466400 7200 0 EET}
{2153253600 10800 1 EEST}
- {2172002400 7200 0 EET}
+ {2171916000 7200 0 EET}
{2184703200 10800 1 EEST}
- {2203452000 7200 0 EET}
+ {2203365600 7200 0 EET}
{2216152800 10800 1 EEST}
- {2234901600 7200 0 EET}
+ {2234815200 7200 0 EET}
{2248207200 10800 1 EEST}
- {2266351200 7200 0 EET}
+ {2266264800 7200 0 EET}
{2279656800 10800 1 EEST}
- {2297800800 7200 0 EET}
+ {2298319200 7200 0 EET}
{2311106400 10800 1 EEST}
- {2329250400 7200 0 EET}
+ {2329768800 7200 0 EET}
{2342556000 10800 1 EEST}
- {2361304800 7200 0 EET}
+ {2361218400 7200 0 EET}
{2374005600 10800 1 EEST}
- {2392754400 7200 0 EET}
+ {2392668000 7200 0 EET}
{2405455200 10800 1 EEST}
- {2424204000 7200 0 EET}
+ {2424117600 7200 0 EET}
{2437509600 10800 1 EEST}
- {2455653600 7200 0 EET}
+ {2455567200 7200 0 EET}
{2468959200 10800 1 EEST}
- {2487103200 7200 0 EET}
+ {2487621600 7200 0 EET}
{2500408800 10800 1 EEST}
- {2519157600 7200 0 EET}
+ {2519071200 7200 0 EET}
{2531858400 10800 1 EEST}
- {2550607200 7200 0 EET}
+ {2550520800 7200 0 EET}
{2563308000 10800 1 EEST}
- {2582056800 7200 0 EET}
+ {2581970400 7200 0 EET}
{2595362400 10800 1 EEST}
- {2613506400 7200 0 EET}
+ {2613420000 7200 0 EET}
{2626812000 10800 1 EEST}
- {2644956000 7200 0 EET}
+ {2645474400 7200 0 EET}
{2658261600 10800 1 EEST}
- {2676405600 7200 0 EET}
+ {2676924000 7200 0 EET}
{2689711200 10800 1 EEST}
- {2708460000 7200 0 EET}
+ {2708373600 7200 0 EET}
{2721160800 10800 1 EEST}
- {2739909600 7200 0 EET}
+ {2739823200 7200 0 EET}
{2752610400 10800 1 EEST}
- {2771359200 7200 0 EET}
+ {2771272800 7200 0 EET}
{2784664800 10800 1 EEST}
- {2802808800 7200 0 EET}
+ {2802722400 7200 0 EET}
{2816114400 10800 1 EEST}
- {2834258400 7200 0 EET}
+ {2834776800 7200 0 EET}
{2847564000 10800 1 EEST}
- {2866312800 7200 0 EET}
+ {2866226400 7200 0 EET}
{2879013600 10800 1 EEST}
- {2897762400 7200 0 EET}
+ {2897676000 7200 0 EET}
{2910463200 10800 1 EEST}
- {2929212000 7200 0 EET}
+ {2929125600 7200 0 EET}
{2941912800 10800 1 EEST}
- {2960661600 7200 0 EET}
+ {2960575200 7200 0 EET}
{2973967200 10800 1 EEST}
- {2992111200 7200 0 EET}
+ {2992629600 7200 0 EET}
{3005416800 10800 1 EEST}
- {3023560800 7200 0 EET}
+ {3024079200 7200 0 EET}
{3036866400 10800 1 EEST}
- {3055615200 7200 0 EET}
+ {3055528800 7200 0 EET}
{3068316000 10800 1 EEST}
- {3087064800 7200 0 EET}
+ {3086978400 7200 0 EET}
{3099765600 10800 1 EEST}
- {3118514400 7200 0 EET}
+ {3118428000 7200 0 EET}
{3131820000 10800 1 EEST}
- {3149964000 7200 0 EET}
+ {3149877600 7200 0 EET}
{3163269600 10800 1 EEST}
- {3181413600 7200 0 EET}
+ {3181932000 7200 0 EET}
{3194719200 10800 1 EEST}
- {3212863200 7200 0 EET}
+ {3213381600 7200 0 EET}
{3226168800 10800 1 EEST}
- {3244917600 7200 0 EET}
+ {3244831200 7200 0 EET}
{3257618400 10800 1 EEST}
- {3276367200 7200 0 EET}
+ {3276280800 7200 0 EET}
{3289068000 10800 1 EEST}
- {3307816800 7200 0 EET}
+ {3307730400 7200 0 EET}
{3321122400 10800 1 EEST}
- {3339266400 7200 0 EET}
+ {3339180000 7200 0 EET}
{3352572000 10800 1 EEST}
- {3370716000 7200 0 EET}
+ {3371234400 7200 0 EET}
{3384021600 10800 1 EEST}
- {3402770400 7200 0 EET}
+ {3402684000 7200 0 EET}
{3415471200 10800 1 EEST}
- {3434220000 7200 0 EET}
+ {3434133600 7200 0 EET}
{3446920800 10800 1 EEST}
- {3465669600 7200 0 EET}
+ {3465583200 7200 0 EET}
{3478975200 10800 1 EEST}
- {3497119200 7200 0 EET}
+ {3497032800 7200 0 EET}
{3510424800 10800 1 EEST}
- {3528568800 7200 0 EET}
+ {3529087200 7200 0 EET}
{3541874400 10800 1 EEST}
- {3560018400 7200 0 EET}
+ {3560536800 7200 0 EET}
{3573324000 10800 1 EEST}
- {3592072800 7200 0 EET}
+ {3591986400 7200 0 EET}
{3604773600 10800 1 EEST}
- {3623522400 7200 0 EET}
+ {3623436000 7200 0 EET}
{3636223200 10800 1 EEST}
- {3654972000 7200 0 EET}
+ {3654885600 7200 0 EET}
{3668277600 10800 1 EEST}
- {3686421600 7200 0 EET}
+ {3686335200 7200 0 EET}
{3699727200 10800 1 EEST}
- {3717871200 7200 0 EET}
+ {3718389600 7200 0 EET}
{3731176800 10800 1 EEST}
- {3749925600 7200 0 EET}
+ {3749839200 7200 0 EET}
{3762626400 10800 1 EEST}
- {3781375200 7200 0 EET}
+ {3781288800 7200 0 EET}
{3794076000 10800 1 EEST}
- {3812824800 7200 0 EET}
+ {3812738400 7200 0 EET}
{3825525600 10800 1 EEST}
- {3844274400 7200 0 EET}
+ {3844188000 7200 0 EET}
{3857580000 10800 1 EEST}
- {3875724000 7200 0 EET}
+ {3876242400 7200 0 EET}
{3889029600 10800 1 EEST}
- {3907173600 7200 0 EET}
+ {3907692000 7200 0 EET}
{3920479200 10800 1 EEST}
- {3939228000 7200 0 EET}
+ {3939141600 7200 0 EET}
{3951928800 10800 1 EEST}
- {3970677600 7200 0 EET}
+ {3970591200 7200 0 EET}
{3983378400 10800 1 EEST}
- {4002127200 7200 0 EET}
+ {4002040800 7200 0 EET}
{4015432800 10800 1 EEST}
- {4033576800 7200 0 EET}
+ {4033490400 7200 0 EET}
{4046882400 10800 1 EEST}
- {4065026400 7200 0 EET}
+ {4065544800 7200 0 EET}
{4078332000 10800 1 EEST}
- {4096476000 7200 0 EET}
+ {4096994400 7200 0 EET}
}
diff --git a/tests/cmdIL.test b/tests/cmdIL.test
index 063750c..5a68925 100644
--- a/tests/cmdIL.test
+++ b/tests/cmdIL.test
@@ -776,7 +776,7 @@ test cmdIL-7.6 {lreverse command - unshared object [Bug 1672585]} {
test cmdIL-7.7 {lreverse command - empty object [Bug 1876793]} {
lreverse [list]
} {}
-test cmdIL-7.8 {lreverse command - shared intrep [Bug 1675044]} -setup {
+test cmdIL-7.8 {lreverse command - shared internalrep [Bug 1675044]} -setup {
teststringobj set 1 {1 2 3}
testobj convert 1 list
testobj duplicate 1 2
diff --git a/tests/format.test b/tests/format.test
index 0dd55f0..c5053e8 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -620,12 +620,12 @@ test format-19.4.2 {Bug d498578df4: width overflow should cause limit exceeded}
} -returnCodes error -result "max size for a Tcl value exceeded"
# Note that this test may fail in future versions
-test format-20.1 {Bug 2932421: plain %s caused intrep change of args} -body {
+test format-20.1 {Bug 2932421: plain %s caused internalrep change of args} -body {
set x [dict create a b c d]
format %s $x
# After this, obj in $x should be a dict
# We are testing to make sure it has not been shimmered to a
- # different intrep when that is not necessary.
+ # different internalrep when that is not necessary.
# Whether or not there is a string rep - we should not care!
tcl::unsupported::representation $x
} -match glob -result {value is a dict *}
diff --git a/tests/io.test b/tests/io.test
index e26c97f..0ef3422 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -8752,7 +8752,7 @@ test io-73.1 {channel Tcl_Obj SetChannelFromAny} {} {
} {1}
test io-73.2 {channel Tcl_Obj SetChannelFromAny, bug 2407783} -setup {
- # Invalidate intrep of 'channel' Tcl_Obj when transiting between interpreters.
+ # Invalidate internalrep of 'channel' Tcl_Obj when transiting between interpreters.
set f [open [info script] r]
} -body {
interp create foo
diff --git a/tests/lset.test b/tests/lset.test
index 5093369..72d68ec 100644
--- a/tests/lset.test
+++ b/tests/lset.test
@@ -412,7 +412,7 @@ test lset-14.2 {lset, not compiled, flat args, is string rep preserved?} testeva
} "{ { 1 2 } { 3 4 } } { 3 4 }"
testConstraint testobj [llength [info commands testobj]]
-test lset-15.1 {lset: shared intrep [Bug 1677512]} -setup {
+test lset-15.1 {lset: shared internalrep [Bug 1677512]} -setup {
teststringobj set 1 {{1 2} 3}
testobj convert 1 list
testobj duplicate 1 2
diff --git a/tests/var.test b/tests/var.test
index 3ca1a76..15edf6e 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -1038,7 +1038,7 @@ test var-22.0 {leak in array element unset: Bug a3309d01db} -setup {
array unset A
rename doit {}
} -result 0
-test var-22.1 {leak in localVarName intrep: Bug 80304238ac} -setup {
+test var-22.1 {leak in localVarName internalrep: Bug 80304238ac} -setup {
proc doit {} {
interp create child
child eval {
diff --git a/unix/Makefile.in b/unix/Makefile.in
index d5ba886..b624340 100644
--- a/unix/Makefile.in
+++ b/unix/Makefile.in
@@ -1052,9 +1052,9 @@ install-libraries: libraries
@echo "Installing package tcltest 2.5.4 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/tcltest/tcltest.tcl \
"$(MODULE_INSTALL_DIR)/8.5/tcltest-2.5.4.tm"
- @echo "Installing package platform 1.0.17 as a Tcl Module"
+ @echo "Installing package platform 1.0.18 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/platform/platform.tcl \
- "$(MODULE_INSTALL_DIR)/8.4/platform-1.0.17.tm"
+ "$(MODULE_INSTALL_DIR)/8.4/platform-1.0.18.tm"
@echo "Installing package platform::shell 1.1.4 as a Tcl Module"
@$(INSTALL_DATA) $(TOP_DIR)/library/platform/shell.tcl \
"$(MODULE_INSTALL_DIR)/8.4/platform/shell-1.1.4.tm"
diff --git a/unix/configure b/unix/configure
index 86c93f4..a11adaa 100755
--- a/unix/configure
+++ b/unix/configure
@@ -6251,7 +6251,7 @@ fi
fi
;;
- Linux*|GNU*|NetBSD-Debian)
+ Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
@@ -6265,6 +6265,20 @@ fi
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+ case $system in
+ DragonFly-*|FreeBSD-*)
+ if test "${TCL_THREADS}" = "1"
+then :
+
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
+fi
+ ;;
+ esac
+
if test $doRpath = yes
then :
@@ -6396,33 +6410,6 @@ fi
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
- DragonFly-*|FreeBSD-*)
- # This configuration from FreeBSD Ports.
- SHLIB_LD="${CC} -shared"
- SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$@"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- if test $doRpath = yes
-then :
-
- CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
- LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
-fi
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- case $system in
- FreeBSD-3.*)
- # Version numbers are dot-stripped by system policy.
- TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
@@ -9406,6 +9393,7 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
+#include <stdlib.h>
int
main (void)
{
@@ -9444,6 +9432,7 @@ else $as_nop
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <time.h>
+#include <stdlib.h>
int
main (void)
{
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 9cfec6b..e2bf286 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1262,7 +1262,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
])
])
;;
- Linux*|GNU*|NetBSD-Debian)
+ Linux*|GNU*|NetBSD-Debian|DragonFly-*|FreeBSD-*)
SHLIB_CFLAGS="-fPIC -fno-common"
SHLIB_SUFFIX=".so"
@@ -1276,6 +1276,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_OBJS="tclLoadDl.o"
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+
+ case $system in
+ DragonFly-*|FreeBSD-*)
+ AS_IF([test "${TCL_THREADS}" = "1"], [
+ # The -pthread needs to go in the LDFLAGS, not LIBS
+ LIBS=`echo $LIBS | sed s/-pthread//`
+ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+ LDFLAGS="$LDFLAGS $PTHREAD_LIBS"])
+ ;;
+ esac
+
AS_IF([test $doRpath = yes], [
CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
@@ -1284,7 +1295,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_CACHE_CHECK([if compiler accepts -m64 flag], tcl_cv_cc_m64, [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -m64"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+ [tcl_cv_cc_m64=yes],[tcl_cv_cc_m64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_m64 = yes], [
CFLAGS="$CFLAGS -m64"
@@ -1356,30 +1368,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS="$CFLAGS -pthread"
LDFLAGS="$LDFLAGS -pthread"
;;
- DragonFly-*|FreeBSD-*)
- # This configuration from FreeBSD Ports.
- SHLIB_LD="${CC} -shared"
- SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]"
- SHLIB_SUFFIX=".so"
- DL_OBJS="tclLoadDl.o"
- DL_LIBS=""
- AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
- LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
- # The -pthread needs to go in the LDFLAGS, not LIBS
- LIBS=`echo $LIBS | sed s/-pthread//`
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
- case $system in
- FreeBSD-3.*)
- # Version numbers are dot-stripped by system policy.
- TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .`
- UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
- SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
- TCL_LIB_VERSIONS_OK=nodots
- ;;
- esac
- ;;
Darwin-*)
CFLAGS_OPTIMIZE="-Os"
SHLIB_CFLAGS="-fno-common"
@@ -1400,8 +1388,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [tcl_cv_cc_arch_ppc64=yes],
- [tcl_cv_cc_arch_ppc64=no])
+ [tcl_cv_cc_arch_ppc64=yes],[tcl_cv_cc_arch_ppc64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_arch_ppc64 = yes], [
CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
@@ -1413,8 +1400,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
hold_cflags=$CFLAGS
CFLAGS="$CFLAGS -arch x86_64"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [tcl_cv_cc_arch_x86_64=yes],
- [tcl_cv_cc_arch_x86_64=no])
+ [tcl_cv_cc_arch_x86_64=yes],[tcl_cv_cc_arch_x86_64=no])
CFLAGS=$hold_cflags])
AS_IF([test $tcl_cv_cc_arch_x86_64 = yes], [
CFLAGS="$CFLAGS -arch x86_64"
@@ -2164,7 +2150,8 @@ AC_DEFUN([SC_TIME_HANDLER], [
# (like convex) have timezone functions, etc.
#
AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long, [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
+#include <stdlib.h>]],
[[extern long timezone;
timezone += 1;
exit (0);]])],
@@ -2176,7 +2163,8 @@ AC_DEFUN([SC_TIME_HANDLER], [
# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
#
AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time, [
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>
+#include <stdlib.h>]],
[[extern time_t timezone;
timezone += 1;
exit (0);]])],
diff --git a/win/Makefile.in b/win/Makefile.in
index 383b9c7..ea66ec8 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -881,8 +881,8 @@ install-libraries: libraries install-tzdata install-msgs
@$(COPY) $(ROOT_DIR)/library/msgcat/msgcat.tcl "$(MODULE_INSTALL_DIR)/8.7/msgcat-1.7.1.tm";
@echo "Installing package tcltest 2.5.4 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/tcltest/tcltest.tcl "$(MODULE_INSTALL_DIR)/8.5/tcltest-2.5.4.tm";
- @echo "Installing package platform 1.0.17 as a Tcl Module";
- @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl "$(MODULE_INSTALL_DIR)/8.4/platform-1.0.17.tm";
+ @echo "Installing package platform 1.0.18 as a Tcl Module";
+ @$(COPY) $(ROOT_DIR)/library/platform/platform.tcl "$(MODULE_INSTALL_DIR)/8.4/platform-1.0.18.tm";
@echo "Installing package platform::shell 1.1.4 as a Tcl Module";
@$(COPY) $(ROOT_DIR)/library/platform/shell.tcl "$(MODULE_INSTALL_DIR)/8.4/platform/shell-1.1.4.tm";
@echo "Installing encodings";
diff --git a/win/README b/win/README
index df65d1d..8dd0574 100644
--- a/win/README
+++ b/win/README
@@ -24,7 +24,7 @@ In order to compile Tcl for Windows, you need the following:
or
- Linux + MinGW-w64 [http://mingw-w64.sourceforge.net/]
+ Linux + MinGW-w64 [https://www.mingw-w64.org/]
(win32 or win64)
or
@@ -34,12 +34,12 @@ In order to compile Tcl for Windows, you need the following:
or
- Darwin + MinGW-w64 [http://mingw-w64.sourceforge.net/]
+ Darwin + MinGW-w64 [https://www.mingw-w64.org/]
(win32 or win64)
or
- Msys + MinGW-w64 [http://mingw-w64.sourceforge.net/]
+ Msys + MinGW-w64 [https://www.mingw-w64.org/]
(win32 or win64)