diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 09:14:38 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-04-03 09:14:38 (GMT) |
| commit | b586e6742cacbdd3826f5d495868d56562b27ae9 (patch) | |
| tree | 4bdf281eea666ce2173aab810c000490dc048cd9 /generic/tclUtf.c | |
| parent | 5bd35202c0fcfd383cd30abaab299e546d73161f (diff) | |
| parent | 3e7df06557bc26dbbf2b7e7319eed92b3648f9d7 (diff) | |
| download | tcl-b586e6742cacbdd3826f5d495868d56562b27ae9.zip tcl-b586e6742cacbdd3826f5d495868d56562b27ae9.tar.gz tcl-b586e6742cacbdd3826f5d495868d56562b27ae9.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'generic/tclUtf.c')
| -rw-r--r-- | generic/tclUtf.c | 35 |
1 files changed, 4 insertions, 31 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index b6c5736..b53d918 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -2450,44 +2450,17 @@ TclUniCharMatch( *--------------------------------------------------------------------------- */ +#if TCL_UTF_MAX <= 3 int TclUtfToUCS4( const char *src, /* The UTF-8 string. */ int *ucs4Ptr) /* Filled with the UCS4 codepoint represented * by the UTF-8 string. */ { - int len, fullchar; - Tcl_UniChar ch = 0; - - len = TclUtfToUniChar(src, &ch); - fullchar = ch; - -#if TCL_UTF_MAX <= 3 - /* Limited interfaces -- must use and decode surrogates */ - - if ((ch >= 0xD800) && len < 3) { -/****** - ****** Note the #undef TCL_UtfToUniChar gets in our way here. - ****** - len += Tcl_UtfToUniChar(src + len, &ch); - ****** - ****** We have to do the subtitution ourselves. - ******/ - - len += Tcl_UtfToChar16(src + len, &ch); - -/****** - ****** We might also solve this by moving this routine higher in the file. - ****** Or there might be a more sensible foundation in this branch. - ******/ - - fullchar = (((fullchar & 0x3FF) << 10) | (ch & 0x3FF)) + 0x10000; - } -#endif - - *ucs4Ptr = fullchar; - return len; + /* Make use of the #undef Tcl_UtfToUniChar above, which already handles UCS4. */ + return Tcl_UtfToUniChar(src, &ch); } +#endif /* * Local Variables: |
