diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-08-31 10:41:22 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2015-08-31 10:41:22 (GMT) |
commit | d798be3eaf55726dfd1259cb8f285cecff5ad39c (patch) | |
tree | c00c8e4ed596c500e03ca46811d7fe010bbc8916 /generic | |
parent | 4e778d0112fb867161ef4b24103c493e73ce757b (diff) | |
parent | 573f9fd80810dede88587f8ec61fb5cbb4a100b8 (diff) | |
download | tcl-d798be3eaf55726dfd1259cb8f285cecff5ad39c.zip tcl-d798be3eaf55726dfd1259cb8f285cecff5ad39c.tar.gz tcl-d798be3eaf55726dfd1259cb8f285cecff5ad39c.tar.bz2 |
Merge trunk.
Add Gustaf's latest fix for unit-tests.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclDisassemble.c | 8 | ||||
-rw-r--r-- | generic/tclEncoding.c | 17 |
2 files changed, 22 insertions, 3 deletions
diff --git a/generic/tclDisassemble.c b/generic/tclDisassemble.c index 0a325b3..15502e7 100644 --- a/generic/tclDisassemble.c +++ b/generic/tclDisassemble.c @@ -794,6 +794,7 @@ PrintSourceToObj( { register const char *p; register int i = 0, len; + Tcl_UniChar ch = 0; if (stringPtr == NULL) { Tcl_AppendToObj(appendObj, "\"\"", -1); @@ -803,7 +804,6 @@ PrintSourceToObj( Tcl_AppendToObj(appendObj, "\"", -1); p = stringPtr; for (; (*p != '\0') && (i < maxChars); p+=len) { - Tcl_UniChar ch; len = TclUtfToUniChar(p, &ch); switch (ch) { @@ -832,6 +832,12 @@ PrintSourceToObj( i += 2; continue; default: +#if TCL_UTF_MAX > 4 + if ((int) ch > 0xffff) { + Tcl_AppendPrintfToObj(appendObj, "\\U%08x", (int) ch); + i += 10; + } else +#endif if (ch < 0x20 || ch >= 0x7f) { Tcl_AppendPrintfToObj(appendObj, "\\u%04x", ch); i += 6; diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index a7ef199..4ae017d 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -2525,22 +2525,35 @@ 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 > 4 + *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 > 4 + *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; |