diff options
| author | dgp <dgp@users.sourceforge.net> | 2017-11-30 17:52:09 (GMT) |
|---|---|---|
| committer | dgp <dgp@users.sourceforge.net> | 2017-11-30 17:52:09 (GMT) |
| commit | 49e332ded25e7502ce49b62bb7ef6b22cdd2e90f (patch) | |
| tree | 26dbaafb612b99b197231d5759173873cbb1d4e9 /generic/tclStringObj.c | |
| parent | 079887fe42be52a69c2b001ae3efb5dae39862e6 (diff) | |
| parent | db726dc570738b047f110645527b804c3b59d28e (diff) | |
| download | tcl-49e332ded25e7502ce49b62bb7ef6b22cdd2e90f.zip tcl-49e332ded25e7502ce49b62bb7ef6b22cdd2e90f.tar.gz tcl-49e332ded25e7502ce49b62bb7ef6b22cdd2e90f.tar.bz2 | |
merge 8.7
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 926e63c..e5f9e68 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); @@ -1869,20 +1873,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; @@ -1890,7 +1894,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 |
