summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.travis.yml12
-rw-r--r--doc/ListObj.34
-rw-r--r--doc/Utf.32
-rw-r--r--generic/tclCmdMZ.c2
-rw-r--r--generic/tclDecls.h6
-rw-r--r--generic/tclEncoding.c5
-rw-r--r--generic/tclInt.h8
-rw-r--r--generic/tclLiteral.c3
-rw-r--r--generic/tclParse.c14
-rw-r--r--generic/tclStringObj.c6
-rw-r--r--generic/tclTest.c84
-rw-r--r--generic/tclUtf.c342
-rw-r--r--generic/tclUtil.c4
-rw-r--r--generic/tclZlib.c2
-rw-r--r--tests/binary.test15
-rw-r--r--tests/encoding.test10
-rw-r--r--tests/reg.test1
-rw-r--r--tests/string.test20
-rw-r--r--tests/utf.test637
-rwxr-xr-xunix/configure24
-rw-r--r--unix/tcl.m424
-rw-r--r--unix/tclUnixSock.c2
-rw-r--r--win/tclWinTime.c4
23 files changed, 921 insertions, 310 deletions
diff --git a/.travis.yml b/.travis.yml
index bf8ab15..50eb658 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -139,9 +139,9 @@ matrix:
- BUILD_DIR=unix
- CFGOPT="--enable-symbols=mem"
# Testing on Mac, various styles
- - name: "macOS/Xcode 11.3/Shared"
+ - name: "macOS/Xcode 11.4/Shared"
os: osx
- osx_image: xcode11.3
+ osx_image: xcode11.4
env:
- BUILD_DIR=macosx
install: []
@@ -149,9 +149,9 @@ matrix:
- make all
# The styles=develop avoids some weird problems on OSX
- make test styles=develop
- - name: "macOS/Xcode 11.3/Shared/Unix-like"
+ - name: "macOS/Xcode 11.4/Shared/Unix-like"
os: osx
- osx_image: xcode11.3
+ osx_image: xcode11.4
env:
- BUILD_DIR=unix
# Older MacOS versions
@@ -441,8 +441,8 @@ matrix:
before_install:
- cd ${BUILD_DIR}
install:
- - mkdir $HOME/install
- - ./configure ${CFGOPT} --prefix=$HOME/install || (cat config.log && exit 1)
+ - mkdir "$HOME/install dir"
+ - ./configure ${CFGOPT} "--prefix=$HOME/install dir" || (cat config.log && exit 1)
before_script:
- export ERROR_ON_FAILURES=1
script:
diff --git a/doc/ListObj.3 b/doc/ListObj.3
index dc1ba53..ab836d8 100644
--- a/doc/ListObj.3
+++ b/doc/ListObj.3
@@ -138,7 +138,9 @@ create a new value or modify an existing value to hold
the \fIobjc\fR elements of the array referenced by \fIobjv\fR
where each element is a pointer to a Tcl value.
If \fIobjc\fR is less than or equal to zero,
-they return an empty value.
+they return an empty value. If \fIobjv\fR is NULL, the resulting list
+contains 0 elements, with reserved space in an internal representation
+for \fIobjc\fR more elements (to avoid its reallocation later).
The new value's string representation is left invalid.
The two procedures increment the reference counts
of the elements in \fIobjc\fR since the list value now refers to them.
diff --git a/doc/Utf.3 b/doc/Utf.3
index ce8ad74..c8c6132 100644
--- a/doc/Utf.3
+++ b/doc/Utf.3
@@ -282,7 +282,7 @@ byte \fIsrc[0]\fR nor the byte \fIstart[-1]\fR nor the byte
\fIsrc[-\fBTCL_UTF_MAX\fI-1]\fR.
.PP
\fBTcl_UniCharAtIndex\fR corresponds to a C string array dereference or the
-Pascal Ord() function. It returns the Tcl_UniChar represented at the
+Pascal Ord() function. It returns the Unicode character represented at the
specified character (not byte) \fIindex\fR in the UTF-8 string
\fIsrc\fR. The source string must contain at least \fIindex\fR
characters. Behavior is undefined if a negative \fIindex\fR is given.
diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c
index 935d42f..d7394fb 100644
--- a/generic/tclCmdMZ.c
+++ b/generic/tclCmdMZ.c
@@ -2529,7 +2529,7 @@ StringStartCmd(
break;
}
- next = Tcl_UtfPrev(p, string);
+ next = TclUtfPrev(p, string);
do {
next += delta;
delta = TclUtfToUCS4(next, &ch);
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 69d98d9..99992c9 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -4184,4 +4184,10 @@ extern const TclStubs *tclStubsPtr;
#define Tcl_Close(interp, chan) Tcl_CloseEx(interp, chan, 0)
#endif
+#if defined(USE_TCL_STUBS) && (TCL_UTF_MAX > 3)
+# undef Tcl_UtfCharComplete
+# define Tcl_UtfCharComplete(src, length) (((unsigned)((unsigned char)*(src) - 0xF0) < 5) \
+ ? 4 : tclStubsPtr->tcl_UtfCharComplete((src), (length)))
+#endif
+
#endif /* _TCLDECLS */
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 2e4c3f7..4789b7f 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2557,11 +2557,6 @@ UtfToUtf16Proc(
}
src += TclUtfToUniChar(src, chPtr);
- /*
- * Need to handle this in a way that won't cause misalignment by
- * casting dst to a Tcl_UniChar. [Bug 1122671]
- */
-
if (clientData) {
#if TCL_UTF_MAX > 3
if (*chPtr <= 0xFFFF) {
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 8d2e68a..2ff644e 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4689,6 +4689,14 @@ MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[];
(numChars) = _count; \
} while (0);
+#define TclUtfPrev(src, start) \
+ (((src) < (start) + 2) ? (start) : \
+ ((unsigned char) *((src) - 1)) < 0x80 ? (src) - 1 : \
+ Tcl_UtfPrev(src, start))
+
+#define TclUtfNext(src) \
+ ((((unsigned char) *(src)) < 0x80) ? (src) + 1 : Tcl_UtfNext(src))
+
/*
*----------------------------------------------------------------
* Macro that encapsulates the logic that determines when it is safe to
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index eb76884..22eff3c 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -994,7 +994,8 @@ RebuildLiteralTable(
}
tablePtr->numBuckets *= 4;
- tablePtr->buckets = (LiteralEntry **)ckalloc(tablePtr->numBuckets * sizeof(LiteralEntry*));
+ tablePtr->buckets = (LiteralEntry **)ckalloc(
+ tablePtr->numBuckets * sizeof(LiteralEntry*));
for (count=tablePtr->numBuckets, newChainPtr=tablePtr->buckets;
count>0 ; count--, newChainPtr++) {
*newChainPtr = NULL;
diff --git a/generic/tclParse.c b/generic/tclParse.c
index adc559d..e95768d 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -128,6 +128,8 @@ static int ParseWhiteSpace(const char *src, int numBytes,
int *incompletePtr, char *typePtr);
static int ParseAllWhiteSpace(const char *src, int numBytes,
int *incompletePtr);
+static int ParseHex(const char *src, int numBytes,
+ int *resultPtr);
/*
*----------------------------------------------------------------------
@@ -701,7 +703,7 @@ TclParseAllWhiteSpace(
/*
*----------------------------------------------------------------------
*
- * TclParseHex --
+ * ParseHex --
*
* Scans a hexadecimal number as a Tcl_UniChar value (e.g., for parsing
* \x and \u escape sequences). At most numBytes bytes are scanned.
@@ -721,7 +723,7 @@ TclParseAllWhiteSpace(
*/
int
-TclParseHex(
+ParseHex(
const char *src, /* First character to parse. */
int numBytes, /* Max number of byes to scan */
int *resultPtr) /* Points to storage provided by caller where
@@ -845,7 +847,7 @@ TclParseBackslash(
result = 0xB;
break;
case 'x':
- count += TclParseHex(p+1, (numBytes > 3) ? 2 : numBytes-2, &result);
+ count += ParseHex(p+1, (numBytes > 3) ? 2 : numBytes-2, &result);
if (count == 2) {
/*
* No hexdigits -> This is just "x".
@@ -860,7 +862,7 @@ TclParseBackslash(
}
break;
case 'u':
- count += TclParseHex(p+1, (numBytes > 5) ? 4 : numBytes-2, &result);
+ count += ParseHex(p+1, (numBytes > 5) ? 4 : numBytes-2, &result);
if (count == 2) {
/*
* No hexdigits -> This is just "u".
@@ -871,7 +873,7 @@ TclParseBackslash(
/* If high surrogate is immediately followed by a low surrogate
* escape, combine them into one character. */
int low;
- int count2 = TclParseHex(p+7, 4, &low);
+ int count2 = ParseHex(p+7, 4, &low);
if ((count2 == 4) && ((low & 0xDC00) == 0xDC00)) {
result = ((result & 0x3FF)<<10 | (low & 0x3FF)) + 0x10000;
count += count2 + 2;
@@ -879,7 +881,7 @@ TclParseBackslash(
}
break;
case 'U':
- count += TclParseHex(p+1, (numBytes > 9) ? 8 : numBytes-2, &result);
+ count += ParseHex(p+1, (numBytes > 9) ? 8 : numBytes-2, &result);
if (count == 2) {
/*
* No hexdigits -> This is just "U".
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 2025674..78e49f9 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1171,10 +1171,10 @@ Tcl_AppendLimitedToObj(
}
eLen = strlen(ellipsis);
while (eLen > limit) {
- eLen = Tcl_UtfPrev(ellipsis+eLen, ellipsis) - ellipsis;
+ eLen = TclUtfPrev(ellipsis+eLen, ellipsis) - ellipsis;
}
- toCopy = Tcl_UtfPrev(bytes+limit+1-eLen, bytes) - bytes;
+ toCopy = TclUtfPrev(bytes+limit+1-eLen, bytes) - bytes;
}
/*
@@ -2614,7 +2614,7 @@ AppendPrintfToObjVA(
* multi-byte characters.
*/
- q = Tcl_UtfPrev(end, bytes);
+ q = TclUtfPrev(end, bytes);
if (!Tcl_UtfCharComplete(q, (int)(end - q))) {
end = q;
}
diff --git a/generic/tclTest.c b/generic/tclTest.c
index 2261a02..499ef93 100644
--- a/generic/tclTest.c
+++ b/generic/tclTest.c
@@ -316,6 +316,7 @@ static Tcl_FSListVolumesProc SimpleListVolumes;
static Tcl_FSPathInFilesystemProc SimplePathInFilesystem;
static Tcl_Obj * SimpleRedirect(Tcl_Obj *pathPtr);
static Tcl_FSMatchInDirectoryProc SimpleMatchInDirectory;
+static Tcl_ObjCmdProc TestUtfNextCmd;
static Tcl_ObjCmdProc TestUtfPrevCmd;
static Tcl_ObjCmdProc TestNumUtfCharsCmd;
static Tcl_ObjCmdProc TestFindFirstCmd;
@@ -578,8 +579,10 @@ Tcltest_Init(
NULL, NULL);
Tcl_CreateObjCommand(interp, "testsetobjerrorcode",
TestsetobjerrorcodeCmd, NULL, NULL);
+ Tcl_CreateObjCommand(interp, "testutfnext",
+ TestUtfNextCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testutfprev",
- TestUtfPrevCmd, (ClientData) 0, NULL);
+ TestUtfPrevCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testnumutfchars",
TestNumUtfCharsCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "testfindfirst",
@@ -1515,7 +1518,7 @@ TestdelCmd(
return TCL_ERROR;
}
- dPtr = (DelCmd*)ckalloc(sizeof(DelCmd));
+ dPtr = (DelCmd *)ckalloc(sizeof(DelCmd));
dPtr->interp = interp;
dPtr->deleteCmd = (char *)ckalloc(strlen(argv[3]) + 1);
strcpy(dPtr->deleteCmd, argv[3]);
@@ -1544,7 +1547,7 @@ static void
DelDeleteProc(
void *clientData) /* String command to evaluate. */
{
- DelCmd *dPtr = (DelCmd *) clientData;
+ DelCmd *dPtr = (DelCmd *)clientData;
Tcl_EvalEx(dPtr->interp, dPtr->deleteCmd, -1, 0);
Tcl_ResetResult(dPtr->interp);
@@ -6380,11 +6383,6 @@ TestReport(
if (interp == NULL) {
/* This is bad, but not much we can do about it */
} else {
- /*
- * No idea why I decided to program this up using the old string-based
- * API, but there you go. We should convert it to objects.
- */
-
Tcl_Obj *savedResult;
Tcl_DString ds;
@@ -6811,6 +6809,61 @@ SimpleListVolumes(void)
}
/*
+ * Used to check operations of Tcl_UtfNext.
+ *
+ * Usage: testutfnext -bytestring $bytes
+ */
+
+static int
+TestUtfNextCmd(
+ TCL_UNUSED(void *),
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *const objv[])
+{
+ int numBytes;
+ char *bytes;
+ const char *result, *first;
+ char buffer[32];
+ static const char tobetested[] = "\xFF\xFE\xF4\xF2\xF0\xEF\xE8\xE3\xE2\xE1\xE0\xC2\xC1\xC0\x82";
+ const char *p = tobetested;
+
+ if (objc != 3 || strcmp(Tcl_GetString(objv[1]), "-bytestring")) {
+ if (objc != 2) {
+ Tcl_WrongNumArgs(interp, 1, objv, "?-bytestring? bytes");
+ return TCL_ERROR;
+ }
+ bytes = Tcl_GetStringFromObj(objv[1], &numBytes);
+ } else {
+ bytes = (char *) Tcl_GetBytesFromObj(interp, objv[2], &numBytes);
+ if (bytes == NULL) {
+ return TCL_ERROR;
+ }
+ }
+
+ if (numBytes > (int)sizeof(buffer)-2) {
+ Tcl_AppendResult(interp, "\"testutfnext\" can only handle 30 bytes", NULL);
+ return TCL_ERROR;
+ }
+
+ memcpy(buffer + 1, bytes, numBytes);
+ buffer[0] = buffer[numBytes + 1] = '\x00';
+
+ first = result = TclUtfNext(buffer + 1);
+ while ((buffer[0] = *p++) != '\0') {
+ /* Run Tcl_UtfNext with many more possible bytes at src[-1], all should give the same result */
+ result = TclUtfNext(buffer + 1);
+ if (first != result) {
+ Tcl_AppendResult(interp, "Tcl_UtfNext is not supposed to read src[-1]", NULL);
+ return TCL_ERROR;
+ }
+ }
+
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(first - buffer - 1));
+
+ return TCL_OK;
+}
+/*
* Used to check operations of Tcl_UtfPrev.
*
* Usage: testutfprev $bytes $offset
@@ -6827,16 +6880,19 @@ TestUtfPrevCmd(
char *bytes;
const char *result;
Tcl_Obj *copy;
-
+
if (objc < 2 || objc > 3) {
Tcl_WrongNumArgs(interp, 1, objv, "bytes ?offset?");
return TCL_ERROR;
}
- bytes = (char *) Tcl_GetByteArrayFromObj(objv[1], &numBytes);
-
+ bytes = (char *) Tcl_GetBytesFromObj(interp, objv[1], &numBytes);
+ if (bytes == NULL) {
+ return TCL_ERROR;
+ }
+
if (objc == 3) {
- if (TCL_OK != Tcl_GetIntFromObj(interp, objv[2], &offset)) {
+ if (TCL_OK != Tcl_GetIntForIndex(interp, objv[2], numBytes, &offset)) {
return TCL_ERROR;
}
if (offset < 0) {
@@ -6852,10 +6908,10 @@ TestUtfPrevCmd(
bytes = (char *) Tcl_SetByteArrayLength(copy, numBytes+1);
bytes[numBytes] = '\0';
- result = Tcl_UtfPrev(bytes + offset, bytes);
+ result = TclUtfPrev(bytes + offset, bytes);
+ Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes));
Tcl_DecrRefCount(copy);
- Tcl_SetObjResult(interp, Tcl_NewIntObj(result - bytes));
return TCL_OK;
}
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 5908f36..19e1365 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -64,12 +64,14 @@ static const unsigned char totalBytes[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+/* Tcl_UtfCharComplete() might point to 2nd byte of valid 4-byte sequence */
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+/* End of "continuation byte section" */
+ 2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
};
-
+
static const unsigned char complete[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@@ -79,9 +81,26 @@ static const unsigned char complete[256] = {
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
/* End of "continuation byte section" */
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
- 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,1,1,1,1,1,1,1,1,1,1,1
+ 2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
+#if TCL_UTF_MAX > 3
+ 4,4,4,4,4,
+#else
+ 1,1,1,1,1,
+#endif
+ 1,1,1,1,1,1,1,1,1,1,1
};
+
+/*
+ * Functions used only in this module.
+ */
+
+static int Invalid(unsigned char *src);
+
+#define UCS4ToUpper Tcl_UniCharToUpper
+#define UCS4ToLower Tcl_UniCharToLower
+#define UCS4ToTitle Tcl_UniCharToTitle
+
/*
*---------------------------------------------------------------------------
@@ -114,7 +133,56 @@ TclUtfCount(
}
return 3;
}
+
+/*
+ *---------------------------------------------------------------------------
+ *
+ * Invalid --
+ *
+ * Utility routine to report whether /src/ points to the start of an
+ * invald byte sequence that should be rejected. This might be because
+ * it is an overlong encoding, or because it encodes something out of
+ * the proper range. Caller guarantees that src[0] and src[1] are
+ * readable, and
+ *
+ * (src[0] >= 0xC0) && (src[0] != 0xC1)
+ * (src[1] >= 0x80) && (src[1] < 0xC0)
+ * (src[0] < ((TCL_UTF_MAX > 3) ? 0xF5 : 0xF0))
+ *
+ * Results:
+ * A boolean.
+ *---------------------------------------------------------------------------
+ */
+static const unsigned char bounds[28] = {
+ 0x80, 0x80, /* \xC0 accepts \x80 only */
+ 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF,
+ 0x80, 0xBF, /* (\xC4 - \xDC) -- all sequences valid */
+ 0xA0, 0xBF, /* \xE0\x80 through \xE0\x9F are invalid prefixes */
+ 0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, /* (\xE4 - \xEC) -- all valid */
+ 0x90, 0xBF, /* \xF0\x80 through \xF0\x8F are invalid prefixes */
+ 0x80, 0x8F /* \xF4\x90 and higher are invalid prefixes */
+};
+
+static int
+Invalid(
+ unsigned char *src) /* Points to lead byte of a UTF-8 byte sequence */
+{
+ unsigned char byte = *src;
+ int index;
+
+ if (byte % 0x04) {
+ /* Only lead bytes 0xC0, 0xE0, 0xF0, 0xF4 need examination */
+ return 0;
+ }
+ index = (byte - 0xC0) >> 1;
+ if (src[1] < bounds[index] || src[1] > bounds[index+1]) {
+ /* Out of bounds - report invalid. */
+ return 1;
+ }
+ return 0;
+}
+
/*
*---------------------------------------------------------------------------
*
@@ -555,7 +623,7 @@ Tcl_UtfToChar16(
*chPtr = byte;
return 1;
}
-
+
/*
*---------------------------------------------------------------------------
*
@@ -852,9 +920,11 @@ Tcl_UtfFindLast(
*
* Tcl_UtfNext --
*
- * Given a pointer to some current location in a UTF-8 string, move
- * forward one character. The caller must ensure that they are not asking
- * for the next character after the last character in the string.
+ * Given a pointer to some location in a UTF-8 string, Tcl_UtfNext
+ * returns a pointer to the next UTF-8 character in the string.
+ * The caller must not ask for the next character after the last
+ * character in the string if the string is not terminated by a null
+ * character.
*
* Results:
* The return value is the pointer to the next character in the UTF-8
@@ -870,15 +940,31 @@ const char *
Tcl_UtfNext(
const char *src) /* The current location in the string. */
{
- Tcl_UniChar ch = 0;
- int len = TclUtfToUniChar(src, &ch);
+ int left = totalBytes[UCHAR(*src)];
+ const char *next = src + 1;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- len += TclUtfToUniChar(src + len, &ch);
+ if (((*src) & 0xC0) == 0x80) {
+ if ((((*++src) & 0xC0) == 0x80) && (((*++src) & 0xC0) == 0x80)) {
+ ++src;
+ }
+ return src;
}
-#endif
- return src + len;
+
+ while (--left) {
+ if ((*next & 0xC0) != 0x80) {
+ /*
+ * src points to non-trail byte; We ran out of trail bytes
+ * before the needs of the lead byte were satisfied.
+ * Let the (malformed) lead byte alone be a character
+ */
+ return src + 1;
+ }
+ next++;
+ }
+ if ((next == src + 1) || Invalid((unsigned char *)src)) {
+ return src + 1;
+ }
+ return next;
}
/*
@@ -886,43 +972,15 @@ Tcl_UtfNext(
*
* Tcl_UtfPrev --
*
- * The aim of this routine is to provide a way to move backward
- * through a UTF-8 string. The caller is expected to pass non-NULL
- * pointer arguments start and src. start points to the beginning
- * of a string, and src >= start points to a location within (or just
- * past the end) of the string. This routine always returns a
- * pointer within the string (>= start). When (src == start), it
- * returns start. When (src > start), it returns a pointer (< src)
- * and (>= src - TCL_UTF_MAX). Subject to these constraints, the
- * routine returns a pointer to the earliest byte in the string that
- * starts a character when characters are read starting at start and
- * that character might include the byte src[-1]. The routine will
- * examine only those bytes in the range that might be returned.
- * It will not examine the byte *src, and because of that cannot
- * determine for certain in all circumstances whether the character
- * that begins with the returned pointer will or will not include
- * the byte src[-1]. In the scenario, where src points to the end of
- * a buffer being filled, the returned pointer point to either the
- * final complete character in the string or to the earliest byte
- * that might start an incomplete character waiting for more bytes to
- * complete.
- *
- * Because this routine always returns a value < src until the point
- * it is forced to return start, it is useful as a backward iterator
- * through a string that will always make progress and always be
- * prevented from running past the beginning of the string.
- *
- * In a string where all characters are complete and properly formed,
- * and the value of src points to the first byte of a character,
- * repeated Tcl_UtfPrev calls will step to the starting bytes of
- * characters, one character at a time. Within those limitations,
- * Tcl_UtfPrev and Tcl_UtfNext are inverses. If either condition cannot
- * be met, Tcl_UtfPrev and Tcl_UtfNext may not function as inverses and
- * the caller will have to take greater care.
+ * Given a pointer to some current location in a UTF-8 string, move
+ * backwards one character. This works correctly when the pointer is in
+ * the middle of a UTF-8 character.
*
* Results:
- * A pointer to the start of a character in the string as described
- * above.
+ * The return value is a pointer to the previous character in the UTF-8
+ * string. If the current location was already at the beginning of the
+ * string, the return value will also be a pointer to the beginning of
+ * the string.
*
* Side effects:
* None.
@@ -935,30 +993,92 @@ Tcl_UtfPrev(
const char *src, /* A location in a UTF-8 string. */
const char *start) /* Pointer to the beginning of the string */
{
- const char *look;
- int i, byte;
-
- look = --src;
- for (i = 0; i < 4; i++) {
- if (look < start) {
- if (src < start) {
- src = start;
- }
- break;
- }
- byte = *((unsigned char *) look);
+ int trailBytesSeen = 0; /* How many trail bytes have been verified? */
+ const char *fallback = src - 1;
+ /* If we cannot find a lead byte that might
+ * start a prefix of a valid UTF byte sequence,
+ * we will fallback to a one-byte back step */
+ unsigned char *look = (unsigned char *)fallback;
+ /* Start search at the fallback position */
+
+ /* Quick boundary case exit. */
+ if (fallback <= start) {
+ return start;
+ }
+
+ do {
+ unsigned char byte = look[0];
+
if (byte < 0x80) {
- break;
+ /*
+ * Single byte character. Either this is a correct previous
+ * character, or it is followed by at least one trail byte
+ * which indicates a malformed sequence. In either case the
+ * correct result is to return the fallback.
+ */
+ return fallback;
}
if (byte >= 0xC0) {
- if (totalBytes[byte] <= i) {
- break;
+ /* Non-trail byte; May be multibyte lead. */
+
+ if ((trailBytesSeen == 0)
+ /*
+ * We've seen no trailing context to use to check
+ * anything. From what we know, this non-trail byte
+ * is a prefix of a previous character, and accepting
+ * it (the fallback) is correct.
+ */
+
+ || (trailBytesSeen >= totalBytes[byte])) {
+ /*
+ * That is, (1 + trailBytesSeen > needed).
+ * We've examined more bytes than needed to complete
+ * this lead byte. No matter about well-formedness or
+ * validity, the sequence starting with this lead byte
+ * will never include the fallback location, so we must
+ * return the fallback location. See test utf-7.17
+ */
+ return fallback;
+ }
+
+ /*
+ * trailBytesSeen > 0, so we can examine look[1] safely.
+ * Use that capability to screen out overlong sequences.
+ */
+
+ if (Invalid(look)) {
+ /* Reject */
+ return fallback;
}
- return look;
+ return (const char *)look;
}
+
+ /* We saw a trail byte. */
+ trailBytesSeen++;
+
+ if ((const char *)look == start) {
+ /*
+ * Do not read before the start of the string
+ *
+ * If we get here, we've examined bytes at every location
+ * >= start and < src and all of them are trail bytes,
+ * including (*start). We need to return our fallback
+ * and exit this loop before we run past the start of the string.
+ */
+ return fallback;
+ }
+
+ /* Continue the search backwards... */
look--;
- }
- return src;
+ } while (trailBytesSeen < 4);
+
+ /*
+ * We've seen TCL_UTF_MAX trail bytes, so we know there will not be a
+ * properly formed byte sequence to find, and we can stop looking,
+ * accepting the fallback (for TCL_UTF_MAX > 3) or just go back as
+ * far as we can.
+ */
+ return fallback;
}
/*
@@ -966,7 +1086,7 @@ Tcl_UtfPrev(
*
* Tcl_UniCharAtIndex --
*
- * Returns the Tcl_UniChar represented at the specified character
+ * Returns the Unicode character represented at the specified character
* (not byte) position in the UTF-8 string.
*
* Results:
@@ -983,28 +1103,10 @@ Tcl_UniCharAtIndex(
const char *src, /* The UTF-8 string to dereference. */
int index) /* The position of the desired character. */
{
- Tcl_UniChar ch = 0;
- int fullchar = 0;
-#if TCL_UTF_MAX <= 3
- int len = 0;
-#endif
+ int ch = 0;
- while (index-- >= 0) {
-#if TCL_UTF_MAX <= 3
- src += (len = TclUtfToUniChar(src, &ch));
-#else
- src += TclUtfToUniChar(src, &ch);
-#endif
- }
- fullchar = ch;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- /* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
- (void)TclUtfToUniChar(src, &ch);
- fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
- return fullchar;
+ TclUtfToUCS4(Tcl_UtfAtIndex(src, index), &ch);
+ return ch;
}
/*
@@ -1122,8 +1224,7 @@ int
Tcl_UtfToUpper(
char *str) /* String to convert in place. */
{
- Tcl_UniChar ch = 0;
- int upChar;
+ int ch, upChar;
char *src, *dst;
int len;
@@ -1133,16 +1234,8 @@ Tcl_UtfToUpper(
src = dst = str;
while (*src) {
- len = TclUtfToUniChar(src, &ch);
- upChar = ch;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- len += TclUtfToUniChar(src + len, &ch);
- /* Combine surrogates */
- upChar = (((upChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
- upChar = Tcl_UniCharToUpper(upChar);
+ len = TclUtfToUCS4(src, &ch);
+ upChar = UCS4ToUpper(ch);
/*
* To keep badly formed Utf strings from getting inflated by the
@@ -1184,8 +1277,7 @@ int
Tcl_UtfToLower(
char *str) /* String to convert in place. */
{
- Tcl_UniChar ch = 0;
- int lowChar;
+ int ch, lowChar;
char *src, *dst;
int len;
@@ -1195,16 +1287,8 @@ Tcl_UtfToLower(
src = dst = str;
while (*src) {
- len = TclUtfToUniChar(src, &ch);
- lowChar = ch;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- len += TclUtfToUniChar(src + len, &ch);
- /* Combine surrogates */
- lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
- lowChar = Tcl_UniCharToLower(lowChar);
+ len = TclUtfToUCS4(src, &ch);
+ lowChar = UCS4ToLower(ch);
/*
* To keep badly formed Utf strings from getting inflated by the
@@ -1247,8 +1331,7 @@ int
Tcl_UtfToTitle(
char *str) /* String to convert in place. */
{
- Tcl_UniChar ch = 0;
- int titleChar, lowChar;
+ int ch, titleChar, lowChar;
char *src, *dst;
int len;
@@ -1260,16 +1343,8 @@ Tcl_UtfToTitle(
src = dst = str;
if (*src) {
- len = TclUtfToUniChar(src, &ch);
- titleChar = ch;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- len += TclUtfToUniChar(src + len, &ch);
- /* Combine surrogates */
- titleChar = (((titleChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
- titleChar = Tcl_UniCharToTitle(titleChar);
+ len = TclUtfToUCS4(src, &ch);
+ titleChar = UCS4ToTitle(ch);
if ((len < TclUtfCount(titleChar)) || ((titleChar & 0xF800) == 0xD800)) {
memmove(dst, src, len);
@@ -1280,18 +1355,11 @@ Tcl_UtfToTitle(
src += len;
}
while (*src) {
- len = TclUtfToUniChar(src, &ch);
+ len = TclUtfToUCS4(src, &ch);
lowChar = ch;
-#if TCL_UTF_MAX <= 3
- if ((ch >= 0xD800) && (len < 3)) {
- len += TclUtfToUniChar(src + len, &ch);
- /* Combine surrogates */
- lowChar = (((lowChar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000;
- }
-#endif
/* Special exception for Georgian Asomtavruli chars, no titlecase. */
if ((unsigned)(lowChar - 0x1C90) >= 0x30) {
- lowChar = Tcl_UniCharToLower(lowChar);
+ lowChar = UCS4ToLower(lowChar);
}
if ((len < TclUtfCount(lowChar)) || ((lowChar & 0xF800) == 0xD800)) {
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index b48ce30..dd527dc 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -1707,7 +1707,7 @@ TclTrimRight(
const char *q = trim;
int pInc = 0, bytesLeft = numTrim;
- pp = Tcl_UtfPrev(p, bytes);
+ pp = TclUtfPrev(p, bytes);
do {
pp += pInc;
pInc = TclUtfToUCS4(pp, &ch1);
@@ -1858,7 +1858,7 @@ TclTrim(
* that we will not trim. Skip over it. */
if (numBytes > 0) {
const char *first = bytes + trimLeft;
- bytes = Tcl_UtfNext(first);
+ bytes = TclUtfNext(first);
numBytes -= (bytes - first);
if (numBytes > 0) {
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 7084721..7f8d007 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -3884,7 +3884,7 @@ ResultGenerate(
if (((flush == Z_SYNC_FLUSH) && (e == Z_BUF_ERROR))
|| (e == Z_STREAM_END)
- || (e == Z_OK && cd->inStream.avail_out == 0)) {
+ || (e == Z_OK && written == 0)) {
return TCL_OK;
}
diff --git a/tests/binary.test b/tests/binary.test
index a777b2a..b06afe0 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -16,6 +16,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
}
testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}]
testConstraint littleEndian [expr {$tcl_platform(byteOrder) eq "littleEndian"}]
+testConstraint testbytestring [llength [info commands testbytestring]]
# Big test for correct ordering of data in [expr]
proc testIEEE {} {
@@ -2941,7 +2942,19 @@ test binary-79.2 {Tcl_SetByteArrayLength} testsetbytearraylength {
testsetbytearraylength [string cat \u0141 B C] 1
} A
-
+test binary-80.1 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
+ testbytestring "\u4E4E"
+} -result "expected byte sequence but character 0 was '\u4E4E' (U+004E4E)"
+test binary-80.2 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
+ testbytestring [testbytestring "\x00\xA0\xA0\xA0\xE4\xB9\x8E"]
+} -result "expected byte sequence but character 4 was '\u4E4E' (U+004E4E)"
+test binary-80.3 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
+ testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xE4\xB9\x8E"]
+} -result "expected byte sequence but character 4 was '\u4E4E' (U+004E4E)"
+test binary-80.4 {TclGetBytesFromObj} -constraints testbytestring -returnCodes 1 -body {
+ testbytestring [testbytestring "\xC0\x80\xA0\xA0\xA0\xF0\x9F\x98\x81"]
+} -result "expected byte sequence but character 4 was '\U01F601' (U+01F601)"
+
# ----------------------------------------------------------------------
# cleanup
diff --git a/tests/encoding.test b/tests/encoding.test
index 664a041..ccc32da 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -283,16 +283,16 @@ test encoding-11.6 {LoadEncodingFile: invalid file} -constraints {testencoding}
# OpenEncodingFile is fully tested by the rest of the tests in this file.
test encoding-12.1 {LoadTableEncoding: normal encoding} {
- set x [encoding convertto iso8859-3 \u120]
- append x [encoding convertto iso8859-3 \ud5]
- append x [encoding convertfrom iso8859-3 \xd5]
+ set x [encoding convertto iso8859-3 \u0120]
+ append x [encoding convertto iso8859-3 \xD5]
+ append x [encoding convertfrom iso8859-3 \xD5]
} "\xd5?\u120"
test encoding-12.2 {LoadTableEncoding: single-byte encoding} {
set x [encoding convertto iso8859-3 ab\u0120g]
- append x [encoding convertfrom iso8859-3 ab\xd5g]
+ append x [encoding convertfrom iso8859-3 ab\xD5g]
} "ab\xd5gab\u120g"
test encoding-12.3 {LoadTableEncoding: multi-byte encoding} {
- set x [encoding convertto shiftjis ab\u4e4eg]
+ set x [encoding convertto shiftjis ab\u4E4Eg]
append x [encoding convertfrom shiftjis ab\x8c\xc1g]
} "ab\x8c\xc1gab\u4e4eg"
test encoding-12.4 {LoadTableEncoding: double-byte encoding} {
diff --git a/tests/reg.test b/tests/reg.test
index b9dc538..dabd3bc 100644
--- a/tests/reg.test
+++ b/tests/reg.test
@@ -626,6 +626,7 @@ expectMatch 13.14 P "a\\rb" "a\rb" "a\rb"
expectMatch 13.15 P "a\\tb" "a\tb" "a\tb"
expectMatch 13.16 P "a\\u0008x" "a\bx" "a\bx"
expectMatch 13.17 P {a\u008x} "a\bx" "a\bx"
+expectError 13.17.1 - {a\ux} EESCAPE
expectMatch 13.18 P "a\\u00088x" "a\b8x" "a\b8x"
expectMatch 13.19 P "a\\U00000008x" "a\bx" "a\bx"
expectMatch 13.20 P {a\U0000008x} "a\bx" "a\bx"
diff --git a/tests/string.test b/tests/string.test
index 223251e..98890f9 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -1814,11 +1814,11 @@ test string-20.5.$noComp {string trimright} {
test string-20.6.$noComp {string trimright, unicode default} {
run {string trimright ABC\u1361\x85\x00\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u2028\u2029\u202F\u205F\u3000}
} ABC\u1361
-test string-20.7.$noComp {string trim on not valid utf-8 sequence (consider NTS as continuation char), bug [c61818e4c9]} {testbytestring knownBug} {
+test string-20.7.$noComp {string trim on not valid utf-8 sequence (consider NTS as continuation char), bug [c61818e4c9]} {testbytestring} {
set result {}
- set a [testbytestring \xC0\x80\x88]
+ set a [testbytestring \xC0\x80\xA0]
set b foo$a
- set m [list \x00 U \x88 V [testbytestring \x88] W]
+ set m [list \x00 U \xA0 V [testbytestring \xA0] W]
lappend result [string map $m $b]
lappend result [string map $m [run {string trimright $b x}]]
lappend result [string map $m [run {string trimright $b \x00}]]
@@ -1827,19 +1827,19 @@ test string-20.7.$noComp {string trim on not valid utf-8 sequence (consider NTS
lappend result [string map $m [run {string trim $b fox}]]
lappend result [string map $m [run {string trim $b fo\x00}]]
} [list {*}[lrepeat 3 fooUV] {*}[lrepeat 2 UV V]]
-test string-20.8 {[c61818e4c9] [string trimright] fails when UtfPrev is ok} {testbytestring knownBug} {
+test string-20.8.$noComp {[c61818e4c9] [string trimright] fails when UtfPrev is ok} {testbytestring} {
set result {}
- set a [testbytestring \xE8\x80]
+ set a [testbytestring \xE8\xA0]
set b foo$a
- set m [list \xE8 U \x80 V [testbytestring \xE8] W [testbytestring \x80] X]]
+ set m [list \xE8 U \xA0 V [testbytestring \xE8] W [testbytestring \xA0] X]]
lappend result [string map $m $b]
lappend result [string map $m [run {string trimright $b x}]]
lappend result [string map $m [run {string trimright $b \xE8}]]
lappend result [string map $m [run {string trimright $b [testbytestring \xE8]}]]
- lappend result [string map $m [run {string trimright $b \x80}]]
- lappend result [string map $m [run {string trimright $b [testbytestring \x80]}]]
- lappend result [string map $m [run {string trimright $b \xE8\x80}]]
- lappend result [string map $m [run {string trimright $b [testbytestring \xE8\x80]}]]
+ lappend result [string map $m [run {string trimright $b \xA0}]]
+ lappend result [string map $m [run {string trimright $b [testbytestring \xA0]}]]
+ lappend result [string map $m [run {string trimright $b \xE8\xA0}]]
+ lappend result [string map $m [run {string trimright $b [testbytestring \xE8\xA0]}]]
lappend result [string map $m [run {string trimright $b \u0000}]]
} [list {*}[lrepeat 4 fooUV] {*}[lrepeat 2 fooU] {*}[lrepeat 2 foo] fooUV]
diff --git a/tests/utf.test b/tests/utf.test
index 9744703..35d7855 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -13,15 +13,32 @@ if {[lsearch [namespace children] ::tcltest] == -1} {
namespace import -force ::tcltest::*
}
+namespace path ::tcl::mathop
+
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
+testConstraint ucs2 [expr {[format %c 0x010000] eq "\uFFFD"}]
+testConstraint fullutf [expr {[format %c 0x010000] ne "\uFFFD"}]
+testConstraint tip389 [expr {[string length [format %c 0x10000]] eq 2}]
+testConstraint ucs4 [expr {[testConstraint fullutf]
+ && [string length [format %c 0x10000]] == 1}]
+
+testConstraint Uesc [eq \U0041 A]
+testConstraint pairsTo4bytes [expr {[llength [info commands teststringbytes]]
+ && [string length [teststringbytes \uD83D\uDCA9]] == 4}]
+
testConstraint testbytestring [llength [info commands testbytestring]]
+testConstraint testfindfirst [llength [info commands testfindfirst]]
+testConstraint testfindlast [llength [info commands testfindlast]]
+testConstraint testnumutfchars [llength [info commands testnumutfchars]]
+testConstraint teststringobj [llength [info commands teststringobj]]
+testConstraint testutfnext [llength [info commands testutfnext]]
+testConstraint testutfprev [llength [info commands testutfprev]]
-catch {unset x}
+testConstraint tip413 [eq {} [string trim \x00]]
-# Some tests require support for 4-byte UTF-8 sequences
-testConstraint tip389 [expr {[string length \U010000] == 2}]
+catch {unset x}
test utf-1.1 {Tcl_UniCharToUtf: 1 byte sequences} testbytestring {
expr {"\x01" eq [testbytestring "\x01"]}
@@ -41,9 +58,12 @@ test utf-1.5 {Tcl_UniCharToUtf: overflowed Tcl_UniChar} testbytestring {
test utf-1.6 {Tcl_UniCharToUtf: negative Tcl_UniChar} testbytestring {
expr {[format %c -1] eq [testbytestring "\xEF\xBF\xBD"]}
} 1
-test utf-1.7 {Tcl_UniCharToUtf: 4 byte sequences} -constraints testbytestring -body {
+test utf-1.7.0 {Tcl_UniCharToUtf: 4 byte sequences} {fullutf Uesc testbytestring} {
expr {"\U014E4E" eq [testbytestring "\xF0\x94\xB9\x8E"]}
-} -result 1
+} 1
+test utf-1.7.1 {Tcl_UniCharToUtf: 4 byte sequences} {ucs2 Uesc testbytestring} {
+ expr {"\U014E4E" eq [testbytestring "\xF0\x94\xB9\x8E"]}
+} 0
test utf-1.8 {Tcl_UniCharToUtf: 3 byte sequence, high surrogate} testbytestring {
expr {"\uD842" eq [testbytestring "\xED\xA1\x82"]}
} 1
@@ -56,106 +76,398 @@ test utf-1.10 {Tcl_UniCharToUtf: 3 byte sequence, high surrogate} testbytestring
test utf-1.11 {Tcl_UniCharToUtf: 3 byte sequence, low surrogate} testbytestring {
expr {[format %c 0xDC42] eq [testbytestring "\xED\xB1\x82"]}
} 1
-test utf-1.12 {Tcl_UniCharToUtf: 4 byte sequence, high/low surrogate} testbytestring {
+test utf-1.12 {Tcl_UniCharToUtf: 4 byte sequence, high/low surrogate} {pairsTo4bytes testbytestring} {
expr {"\uD842\uDC42" eq [testbytestring "\xF0\xA0\xA1\x82"]}
} 1
-test utf-1.13 {Tcl_UniCharToUtf: Invalid surrogate} testbytestring {
+test utf-1.13 {Tcl_UniCharToUtf: Invalid surrogate} {Uesc testbytestring} {
expr {"\UD842" eq [testbytestring "\xEF\xBF\xBD"]}
} 1
test utf-2.1 {Tcl_UtfToUniChar: low ascii} {
string length "abc"
-} {3}
+} 3
test utf-2.2 {Tcl_UtfToUniChar: naked trail bytes} testbytestring {
string length [testbytestring "\x82\x83\x84"]
-} {3}
+} 3
test utf-2.3 {Tcl_UtfToUniChar: lead (2-byte) followed by non-trail} testbytestring {
string length [testbytestring "\xC2"]
-} {1}
+} 1
test utf-2.4 {Tcl_UtfToUniChar: lead (2-byte) followed by trail} testbytestring {
string length [testbytestring "\xC2\xA2"]
-} {1}
+} 1
test utf-2.5 {Tcl_UtfToUniChar: lead (3-byte) followed by non-trail} testbytestring {
string length [testbytestring "\xE2"]
-} {1}
+} 1
test utf-2.6 {Tcl_UtfToUniChar: lead (3-byte) followed by 1 trail} testbytestring {
string length [testbytestring "\xE2\xA2"]
-} {2}
+} 2
test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} testbytestring {
string length [testbytestring "\xE4\xB9\x8E"]
-} {1}
-test utf-2.8 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {tip389 testbytestring} -body {
+} 1
+test utf-2.8.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs2} {
string length [testbytestring "\xF0\x90\x80\x80"]
-} -result {2}
-test utf-2.9 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} -constraints {tip389 testbytestring} -body {
+} 4
+test utf-2.8.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs4} {
+ string length [testbytestring "\xF0\x90\x80\x80"]
+} 1
+test utf-2.8.2 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring tip389} {
+ string length [testbytestring "\xF0\x90\x80\x80"]
+} 2
+test utf-2.9.0 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs2} {
+ string length [testbytestring "\xF4\x8F\xBF\xBF"]
+} 4
+test utf-2.9.1 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring ucs4} {
+ string length [testbytestring "\xF4\x8F\xBF\xBF"]
+} 1
+test utf-2.9.2 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail} {testbytestring tip389} {
string length [testbytestring "\xF4\x8F\xBF\xBF"]
-} -result {2}
+} 2
test utf-2.10 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, underflow} testbytestring {
string length [testbytestring "\xF0\x8F\xBF\xBF"]
-} {4}
+} 4
test utf-2.11 {Tcl_UtfToUniChar: lead (4-byte) followed by 3 trail, overflow} testbytestring {
+ # Would decode to U+110000 but that is outside the Unicode range.
string length [testbytestring "\xF4\x90\x80\x80"]
-} {4}
+} 4
test utf-2.12 {Tcl_UtfToUniChar: longer UTF sequences not supported} testbytestring {
string length [testbytestring "\xF8\xA2\xA2\xA2\xA2"]
-} {5}
+} 5
test utf-3.1 {Tcl_UtfCharComplete} {
} {}
-testConstraint testnumutfchars [llength [info commands testnumutfchars]]
-testConstraint testfindfirst [llength [info commands testfindfirst]]
-testConstraint testfindlast [llength [info commands testfindlast]]
-
test utf-4.1 {Tcl_NumUtfChars: zero length} testnumutfchars {
testnumutfchars ""
-} {0}
+} 0
test utf-4.2 {Tcl_NumUtfChars: length 1} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC2\xA2"]
-} {1}
+} 1
test utf-4.3 {Tcl_NumUtfChars: long string} {testnumutfchars testbytestring} {
- testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"]
-} {7}
+ testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\xA2\x4E"]
+} 7
test utf-4.4 {Tcl_NumUtfChars: #u0000} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC0\x80"]
-} {1}
+} 1
test utf-4.5 {Tcl_NumUtfChars: zero length, calc len} testnumutfchars {
testnumutfchars "" 0
-} {0}
+} 0
test utf-4.6 {Tcl_NumUtfChars: length 1, calc len} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC2\xA2"] end
-} {1}
+} 1
test utf-4.7 {Tcl_NumUtfChars: long string, calc len} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "abc\xC2\xA2\xE4\xB9\x8E\uA2\x4E"] end
-} {7}
+} 7
test utf-4.8 {Tcl_NumUtfChars: #u0000, calc len} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xC0\x80"] end
-} {1}
+} 1
# Bug [2738427]: Tcl_NumUtfChars(...) no overflow check
test utf-4.9 {Tcl_NumUtfChars: #u20AC, calc len, incomplete} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\xE2\x82\xAC"] end-1
-} {2}
+} 2
test utf-4.10 {Tcl_NumUtfChars: #u0000, calc len, overcomplete} {testnumutfchars testbytestring} {
testnumutfchars [testbytestring "\x00"] end+1
-} {2}
+} 2
test utf-4.11 {Tcl_NumUtfChars: 3 bytes of 4-byte UTF-8 characater} {testnumutfchars testbytestring} {
- testnumutfchars [testbytestring \xf0\x9f\x92\xa9] end-1
-} {3}
-test utf-4.12 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring tip389} {
- testnumutfchars [testbytestring \xf0\x9f\x92\xa9] end
-} {2}
+ testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end-1
+} 3
+test utf-4.12.0 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring ucs2} {
+ testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end
+} 4
+test utf-4.12.1 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring ucs4} {
+ testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end
+} 1
+test utf-4.12.2 {Tcl_NumUtfChars: #4-byte UTF-8 character} {testnumutfchars testbytestring tip389} {
+ testnumutfchars [testbytestring \xF0\x9F\x92\xA9] end
+} 2
test utf-5.1 {Tcl_UtfFindFirst} {testfindfirst testbytestring} {
testfindfirst [testbytestring "abcbc"] 98
-} {bcbc}
+} bcbc
test utf-5.2 {Tcl_UtfFindLast} {testfindlast testbytestring} {
testfindlast [testbytestring "abcbc"] 98
-} {bc}
-
-test utf-6.1 {Tcl_UtfNext} {
-} {}
+} bc
-testConstraint testutfprev [llength [info commands testutfprev]]
+test utf-6.1 {Tcl_UtfNext} testutfnext {
+ # This takes the pointer one past the terminating NUL.
+ # This is really an invalid call.
+ testutfnext -bytestring {}
+} 1
+test utf-6.2 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A
+} 1
+test utf-6.3 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring AA
+} 1
+test utf-6.4 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A\xA0
+} 1
+test utf-6.5 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A\xD0
+} 1
+test utf-6.6 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A\xE8
+} 1
+test utf-6.7 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A\xF2
+} 1
+test utf-6.8 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring A\xF8
+} 1
+test utf-6.9 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0
+} 1
+test utf-6.10 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0G
+} 1
+test utf-6.11 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0\xA0
+} 2
+test utf-6.12 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0\xD0
+} 1
+test utf-6.13 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0\xE8
+} 1
+test utf-6.14 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0\xF2
+} 1
+test utf-6.15 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xA0\xF8
+} 1
+test utf-6.16 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0
+} 1
+test utf-6.17 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0G
+} 1
+test utf-6.18 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0
+} 2
+test utf-6.19 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xD0
+} 1
+test utf-6.20 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xE8
+} 1
+test utf-6.21 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xF2
+} 1
+test utf-6.22 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xF8
+} 1
+test utf-6.23 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8
+} 1
+test utf-6.24 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8G
+} 1
+test utf-6.25 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0
+} 1
+test utf-6.26 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xD0
+} 1
+test utf-6.27 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xE8
+} 1
+test utf-6.28 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xF2
+} 1
+test utf-6.29 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xF8
+} 1
+test utf-6.30 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2
+} 1
+test utf-6.31 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2G
+} 1
+test utf-6.32 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0
+} 1
+test utf-6.33 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xD0
+} 1
+test utf-6.34 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xE8
+} 1
+test utf-6.35 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xF2
+} 1
+test utf-6.36 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xF8
+} 1
+test utf-6.37 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8
+} 1
+test utf-6.38 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8G
+} 1
+test utf-6.39 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8\xA0
+} 1
+test utf-6.40 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8\xD0
+} 1
+test utf-6.41 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8\xE8
+} 1
+test utf-6.42 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8\xF2
+} 1
+test utf-6.43 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF8\xF8
+} 1
+test utf-6.44 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0G
+} 2
+test utf-6.45 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0\xA0
+} 2
+test utf-6.46 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0\xD0
+} 2
+test utf-6.47 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0\xE8
+} 2
+test utf-6.48 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0\xF2
+} 2
+test utf-6.49 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xD0\xA0\xF8
+} 2
+test utf-6.50 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0G
+} 1
+test utf-6.51 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0
+} 3
+test utf-6.52 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xD0
+} 1
+test utf-6.53 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xE8
+} 1
+test utf-6.54 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xF2
+} 1
+test utf-6.55 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xF8
+} 1
+test utf-6.56 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0G
+} 1
+test utf-6.57 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0
+} 1
+test utf-6.58 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xD0
+} 1
+test utf-6.59 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xE8
+} 1
+test utf-6.60 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xF2
+} 1
+test utf-6.61 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xF8
+} 1
+test utf-6.62 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0G
+} 3
+test utf-6.63 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0\xA0
+} 3
+test utf-6.64 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0\xD0
+} 3
+test utf-6.65 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0\xE8
+} 3
+test utf-6.66 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0\xF2
+} 3
+test utf-6.67 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xE8\xA0\xA0\xF8
+} 3
+test utf-6.68 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0G
+} 1
+test utf-6.69 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0
+} 4
+test utf-6.70 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xD0
+} 1
+test utf-6.71 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xE8
+} 1
+test utf-6.72 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xF2
+} 1
+test utf-6.73 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xF8
+} 1
+test utf-6.74 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0G
+} 4
+test utf-6.75 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0\xA0
+} 4
+test utf-6.76 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0\xD0
+} 4
+test utf-6.77 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0\xE8
+} 4
+test utf-6.78 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0\xF2
+} 4
+test utf-6.79 {Tcl_UtfNext} testutfnext {
+ testutfnext -bytestring \xF2\xA0\xA0\xA0G\xF8
+} 4
+test utf-6.80 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xC0\x80
+} 2
+test utf-6.81 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xC0\x81
+} 1
+test utf-6.82 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xC1\x80
+} 1
+test utf-6.83 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xC2\x80
+} 2
+test utf-6.84 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xE0\x80\x80
+} 1
+test utf-6.85 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xE0\xA0\x80
+} 3
+test utf-6.86 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xF0\x80\x80\x80
+} 1
+test utf-6.87 {Tcl_UtfNext - overlong sequences} testutfnext {
+ testutfnext -bytestring \xF0\x90\x80\x80
+} 4
+test utf-6.88 {Tcl_UtfNext, pointing to 2th byte of 3-byte valid sequence} testutfnext {
+ testutfnext -bytestring \xA0\xA0
+} 2
+test utf-6.89 {Tcl_UtfNext, pointing to 2th byte of 3-byte invalid sequence} testutfnext {
+ testutfnext -bytestring \x80\x80
+} 2
+test utf-6.90 {Tcl_UtfNext, validity check [493dccc2de]} testutfnext {
+ testutfnext -bytestring \xF4\x8F\xBF\xBF
+} 4
+test utf-6.91 {Tcl_UtfNext, validity check [493dccc2de]} testutfnext {
+ testutfnext -bytestring \xF4\x90\x80\x80
+} 1
+test utf-6.92 {Tcl_UtfNext, pointing to 2th byte of 4-byte valid sequence} testutfnext {
+ testutfnext -bytestring \xA0\xA0\xA0
+} 3
+test utf-6.93 {Tcl_UtfNext, pointing to 2th byte of 4-byte invalid sequence} testutfnext {
+ testutfnext -bytestring \x80\x80\x80
+} 3
test utf-7.1 {Tcl_UtfPrev} testutfprev {
testutfprev {}
@@ -176,13 +488,13 @@ test utf-7.4.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xF8\xA0\xA0 2
} 1
test utf-7.5 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4
+ testutfprev A\xF2
} 1
test utf-7.5.1 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0\xA0 2
+ testutfprev A\xF2\xA0\xA0\xA0 2
} 1
test utf-7.5.2 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xF8\xA0\xA0 2
+ testutfprev A\xF2\xF8\xA0\xA0 2
} 1
test utf-7.6 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8
@@ -221,13 +533,13 @@ test utf-7.9.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xF8\xA0 3
} 2
test utf-7.10 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0
+ testutfprev A\xF2\xA0
} 1
test utf-7.10.1 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0\xA0 3
+ testutfprev A\xF2\xA0\xA0\xA0 3
} 1
test utf-7.10.2 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xF8\xA0 3
+ testutfprev A\xF2\xA0\xF8\xA0 3
} 1
test utf-7.11 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0
@@ -238,6 +550,9 @@ test utf-7.11.1 {Tcl_UtfPrev} testutfprev {
test utf-7.11.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0\xF8\xA0 3
} 1
+test utf-7.11.3 {Tcl_UtfPrev} testutfprev {
+ testutfprev A\xE8\xA0\xF8 3
+} 1
test utf-7.12 {Tcl_UtfPrev} testutfprev {
testutfprev A\xD0\xA0
} 1
@@ -266,13 +581,13 @@ test utf-7.14.2 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xA0\xF8 4
} 3
test utf-7.15 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0
+ testutfprev A\xF2\xA0\xA0
} 1
test utf-7.15.1 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0\xA0 4
+ testutfprev A\xF2\xA0\xA0\xA0 4
} 1
test utf-7.15.2 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0\xF8 4
+ testutfprev A\xF2\xA0\xA0\xF8 4
} 1
test utf-7.16 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0\xA0
@@ -305,7 +620,7 @@ test utf-7.19 {Tcl_UtfPrev} testutfprev {
testutfprev A\xF8\xA0\xA0\xA0
} 4
test utf-7.20 {Tcl_UtfPrev} testutfprev {
- testutfprev A\xF4\xA0\xA0\xA0
+ testutfprev A\xF2\xA0\xA0\xA0
} 1
test utf-7.21 {Tcl_UtfPrev} testutfprev {
testutfprev A\xE8\xA0\xA0\xA0
@@ -316,16 +631,124 @@ test utf-7.22 {Tcl_UtfPrev} testutfprev {
test utf-7.23 {Tcl_UtfPrev} testutfprev {
testutfprev A\xA0\xA0\xA0\xA0
} 4
+test utf-7.24 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xC0\x81
+} 2
+test utf-7.25 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xC0\x81 2
+} 1
+test utf-7.26 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\x80\x80
+} 3
+test utf-7.27 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\x80
+} 2
+test utf-7.27.1 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\x80\x80 3
+} 2
+test utf-7.28 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0
+} 1
+test utf-7.28.1 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\x80\x80 2
+} 1
+test utf-7.29 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x80\x80\x80
+} 4
+test utf-7.30 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x80\x80\x80 4
+} 3
+test utf-7.31 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x80\x80\x80 3
+} 2
+test utf-7.32 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x80\x80\x80 2
+} 1
+test utf-7.33 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xC0\x80
+} 1
+test utf-7.34 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xC1\x80
+} 2
+test utf-7.35 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xC2\x80
+} 1
+test utf-7.36 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\xA0\x80
+} 1
+test utf-7.37 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\xA0\x80 3
+} 1
+test utf-7.38 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xE0\xA0\x80 2
+} 1
+test utf-7.39 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x90\x80\x80
+} 1
+test utf-7.40 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x90\x80\x80 4
+} 1
+test utf-7.41 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x90\x80\x80 3
+} 1
+test utf-7.42 {Tcl_UtfPrev -- overlong sequence} testutfprev {
+ testutfprev A\xF0\x90\x80\x80 2
+} 1
+test utf-7.43 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
+ testutfprev \xA0
+} 0
+test utf-7.44 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
+ testutfprev \xA0\xA0
+} 1
+test utf-7.45 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
+ testutfprev \xA0\xA0\xA0
+} 2
+test utf-7.46 {Tcl_UtfPrev -- no lead byte at start} testutfprev {
+ testutfprev \xA0\xA0\xA0\xA0
+} 3
+test utf-7.47 {Tcl_UtfPrev, pointing to 3th byte of 3-byte valid sequence} testutfprev {
+ testutfprev \xE8\xA0
+} 0
+test utf-7.47.1 {Tcl_UtfPrev, pointing to 3th byte of 3-byte valid sequence} testutfprev {
+ testutfprev \xE8\xA0\xA0 2
+} 0
+test utf-7.47.2 {Tcl_UtfPrev, pointing to 3th byte of 3-byte invalid sequence} testutfprev {
+ testutfprev \xE8\xA0\x00 2
+} 0
+test utf-7.48 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x8F\xBF\xBF
+} 1
+test utf-7.48.1 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x8F\xBF\xBF 4
+} 1
+test utf-7.48.2 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x8F\xBF\xBF 3
+} 1
+test utf-7.48.3 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x8F\xBF\xBF 2
+} 1
+test utf-7.49 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x90\x80\x80
+} 4
+test utf-7.49.1 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x90\x80\x80 4
+} 3
+test utf-7.49.2 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x90\x80\x80 3
+} 2
+test utf-7.49.3 {Tcl_UtfPrev, validity check [493dccc2de]} testutfprev {
+ testutfprev A\xF4\x90\x80\x80 2
+} 1
test utf-8.1 {Tcl_UniCharAtIndex: index = 0} {
string index abcd 0
-} {a}
+} a
test utf-8.2 {Tcl_UniCharAtIndex: index = 0} {
string index \u4E4E\u25A 0
} "\u4E4E"
test utf-8.3 {Tcl_UniCharAtIndex: index > 0} {
string index abcd 2
-} {c}
+} c
test utf-8.4 {Tcl_UniCharAtIndex: index > 0} {
string index \u4E4E\u25A\xFF\u543 2
} "\uFF"
@@ -335,13 +758,25 @@ test utf-8.5 {Tcl_UniCharAtIndex: high surrogate} {
test utf-8.6 {Tcl_UniCharAtIndex: low surrogate} {
string index \uDC42 0
} "\uDC42"
+test utf-8.7 {Tcl_UniCharAtIndex: Emoji} {
+ string index \U1F600 0
+} "\U1F600"
+test utf-8.8 {Tcl_UniCharAtIndex: Emoji} {
+ string index \U1F600 1
+} {}
test utf-9.1 {Tcl_UtfAtIndex: index = 0} {
string range abcd 0 2
-} {abc}
+} abc
test utf-9.2 {Tcl_UtfAtIndex: index > 0} {
string range \u4E4E\u25A\xFF\u543klmnop 1 5
} "\u25A\xFF\u543kl"
+test utf-9.3 {Tcl_UtfAtIndex: index = 0, Emoji} {
+ string range \U1F600G 0 0
+} "\U1F600"
+test utf-9.4 {Tcl_UtfAtIndex: index > 0, Emoji} tip389 {
+ string range \U1F600G 1 1
+} {}
test utf-10.1 {Tcl_UtfBackslash: dst == NULL} {
@@ -438,15 +873,21 @@ test utf-11.2 {Tcl_UtfToUpper} {
string toupper abc
} ABC
test utf-11.3 {Tcl_UtfToUpper} {
- string toupper \xE3AB
-} \xC3AB
+ string toupper \xE3gh
+} \xC3GH
test utf-11.4 {Tcl_UtfToUpper} {
- string toupper \u01E3AB
-} \u01E2AB
+ string toupper \u01E3gh
+} \u01E2GH
test utf-11.5 {Tcl_UtfToUpper Georgian (new in Unicode 11)} {
string toupper \u10D0\u1C90
} \u1C90\u1C90
-test utf-11.6 {Tcl_UtfToUpper low/high surrogate)} {
+test utf-11.6 {Tcl_UtfToUpper beyond U+FFFF} {Uesc fullutf} {
+ string toupper \U10428
+} \U10400
+test utf-11.7 {Tcl_UtfToUpper beyond U+FFFF} {pairsTo4bytes} {
+ string toupper \uD801\uDC28
+} \uD801\uDC00
+test utf-11.8 {Tcl_UtfToUpper low/high surrogate)} {
string toupper \uDC24\uD824
} \uDC24\uD824
@@ -457,17 +898,23 @@ test utf-12.2 {Tcl_UtfToLower} {
string tolower ABC
} abc
test utf-12.3 {Tcl_UtfToLower} {
- string tolower \xC3AB
-} \xE3ab
+ string tolower \xC3GH
+} \xE3gh
test utf-12.4 {Tcl_UtfToLower} {
- string tolower \u01E2AB
-} \u01E3ab
+ string tolower \u01E2GH
+} \u01E3gh
test utf-12.5 {Tcl_UtfToLower Georgian (new in Unicode 11)} {
string tolower \u10D0\u1C90
} \u10D0\u10D0
-test utf-12.6 {Tcl_UtfToUpper low/high surrogate)} {
+test utf-12.6 {Tcl_UtfToLower low/high surrogate)} {
string tolower \uDC24\uD824
} \uDC24\uD824
+test utf-12.7 {Tcl_UtfToLower beyond U+FFFF} {Uesc fullutf} {
+ string tolower \U10400
+} \U10428
+test utf-12.8 {Tcl_UtfToLower beyond U+FFFF} {pairsTo4bytes} {
+ string tolower \uD801\uDC00
+} \uD801\uDC28
test utf-13.1 {Tcl_UtfToTitle} {
string totitle {}
@@ -476,8 +923,8 @@ test utf-13.2 {Tcl_UtfToTitle} {
string totitle abc
} Abc
test utf-13.3 {Tcl_UtfToTitle} {
- string totitle \xE3AB
-} \xC3ab
+ string totitle \xE3GH
+} \xC3gh
test utf-13.4 {Tcl_UtfToTitle} {
string totitle \u01F3AB
} \u01F2ab
@@ -490,6 +937,12 @@ test utf-13.6 {Tcl_UtfToTitle Georgian (new in Unicode 11)} {
test utf-13.7 {Tcl_UtfToTitle low/high surrogate)} {
string totitle \uDC24\uD824
} \uDC24\uD824
+test utf-13.8 {Tcl_UtfToTitle beyond U+FFFF} {Uesc fullutf} {
+ string totitle \U10428
+} \U10400
+test utf-13.9 {Tcl_UtfToTitle beyond U+FFFF} {pairsTo4bytes} {
+ string totitle \uD801\uDC28
+} \uD801\uDC00
test utf-14.1 {Tcl_UtfNcasecmp} {
string compare -nocase a b
@@ -553,7 +1006,7 @@ test utf-20.1 {TclUniCharNcmp} {
test utf-21.1 {TclUniCharIsAlnum} {
# this returns 1 with Unicode 7 compliance
string is alnum \u1040\u021F\u0220
-} {1}
+} 1
test utf-21.2 {unicode alnum char in regc_locale.c} {
# this returns 1 with Unicode 7 compliance
list [regexp {^[[:alnum:]]+$} \u1040\u021F\u0220] [regexp {^\w+$} \u1040\u021F\u0220_\u203F\u2040\u2054\uFE33\uFE34\uFE4D\uFE4E\uFE4F\uFF3F]
@@ -565,39 +1018,39 @@ test utf-21.3 {unicode print char in regc_locale.c} {
test utf-21.4 {TclUniCharIsGraph} {
# [Bug 3464428]
string is graph \u0120
-} {1}
+} 1
test utf-21.5 {unicode graph char in regc_locale.c} {
# [Bug 3464428]
regexp {^[[:graph:]]+$} \u0120
-} {1}
+} 1
test utf-21.6 {TclUniCharIsGraph} {
# [Bug 3464428]
string is graph \xA0
-} {0}
+} 0
test utf-21.7 {unicode graph char in regc_locale.c} {
# [Bug 3464428]
regexp {[[:graph:]]} \x20\xA0\u2028\u2029
-} {0}
+} 0
test utf-21.8 {TclUniCharIsPrint} {
# [Bug 3464428]
string is print \x09
-} {0}
+} 0
test utf-21.9 {unicode print char in regc_locale.c} {
# [Bug 3464428]
regexp {[[:print:]]} \x09
-} {0}
+} 0
test utf-21.10 {unicode print char in regc_locale.c} {
# [Bug 3464428]
regexp {[[:print:]]} \x09
-} {0}
+} 0
test utf-21.11 {TclUniCharIsControl} {
# [Bug 3464428]
string is control \x00\x1F\xAD\u0605\u061C\u180E\u2066\uFEFF
-} {1}
+} 1
test utf-21.12 {unicode control char in regc_locale.c} {
# [Bug 3464428], [Bug a876646efe]
regexp {^[[:cntrl:]]*$} \x00\x1F\xAD\u0605\u061C\u180E\u2066\uFEFF
-} {1}
+} 1
test utf-22.1 {TclUniCharIsWordChar} {
string wordend "xyz123_bar fg" 0
@@ -609,32 +1062,38 @@ test utf-22.2 {TclUniCharIsWordChar} {
test utf-23.1 {TclUniCharIsAlpha} {
# this returns 1 with Unicode 7 compliance
string is alpha \u021F\u0220\u037F\u052F
-} {1}
+} 1
test utf-23.2 {unicode alpha char in regc_locale.c} {
# this returns 1 with Unicode 7 compliance
regexp {^[[:alpha:]]+$} \u021F\u0220\u037F\u052F
-} {1}
+} 1
test utf-24.1 {TclUniCharIsDigit} {
# this returns 1 with Unicode 7 compliance
string is digit \u1040\uABF0
-} {1}
+} 1
test utf-24.2 {unicode digit char in regc_locale.c} {
# this returns 1 with Unicode 7 compliance
list [regexp {^[[:digit:]]+$} \u1040\uABF0] [regexp {^\d+$} \u1040\uABF0]
} {1 1}
test utf-24.3 {TclUniCharIsSpace} {
+ # this returns 1 with Unicode 7 compliance
+ string is space \u1680\u180E\u202F
+} 1
+test utf-24.4 {unicode space char in regc_locale.c} {
+ # this returns 1 with Unicode 7 compliance
+ list [regexp {^[[:space:]]+$} \u1680\u180E\u202F] [regexp {^\s+$} \u1680\u180E\u202F]
+} {1 1}
+test utf-24.5 {TclUniCharIsSpace} tip413 {
# this returns 1 with Unicode 7/TIP 413 compliance
string is space \x85\u1680\u180E\u200B\u202F\u2060
-} {1}
-test utf-24.4 {unicode space char in regc_locale.c} {
+} 1
+test utf-24.6 {unicode space char in regc_locale.c} tip413 {
# this returns 1 with Unicode 7/TIP 413 compliance
list [regexp {^[[:space:]]+$} \x85\u1680\u180E\u200B\u202F\u2060] [regexp {^\s+$} \x85\u1680\u180E\u200B\u202F\u2060]
} {1 1}
-testConstraint teststringobj [llength [info commands teststringobj]]
-
test utf-25.1 {Tcl_UniCharNcasecmp} -constraints teststringobj \
-setup {
testobj freeallvars
diff --git a/unix/configure b/unix/configure
index 6018e6f..874c945 100755
--- a/unix/configure
+++ b/unix/configure
@@ -5524,7 +5524,7 @@ fi
SHLIB_LD='${CC} -shared'
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
@@ -5614,7 +5614,7 @@ esac
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
;;
@@ -5632,7 +5632,7 @@ esac
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
if test "$GCC" = yes; then :
@@ -5669,7 +5669,7 @@ esac
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
@@ -5709,7 +5709,7 @@ fi
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
if test "`uname -m`" = "alpha"; then :
@@ -5776,8 +5776,8 @@ fi
LD_FLAGS="-Wl,--export-dynamic"
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
+ LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
;;
OpenBSD-*)
@@ -5796,7 +5796,7 @@ fi
DL_LIBS=""
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
@@ -5820,7 +5820,7 @@ fi
LDFLAGS="$LDFLAGS -export-dynamic"
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
fi
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
# The -pthread needs to go in the CFLAGS, not LIBS
@@ -5838,8 +5838,8 @@ fi
DL_LIBS=""
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ 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//`
@@ -6191,7 +6191,7 @@ fi
DL_LIBS=""
if test $doRpath = yes; then :
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
fi
if test "$GCC" = yes; then :
diff --git a/unix/tcl.m4 b/unix/tcl.m4
index 271bd03..0a2920b 100644
--- a/unix/tcl.m4
+++ b/unix/tcl.m4
@@ -1180,7 +1180,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
do64bit_ok=yes
SHLIB_LD='${CC} -shared'
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
;;
*)
@@ -1215,7 +1215,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS=""
AC_LIBOBJ(mkstemp)
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
;;
IRIX-6.*)
@@ -1226,7 +1226,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS=""
AC_LIBOBJ(mkstemp)
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
AS_IF([test "$GCC" = yes], [
CFLAGS="$CFLAGS -mabi=n32"
@@ -1252,7 +1252,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS=""
AC_LIBOBJ(mkstemp)
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
# Check to enable 64-bit flags for compiler/linker
@@ -1283,7 +1283,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS="-ldl"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
AS_IF([test $do64bit = yes], [
@@ -1315,8 +1315,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS="-mshared -ldl"
LD_FLAGS="-Wl,--export-dynamic"
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
- LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
+ LD_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
;;
OpenBSD-*)
arch=`arch -s`
@@ -1333,7 +1333,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}'
LDFLAGS="-Wl,-export-dynamic"
@@ -1355,7 +1355,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_LIBS=""
LDFLAGS="$LDFLAGS -export-dynamic"
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'])
LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
# The -pthread needs to go in the CFLAGS, not LIBS
LIBS=`echo $LIBS | sed s/-pthread//`
@@ -1371,8 +1371,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
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}'])
+ 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"
@@ -1540,7 +1540,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
DL_OBJS="tclLoadDl.o"
DL_LIBS=""
AS_IF([test $doRpath = yes], [
- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
+ CC_SEARCH_FLAGS='"-Wl,-rpath,${LIB_RUNTIME_DIR}"'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'])
AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [
CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"])
diff --git a/unix/tclUnixSock.c b/unix/tclUnixSock.c
index b707be4..cb20166 100644
--- a/unix/tclUnixSock.c
+++ b/unix/tclUnixSock.c
@@ -1009,7 +1009,7 @@ TcpThreadActionProc(
if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) {
/*
* Async-connecting socket must get reassigned handler if it have been
- * transferred to another thread. Remove the handler if the socket is
+ * transferred to another thread. Remove the handler if the socket is
* not managed by this thread anymore and create new handler (TSD related)
* so the callback will run in the correct thread, bug [f583715154].
*/
diff --git a/win/tclWinTime.c b/win/tclWinTime.c
index 277b57f..ef2b9d2 100644
--- a/win/tclWinTime.c
+++ b/win/tclWinTime.c
@@ -1364,7 +1364,7 @@ TclpGmtime(
#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return gmtime(timePtr);
#else
- return _gmtime32((CONST __time32_t *)timePtr);
+ return _gmtime32((const __time32_t *)timePtr);
#endif
}
@@ -1399,7 +1399,7 @@ TclpLocaltime(
#if defined(_WIN64) || defined(_USE_64BIT_TIME_T) || (defined(_MSC_VER) && _MSC_VER < 1400)
return localtime(timePtr);
#else
- return _localtime32((CONST __time32_t *)timePtr);
+ return _localtime32((const __time32_t *)timePtr);
#endif
}
#endif /* TCL_NO_DEPRECATED */