diff options
author | dgp <dgp@users.sourceforge.net> | 2014-11-15 21:13:52 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-11-15 21:13:52 (GMT) |
commit | f04588b905d72636d0d4a76b907d02a4368592eb (patch) | |
tree | 4b80554abe482325f492c54d6b18e6abb3543dd0 /generic/tclIO.c | |
parent | 55688af5e97888536930067e5e23a686661a0b1c (diff) | |
download | tcl-f04588b905d72636d0d4a76b907d02a4368592eb.zip tcl-f04588b905d72636d0d4a76b907d02a4368592eb.tar.gz tcl-f04588b905d72636d0d4a76b907d02a4368592eb.tar.bz2 |
With no padding needed for a terminating NUL, there no need for a distinction
between the dstNeeded and dstLimit values.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index b759c0e..f8b9bfa 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -5929,7 +5929,7 @@ ReadChars( int savedIEFlags = statePtr->inputEncodingFlags; int savedFlags = statePtr->flags; char *dst, *src = RemovePoint(bufPtr); - int dstLimit, numBytes, srcLen = BytesLeft(bufPtr); + int numBytes, srcLen = BytesLeft(bufPtr); /* * One src byte can yield at most one character. So when the @@ -5948,14 +5948,14 @@ ReadChars( */ int factor = *factorPtr; - int dstNeeded = TCL_UTF_MAX - 1 + toRead * factor / UTF_EXPANSION_FACTOR; + int dstLimit = TCL_UTF_MAX - 1 + toRead * factor / UTF_EXPANSION_FACTOR; (void) TclGetStringFromObj(objPtr, &numBytes); - Tcl_AppendToObj(objPtr, NULL, dstNeeded); + Tcl_AppendToObj(objPtr, NULL, dstLimit); if (toRead == srcLen) { unsigned int size; dst = TclGetStringStorage(objPtr, &size) + numBytes; - dstNeeded = size - numBytes; + dstLimit = size - numBytes; } else { dst = TclGetString(objPtr) + numBytes; } @@ -5976,7 +5976,6 @@ ReadChars( * a consistent set of results. This takes the shape of a loop. */ - dstLimit = dstNeeded; while (1) { int dstDecoded, dstRead, dstWrote, srcRead, numChars; |