summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2020-04-21 14:52:48 (GMT)
committerdgp <dgp@users.sourceforge.net>2020-04-21 14:52:48 (GMT)
commit941ef44a3fce68b1dc81abb397a80f209b2ca982 (patch)
tree1c30ef21f476c138a687178b054c4ffab4c0ffd6
parent5ccd380c46e3e74f3273ecfa83b0686bca5e8056 (diff)
downloadtcl-941ef44a3fce68b1dc81abb397a80f209b2ca982.zip
tcl-941ef44a3fce68b1dc81abb397a80f209b2ca982.tar.gz
tcl-941ef44a3fce68b1dc81abb397a80f209b2ca982.tar.bz2
Revert the other encoding system backport.
The blocking and failing tests are illustrations of existing tickets [1004065] and [1122671], recording that the encoding machinery hardcodes assumptions in multiple places that sizeof(Tcl_UniChar) == 2. Closing the segfault bug fix should not be hostage to fixing those old bugs.
-rw-r--r--generic/tclEncoding.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 66bec44..6c16827 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -2470,33 +2470,20 @@ UtfToUnicodeProc(
if (dst > dstEnd) {
result = TCL_CONVERT_NOSPACE;
break;
- }
+ }
src += TclUtfToUniChar(src, &ch);
/*
* Need to handle this in a way that won't cause misalignment
* by casting dst to a Tcl_UniChar. [Bug 1122671]
+ * XXX: This hard-codes the assumed size of Tcl_UniChar as 2.
*/
#ifdef WORDS_BIGENDIAN
-#if TCL_UTF_MAX > 3
- *dst++ = (ch >> 24);
- *dst++ = ((ch >> 16) & 0xFF);
- *dst++ = ((ch >> 8) & 0xFF);
- *dst++ = (ch & 0xFF);
-#else
*dst++ = (ch >> 8);
*dst++ = (ch & 0xFF);
-#endif
-#else
-#if TCL_UTF_MAX > 3
- *dst++ = (ch & 0xFF);
- *dst++ = ((ch >> 8) & 0xFF);
- *dst++ = ((ch >> 16) & 0xFF);
- *dst++ = (ch >> 24);
#else
*dst++ = (ch & 0xFF);
*dst++ = (ch >> 8);
#endif
-#endif
}
*srcReadPtr = src - srcStart;
*dstWrotePtr = dst - dstStart;