diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-01 15:03:46 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2017-12-01 15:03:46 (GMT) |
| commit | 71c032c81630285df2581432aeb509295fbb39ed (patch) | |
| tree | d7736549826d2697b558a2db03759c1f7e3f3524 /generic/tclStringObj.c | |
| parent | 4bf4b7d35c401066e61ad2ce1d21b04709a57938 (diff) | |
| parent | 200910b9c19ac1986d28677de7b427ee774d8e40 (diff) | |
| download | tcl-71c032c81630285df2581432aeb509295fbb39ed.zip tcl-71c032c81630285df2581432aeb509295fbb39ed.tar.gz tcl-71c032c81630285df2581432aeb509295fbb39ed.tar.bz2 | |
merge trunk
Diffstat (limited to 'generic/tclStringObj.c')
| -rw-r--r-- | generic/tclStringObj.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 380bec1..269131a 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -418,12 +418,16 @@ Tcl_GetCharLength( } /* - * Optimize the case where we're really dealing with a bytearray object - * without string representation; we don't need to convert to a string to - * perform the get-length operation. + * Optimize the case where we're really dealing with a bytearray object; + * we don't need to convert to a string to perform the get-length operation. + * + * NOTE that we do not need the bytearray to be "pure". A ByteArray value + * with a string rep cannot be trusted to represent the same value as the + * string rep, but it *can* be trusted to have the same character length + * as the string rep, which is all this routine cares about. */ - if (TclIsPureByteArray(objPtr)) { + if (objPtr->typePtr == &tclByteArrayType) { int length; (void) Tcl_GetByteArrayFromObj(objPtr, &length); @@ -1824,20 +1828,20 @@ Tcl_AppendFormatToObj( } else if (ch == 'I') { if ((format[1] == '6') && (format[2] == '4')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif } else if ((format[1] == '3') && (format[2] == '2')) { format += (step + 2); - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } else { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); } } else if ((ch == 't') || (ch == 'z')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG if (sizeof(size_t) > sizeof(int)) { useWide = 1; @@ -1845,7 +1849,7 @@ Tcl_AppendFormatToObj( #endif } else if ((ch == 'q') ||(ch == 'j')) { format += step; - step = Tcl_UtfToUniChar(format, &ch); + step = TclUtfToUniChar(format, &ch); #ifndef TCL_WIDE_INT_IS_LONG useWide = 1; #endif |
