diff options
author | andreas_kupries <andreas_kupries@noemail.net> | 2009-11-12 17:41:29 (GMT) |
---|---|---|
committer | andreas_kupries <andreas_kupries@noemail.net> | 2009-11-12 17:41:29 (GMT) |
commit | 68c8a559b73fe88b6f33549856cdef6b5893f7bc (patch) | |
tree | 762430a7fc603752093d3196463ead7acb41a3c3 /generic/tclIO.c | |
parent | 5fe58b8f70452746360bf8080ff346382f7af71d (diff) | |
download | tcl-68c8a559b73fe88b6f33549856cdef6b5893f7bc.zip tcl-68c8a559b73fe88b6f33549856cdef6b5893f7bc.tar.gz tcl-68c8a559b73fe88b6f33549856cdef6b5893f7bc.tar.bz2 |
* generic/tclIO.c (CopyData): [Bug 2895565]. Dropped bogosity
* tests/io.test: which used the number of _written_ bytes or
character to update the counters for the read bytes/characters.
New test io-53.11. This is a backward port from the 8.5 branch.
FossilOrigin-Name: dd313145946a9c252afd956aa5edd268504b6169
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 11cb205..c6d5c36 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIO.c,v 1.61.2.33 2009/10/23 19:08:45 andreas_kupries Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.61.2.34 2009/11/12 17:41:30 andreas_kupries Exp $ */ #include "tclInt.h" @@ -7936,10 +7936,17 @@ CopyData(csPtr, mask) sizeb = DoWriteChars(outStatePtr->topChanPtr, buffer, sizeb); } - if (inBinary || sameEncoding) { - /* Both read and write counted bytes */ - size = sizeb; - } /* else : Read counted characters, write counted bytes, i.e. size != sizeb */ + /* + * [Bug 2895565]. At this point 'size' still contains the number of + * bytes or characters which have been read. We keep this to later to + * update the totals and toRead information, see marker (UP) below. We + * must not overwrite it with 'sizeb', which is the number of written + * bytes or characters, and both EOL translation and encoding + * conversion may have changed this number unpredictably in relation + * to 'size' (It can be smaller or larger, in the latter case able to + * drive toRead below -1, causing infinite looping). Completely + * unsuitable for updating totals and toRead. + */ if (sizeb < 0) { writeError: |