summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-24 22:20:17 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-02-24 22:20:17 (GMT)
commitb788457ad48d5cc34b431418f7d076d83f78b5ff (patch)
treeb5b8e6cbd9ce48ba6967a7cd9942760afd16405c /generic
parent671915641bb91ac0aed5250cf92efbfc30f9e0a4 (diff)
downloadtcl-b788457ad48d5cc34b431418f7d076d83f78b5ff.zip
tcl-b788457ad48d5cc34b431418f7d076d83f78b5ff.tar.gz
tcl-b788457ad48d5cc34b431418f7d076d83f78b5ff.tar.bz2
3 more files with TCL_UTF_MAX checks
Diffstat (limited to 'generic')
-rw-r--r--generic/tclDecls.h2
-rw-r--r--generic/tclStringObj.c4
-rw-r--r--generic/tclUtf.c16
3 files changed, 11 insertions, 11 deletions
diff --git a/generic/tclDecls.h b/generic/tclDecls.h
index 939bae9..fd5f81b 100644
--- a/generic/tclDecls.h
+++ b/generic/tclDecls.h
@@ -4283,7 +4283,7 @@ extern const TclStubs *tclStubsPtr;
#undef Tcl_StringMatch
#define Tcl_StringMatch(str, pattern) Tcl_StringCaseMatch((str), (pattern), 0)
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
# undef Tcl_UniCharToUtfDString
# define Tcl_UniCharToUtfDString Tcl_Char16ToUtfDString
# undef Tcl_UtfToUniCharDString
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index bee1e3e..f240bc0 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -571,7 +571,7 @@ Tcl_GetUniChar(
return -1;
}
ch = stringPtr->unicode[index];
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* See: bug [11ae2be95dac9417] */
if ((ch & 0xF800) == 0xD800) {
if (ch & 0x400) {
@@ -785,7 +785,7 @@ Tcl_GetRange(
TclNewObj(newObjPtr);
return newObjPtr;
}
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* See: bug [11ae2be95dac9417] */
if ((first > 0) && ((stringPtr->unicode[first] & 0xFC00) == 0xDC00)
&& ((stringPtr->unicode[first-1] & 0xFC00) == 0xD800)) {
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index fae6edd..169f240 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -1137,7 +1137,7 @@ Tcl_UniCharAtIndex(
i = TclUtfToUniChar(src, &ch);
src += i;
}
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
if ((ch >= 0xD800) && (i < 3)) {
/* Index points at character following high Surrogate */
return -1;
@@ -1153,7 +1153,7 @@ Tcl_UniCharAtIndex(
* Tcl_UtfAtIndex --
*
* Returns a pointer to the specified character (not byte) position in
- * the UTF-8 string. If TCL_UTF_MAX <= 3, characters > U+FFFF count as
+ * the UTF-8 string. If TCL_UTF_MAX < 4, characters > U+FFFF count as
* 2 positions, but then the pointer should never be placed between
* the two positions.
*
@@ -1178,7 +1178,7 @@ Tcl_UtfAtIndex(
len = TclUtfToUniChar(src, &ch);
src += len;
}
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
if ((ch >= 0xD800) && (len < 3)) {
/* Index points at character following high Surrogate */
src += TclUtfToUniChar(src, &ch);
@@ -1500,7 +1500,7 @@ Tcl_UtfNcmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1551,7 +1551,7 @@ Tcl_UtfNcasecmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1600,7 +1600,7 @@ TclUtfCmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -1646,7 +1646,7 @@ TclUtfCasecmp(
cs += TclUtfToUniChar(cs, &ch1);
ct += TclUtfToUniChar(ct, &ch2);
if (ch1 != ch2) {
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
/* Surrogates always report higher than non-surrogates */
if (((ch1 & 0xFC00) == 0xD800)) {
if ((ch2 & 0xFC00) != 0xD800) {
@@ -2673,7 +2673,7 @@ TclUniCharMatch(
*---------------------------------------------------------------------------
*/
-#if TCL_UTF_MAX <= 3
+#if TCL_UTF_MAX < 4
int
TclUtfToUCS4(
const char *src, /* The UTF-8 string. */