diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-20 22:54:13 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-03-20 22:54:13 (GMT) |
commit | d8c1fbed81745d41d1e9d504b3eccdd12b58fee9 (patch) | |
tree | d795eebdb4923f98b1cbc16b04e46ac5d2fbfea6 /generic/tclUtf.c | |
parent | 301062d3fba2d66db58bb0d3df8a8abc83bf1dce (diff) | |
parent | d8ec6222e8374b744712d5901e829fd92ee43cf0 (diff) | |
download | tcl-d8c1fbed81745d41d1e9d504b3eccdd12b58fee9.zip tcl-d8c1fbed81745d41d1e9d504b3eccdd12b58fee9.tar.gz tcl-d8c1fbed81745d41d1e9d504b3eccdd12b58fee9.tar.bz2 |
Merge 8.7
Diffstat (limited to 'generic/tclUtf.c')
-rw-r--r-- | generic/tclUtf.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/generic/tclUtf.c b/generic/tclUtf.c index 7866afd..f5ae07a 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -408,13 +408,13 @@ Tcl_UtfToUniChar( */ *chPtr = (((byte & 0x07) << 18) | ((src[1] & 0x3F) << 12) | ((src[2] & 0x3F) << 6) | (src[3] & 0x3F)); - if (((unsigned)(*chPtr) - 0x10000) <= 0xFFFFF) { + if ((unsigned)(*chPtr - 0x10000) <= 0xFFFFF) { return 4; } } /* - * A four-byte-character lead-byte not followed by two trail-bytes + * A four-byte-character lead-byte not followed by three trail-bytes * represents itself. */ } @@ -580,10 +580,10 @@ Tcl_UtfToUniCharDString( } end += 4; while (p < end) { - if (Tcl_UtfCharComplete(p, end-p)) { - p += TclUtfToUniChar(p, &ch); - } else if (((UCHAR(*p)-0x80)) < 0x20) { + if (((unsigned)(UCHAR(*p)-0x80)) < 0x20) { ch = cp1252[UCHAR(*p++)-0x80]; + } else if (Tcl_UtfCharComplete(p, end-p)) { + p += TclUtfToUniChar(p, &ch); } else { ch = UCHAR(*p++); } @@ -634,10 +634,10 @@ Tcl_UtfToUtf16DString( } end += 4; while (p < end) { - if (Tcl_UtfCharComplete(p, end-p)) { - p += Tcl_UtfToUtf16(p, &ch); - } else if (((UCHAR(*p)-0x80)) < 0x20) { + if (((unsigned)(UCHAR(*p)-0x80)) < 0x20) { ch = cp1252[UCHAR(*p++)-0x80]; + } else if (Tcl_UtfCharComplete(p, end-p)) { + p += TclUtfToWChar(p, &ch); } else { ch = UCHAR(*p++); } |