diff options
-rw-r--r-- | compat/zlib/contrib/minizip/tinydir.h | 6 | ||||
-rw-r--r-- | doc/StringObj.3 | 10 | ||||
-rw-r--r-- | generic/tcl.h | 2 | ||||
-rw-r--r-- | generic/tclStringObj.c | 4 | ||||
-rw-r--r-- | tests/stringObj.test | 17 |
5 files changed, 21 insertions, 18 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 14041c5..2d41018 100644 --- a/doc/StringObj.3 +++ b/doc/StringObj.3 @@ -210,10 +210,12 @@ value's Unicode representation. If the index is out of range or it references a low surrogate preceded by a high surrogate, it returns -1; .PP \fBTcl_GetRange\fR returns a newly created value comprised of the -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. +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. If \fIfirst\fR == TCL_INDEX_NONE, then the returned +string starts at the beginning of the value. If \fIlast\fR == TCL_INDEX_NONE, +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/tcl.h b/generic/tcl.h index 1c330d8..ad54429 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -354,7 +354,7 @@ typedef unsigned TCL_WIDE_INT_TYPE Tcl_WideUInt; /* *---------------------------------------------------------------------------- * Data structures defined opaquely in this module. The definitions below just - * provide dummy types. + * provide dummy types. */ typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index c7d7d70..cf23aab 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -731,7 +731,9 @@ Tcl_GetUnicodeFromObj( * * 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 TCL_INDEX_NONE, the + * returned string start at the beginning of objPtr. If last is + * TCL_INDEX_NONE, 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 e63cbdc..263e7ef 100644 --- a/tests/stringObj.test +++ b/tests/stringObj.test @@ -495,27 +495,32 @@ test stringObj-16.5 {Tcl_GetRange: first = last = TCL_INDEX_NONE} testobj { teststringobj set 1 abcde teststringobj range 1 -1 -1 } abcde -test stringObj-16.6 {Tcl_GetRange: first = UINT_MAX-1} testobj { +test stringObj-16.6 {Tcl_GetRange: old anomaly} testobj { + # Older implementations could return "cde" + teststringobj set 1 abcde + teststringobj range 1 2 0 +} {} +test stringObj-16.7 {Tcl_GetRange: first = UINT_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 0xFFFFFFFE 3 } {} -test stringObj-16.7 {Tcl_GetRange: first = SIZE_MAX-1} testobj { +test stringObj-16.8 {Tcl_GetRange: first = SIZE_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 -2 3 } {} -test stringObj-16.8 {Tcl_GetRange: last = UINT_MAX-1} testobj { +test stringObj-16.9 {Tcl_GetRange: last = UINT_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 1 0xFFFFFFFE } bcde -test stringObj-16.9 {Tcl_GetRange: last = SIZE_MAX-1} testobj { +test stringObj-16.10 {Tcl_GetRange: last = SIZE_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 1 -2 } bcde -test stringObj-16.10 {Tcl_GetRange: first = last = UINT_MAX-1} testobj { +test stringObj-16.11 {Tcl_GetRange: first = last = UINT_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 0xFFFFFFFE 0xFFFFFFFE } {} -test stringObj-16.11 {Tcl_GetRange: first = last = SIZE_MAX-1} testobj { +test stringObj-16.12 {Tcl_GetRange: first = last = SIZE_MAX-1} testobj { teststringobj set 1 abcde teststringobj range 1 -2 -2 } {} |