diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-24 21:37:37 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-24 21:37:37 (GMT) |
| commit | 0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8 (patch) | |
| tree | 342c37051bcd6c1391fb68000870885797dcfd69 | |
| parent | adb2d1d9399a44ba950ed6f2c064c1509dffde87 (diff) | |
| parent | ba884cc1dd1d227fad00c29309a5add78a73b2ba (diff) | |
| download | tcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.zip tcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.tar.gz tcl-0bf016741ddaacffa48a2abeafe0dbc17b9cd7b8.tar.bz2 | |
Merge 8.6 (Except encoding-12.6 test-case still to be handled)
| -rw-r--r-- | generic/regc_lex.c | 10 | ||||
| -rw-r--r-- | generic/tclEncoding.c | 5 | ||||
| -rw-r--r-- | generic/tclParse.c | 14 | ||||
| -rw-r--r-- | tests/encoding.test | 10 | ||||
| -rw-r--r-- | tests/reg.test | 1 |
5 files changed, 22 insertions, 18 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". 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" |
