summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-22 12:32:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-09-22 12:32:17 (GMT)
commite0716f3a835d64a5e2b7cc722db53e7c20e2169c (patch)
tree6e95a6ad347a4c9e0c28962d8bc1f7ae07125355
parentac4769c769196e5d84ab0a23286bec5e216f67cd (diff)
parentcccb9994ce059b965d7537c824ddd63a839f8c21 (diff)
downloadtcl-e0716f3a835d64a5e2b7cc722db53e7c20e2169c.zip
tcl-e0716f3a835d64a5e2b7cc722db53e7c20e2169c.tar.gz
tcl-e0716f3a835d64a5e2b7cc722db53e7c20e2169c.tar.bz2
Merge 8.6
-rw-r--r--compat/zlib/contrib/minizip/tinydir.h6
-rw-r--r--doc/StringObj.34
-rw-r--r--generic/tclStringObj.c4
-rw-r--r--tests/stringObj.test5
4 files changed, 11 insertions, 8 deletions
diff --git a/compat/zlib/contrib/minizip/tinydir.h b/compat/zlib/contrib/minizip/tinydir.h
index ba20c3e..b8133ac 100644
--- a/compat/zlib/contrib/minizip/tinydir.h
+++ b/compat/zlib/contrib/minizip/tinydir.h
@@ -546,12 +546,6 @@ int tinydir_readfile(const tinydir_dir *dir, tinydir_file *file)
#ifndef _MSC_VER
#ifdef __MINGW32__
if (_tstat(
-#elif (defined _BSD_SOURCE) || (defined _DEFAULT_SOURCE) \
- || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500)) \
- || ((defined _POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) \
- || ((defined __APPLE__) && (defined __MACH__)) \
- || (defined BSD)
- if (lstat(
#else
if (stat(
#endif
diff --git a/doc/StringObj.3 b/doc/StringObj.3
index 1b04dd4..6118a2d 100644
--- a/doc/StringObj.3
+++ b/doc/StringObj.3
@@ -213,7 +213,9 @@ it references a low surrogate preceded by a high surrogate, it returns -1;
characters between \fIfirst\fR and \fIlast\fR (inclusive) in the
value's Unicode representation. If the value's Unicode
representation is invalid, the Unicode representation is regenerated
-from the value's string representation.
+from the value's string representation. If \fIfirst\fR < 0, then
+the returned string starts at the beginning of the value. If \fIlast\fR < 0,
+then the returned string ends at the end of the value.
.PP
\fBTcl_GetCharLength\fR returns the number of characters (as opposed
to bytes) in the string value.
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 7ce1cdc..25bf34b 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1013,7 +1013,9 @@ TclGetUnicodeFromObj(
*
* Create a Tcl Object that contains the chars between first and last of
* the object indicated by "objPtr". If the object is not already a
- * String object, convert it to one.
+ * String object, convert it to one. If first is negative, the returned
+ * string start at the beginning of objPtr. If last is negative, the
+ * returned string ends at the end of objPtr.
*
* Results:
* Returns a new Tcl Object of the String type.
diff --git a/tests/stringObj.test b/tests/stringObj.test
index c1633bf..14ba79d 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -497,6 +497,11 @@ test stringObj-16.5 {Tcl_GetRange: fist = last = -1} {testobj deprecated} {
teststringobj set 1 abcde
teststringobj range 1 -1 -1
} abcde
+test stringObj-16.6 {Tcl_GetRange: old anomaly} testobj {
+ # Older implementations could return "cde"
+ teststringobj set 1 abcde
+ teststringobj range 1 2 0
+} {}
if {[testConstraint testobj]} {
testobj freeallvars