diff options
author | hobbs <hobbs@noemail.net> | 2002-03-02 04:55:30 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2002-03-02 04:55:30 (GMT) |
commit | 7b0d848a9a08f9715e523c9a3fe4c6618b586388 (patch) | |
tree | 10a18af18d6779d1e9c896f15db41ad52cfa110b /generic/tclIO.c | |
parent | 95325f8039322971ad9392e8fa05f04b71605860 (diff) | |
download | tcl-7b0d848a9a08f9715e523c9a3fe4c6618b586388.zip tcl-7b0d848a9a08f9715e523c9a3fe4c6618b586388.tar.gz tcl-7b0d848a9a08f9715e523c9a3fe4c6618b586388.tar.bz2 |
* tests/encoding.test: added encoding-23.* tests
* generic/tclIO.c (FilterInputBytes): reset the TCL_ENCODING_START
flags in the ChannelState when using 'gets'. [Bug #523988]
Also reduced the value of ENCODING_LINESIZE from 30 to 20 as this
seems to improve the performance of 'gets' according to tclbench.
FossilOrigin-Name: 53ae028f580704ebc7ea128bb94913d8ab77fea7
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index df8a8c2..cefab6c 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.52 2002/02/15 14:28:49 dkf Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.53 2002/03/02 04:55:31 hobbs Exp $ */ #include "tclInt.h" @@ -3777,7 +3777,7 @@ FilterInputBytes(chanPtr, gsPtr) char *dst; int offset, toRead, dstNeeded, spaceLeft, result, rawLen, length; Tcl_Obj *objPtr; -#define ENCODING_LINESIZE 30 /* Lower bound on how many bytes to convert +#define ENCODING_LINESIZE 20 /* Lower bound on how many bytes to convert * at a time. Since we don't know a priori * how many bytes of storage this many source * bytes will use, we actually need at least @@ -3806,7 +3806,7 @@ FilterInputBytes(chanPtr, gsPtr) * seen EOL. Need to read more bytes from the channel device. * Side effect is to allocate another channel buffer. */ - + read: if (statePtr->flags & CHANNEL_BLOCKED) { if (statePtr->flags & CHANNEL_NONBLOCKING) { @@ -3859,7 +3859,14 @@ FilterInputBytes(chanPtr, gsPtr) result = Tcl_ExternalToUtf(NULL, gsPtr->encoding, raw, rawLen, statePtr->inputEncodingFlags, &statePtr->inputEncodingState, dst, spaceLeft, &gsPtr->rawRead, &gsPtr->bytesWrote, - &gsPtr->charsWrote); + &gsPtr->charsWrote); + + /* + * Make sure that if we go through 'gets', that we reset the + * TCL_ENCODING_START flag still. [Bug #523988] + */ + statePtr->inputEncodingFlags &= ~TCL_ENCODING_START; + if (result == TCL_CONVERT_MULTIBYTE) { /* * The last few bytes in this channel buffer were the start of a |