summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-19 20:17:01 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-02-19 20:17:01 (GMT)
commitbe2eb79067e63e0345d94834e85f6f7ecf659625 (patch)
treec4d124aeabc00a9b783dbe865fb4863df753117e
parenta3632778ce4707fa88124136b1fa8f078b7eff1c (diff)
parentb752d879c75b2b284c39120f000ad906c7506b87 (diff)
downloadtcl-be2eb79067e63e0345d94834e85f6f7ecf659625.zip
tcl-be2eb79067e63e0345d94834e85f6f7ecf659625.tar.gz
tcl-be2eb79067e63e0345d94834e85f6f7ecf659625.tar.bz2
Merge 8.7
-rw-r--r--doc/Utf.32
-rw-r--r--generic/tclParse.c2
-rw-r--r--generic/tclStringObj.c2
-rw-r--r--generic/tclStubInit.c4
-rw-r--r--generic/tclUtf.c6
-rw-r--r--tests/utf.test12
-rw-r--r--win/tclWin32Dll.c4
7 files changed, 16 insertions, 16 deletions
diff --git a/doc/Utf.3 b/doc/Utf.3
index 3bb285e..3ae5c0e 100644
--- a/doc/Utf.3
+++ b/doc/Utf.3
@@ -129,7 +129,7 @@ represent one Unicode character in the UTF-8 representation.
.PP
\fBTcl_UniCharToUtf\fR stores the character \fIch\fR as a UTF-8 string
in starting at \fIbuf\fR. The return value is the number of bytes stored
-in \fIbuf\fR. If ch is an upper surrogate (range U+D800 - U+DBFF), then
+in \fIbuf\fR. If ch is a high surrogate (range U+D800 - U+DBFF), then
the return value will be 0 and nothing will be stored. If you still
want to produce UTF-8 output for it (even though knowing it's an illegal
code-point on its own), just call \fBTcl_UniCharToUtf\fR again using ch = -1.
diff --git a/generic/tclParse.c b/generic/tclParse.c
index a3defec..9d20fba 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -941,7 +941,7 @@ TclParseBackslash(
}
count = Tcl_UniCharToUtf(result, dst);
if (!count) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
count = Tcl_UniCharToUtf(-1, dst);
}
return count;
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 8e3816b..a4f442f 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1952,7 +1952,7 @@ Tcl_AppendFormatToObj(
}
length = Tcl_UniCharToUtf(code, buf);
if (!length) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
length = Tcl_UniCharToUtf(-1, buf);
}
segment = Tcl_NewStringObj(buf, length);
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c
index 55e36b2..41958f8 100644
--- a/generic/tclStubInit.c
+++ b/generic/tclStubInit.c
@@ -211,7 +211,7 @@ Tcl_WinTCharToUtf(
wEnd = (wchar_t *)string + len;
for (w = (wchar_t *)string; w < wEnd; ) {
if (!blen && ((*w & 0xFC00) != 0xDC00)) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
blen = Tcl_UniCharToUtf(*w, p);
@@ -219,7 +219,7 @@ Tcl_WinTCharToUtf(
w++;
}
if (!blen) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
Tcl_DStringSetLength(dsPtr, oldLength + (p - result));
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 9903c8c..2897ace 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -233,7 +233,7 @@ Tcl_UniCharToUtfDString(
wEnd = uniStr + uniLength;
for (w = uniStr; w < wEnd; ) {
if (!len && ((*w & 0xFC00) != 0xDC00)) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
len = Tcl_UniCharToUtf(*w, p);
@@ -241,7 +241,7 @@ Tcl_UniCharToUtfDString(
w++;
}
if (!len) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
Tcl_DStringSetLength(dsPtr, oldLength + (p - string));
@@ -771,7 +771,7 @@ Tcl_UniCharAtIndex(
fullchar = ch;
#if TCL_UTF_MAX <= 4
if (!len) {
- /* If last Tcl_UniChar was an upper surrogate, combine with lower surrogate */
+ /* If last Tcl_UniChar was a high surrogate, combine with low surrogate */
(void)TclUtfToUniChar(src, &ch);
fullchar = (((fullchar & 0x3ff) << 10) | (ch & 0x3ff)) + 0x10000;
}
diff --git a/tests/utf.test b/tests/utf.test
index e820359..8a48191 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -44,16 +44,16 @@ test utf-1.6 {Tcl_UniCharToUtf: negative Tcl_UniChar} testbytestring {
test utf-1.7 {Tcl_UniCharToUtf: 4 byte sequences} -constraints testbytestring -body {
expr {"\U014e4e" eq [testbytestring "\xf0\x94\xb9\x8e"]}
} -result 1
-test utf-1.8 {Tcl_UniCharToUtf: 3 byte sequence, upper surrogate} testbytestring {
+test utf-1.8 {Tcl_UniCharToUtf: 3 byte sequence, high surrogate} testbytestring {
expr {"\ud842" eq [testbytestring "\xed\xa1\x82"]}
} 1
-test utf-1.9 {Tcl_UniCharToUtf: 3 byte sequence, lower surrogate} testbytestring {
+test utf-1.9 {Tcl_UniCharToUtf: 3 byte sequence, low surrogate} testbytestring {
expr {"\udc42" eq [testbytestring "\xed\xb1\x82"]}
} 1
-test utf-1.10 {Tcl_UniCharToUtf: 3 byte sequence, upper surrogate} testbytestring {
+test utf-1.10 {Tcl_UniCharToUtf: 3 byte sequence, high surrogate} testbytestring {
expr {[format %c 0xd842] eq [testbytestring "\xed\xa1\x82"]}
} 1
-test utf-1.11 {Tcl_UniCharToUtf: 3 byte sequence, lower surrogate} testbytestring {
+test utf-1.11 {Tcl_UniCharToUtf: 3 byte sequence, low surrogate} testbytestring {
expr {[format %c 0xdc42] eq [testbytestring "\xed\xb1\x82"]}
} 1
@@ -158,10 +158,10 @@ test utf-8.3 {Tcl_UniCharAtIndex: index > 0} {
test utf-8.4 {Tcl_UniCharAtIndex: index > 0} {
string index \u4e4e\u25a\xff\u543 2
} "\uff"
-test utf-8.5 {Tcl_UniCharAtIndex: upper surrogate} {
+test utf-8.5 {Tcl_UniCharAtIndex: high surrogate} {
string index \ud842 0
} "\ud842"
-test utf-8.5 {Tcl_UniCharAtIndex: lower surrogate} {
+test utf-8.5 {Tcl_UniCharAtIndex: low surrogate} {
string index \udc42 0
} "\udc42"
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index ff29309..5c04db6 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -567,7 +567,7 @@ Tcl_WinTCharToUtf(
wEnd = (TCHAR *)string + len;
for (w = (TCHAR *)string; w < wEnd; ) {
if (!blen && ((*w & 0xFC00) != 0xDC00)) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
blen = Tcl_UniCharToUtf(*w, p);
@@ -575,7 +575,7 @@ Tcl_WinTCharToUtf(
w++;
}
if (!blen) {
- /* Special case for handling upper surrogates. */
+ /* Special case for handling high surrogates. */
p += Tcl_UniCharToUtf(-1, p);
}
Tcl_DStringSetLength(dsPtr, oldLength + (p - result));