summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-24 21:37:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-04-24 21:37:37 (GMT)
commit0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8 (patch)
tree342c37051bcd6c1391fb68000870885797dcfd69 /generic
parentadb2d1d9399a44ba950ed6f2c064c1509dffde87 (diff)
parentba884cc1dd1d227fad00c29309a5add78a73b2ba (diff)
downloadtcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.zip
tcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.tar.gz
tcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.tar.bz2
Merge 8.6 (Except encoding-12.6 test-case still to be handled)
Diffstat (limited to 'generic')
-rw-r--r--generic/regc_lex.c10
-rw-r--r--generic/tclEncoding.c5
-rw-r--r--generic/tclParse.c14
3 files changed, 16 insertions, 13 deletions
diff --git a/generic/regc_lex.c b/generic/regc_lex.c
index a303ec6..6ef0a83 100644
--- a/generic/regc_lex.c
+++ b/generic/regc_lex.c
@@ -843,12 +843,18 @@ lexescape(
if (ISERR()) {
FAILW(REG_EESCAPE);
}
- if (i > 0xFFFF) {
+#if CHRBITS > 16
+ if ((unsigned)i > 0x10FFFF) {
+ i = 0xFFFD;
+ }
+#else
+ if ((unsigned)i & ~0xFFFF) {
/* TODO: output a Surrogate pair
*/
i = 0xFFFD;
}
- RETV(PLAIN, (uchr) i);
+#endif
+ RETV(PLAIN, (uchr)i);
break;
case CHR('v'):
RETV(PLAIN, CHR('\v'));
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/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".