summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-11-18 13:51:02 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-11-18 13:51:02 (GMT)
commit8e1f957a669b2f4b84dca7e8a27f2985c0625172 (patch)
treedba1e5192d3d569c9588d12db8188ae501e1e0e9 /generic/tclCompExpr.c
parentc55eb93bb4ebc7ba1de131099e9c0c4a1c0ff4b2 (diff)
downloadtcl-8e1f957a669b2f4b84dca7e8a27f2985c0625172.zip
tcl-8e1f957a669b2f4b84dca7e8a27f2985c0625172.tar.gz
tcl-8e1f957a669b2f4b84dca7e8a27f2985c0625172.tar.bz2
More usage of TclUtfToUCS4/TclUniCharToUCS4 in stead of it's UniChar variants: This handles surrogate pairs better.
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 41938e3..fa15fba 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -1928,7 +1928,7 @@ ParseLexeme(
{
const char *end;
int scanned, size;
- Tcl_UniChar ch = 0;
+ int ch;
Tcl_Obj *literal = NULL;
unsigned char byte;
@@ -2145,14 +2145,14 @@ ParseLexeme(
*/
if (!TclIsBareword(*start) || *start == '_') {
- if (Tcl_UtfCharComplete(start, numBytes)) {
- scanned = TclUtfToUniChar(start, &ch);
+ if (TclUCS4Complete(start, numBytes)) {
+ scanned = TclUtfToUCS4(start, &ch);
} else {
- char utfBytes[4];
+ char utfBytes[8];
memcpy(utfBytes, start, numBytes);
utfBytes[numBytes] = '\0';
- scanned = TclUtfToUniChar(utfBytes, &ch);
+ scanned = TclUtfToUCS4(utfBytes, &ch);
}
*lexemePtr = INVALID;
Tcl_DecrRefCount(literal);