diff options
author | hobbs <hobbs> | 2002-03-02 04:55:31 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-03-02 04:55:31 (GMT) |
commit | 56a57cbad4a080e6df254ee672e523bb43601e0e (patch) | |
tree | 10a18af18d6779d1e9c896f15db41ad52cfa110b /generic/tclIO.c | |
parent | 014b57a7c7744b4fd118db134a86a5557fdd6437 (diff) | |
download | tcl-56a57cbad4a080e6df254ee672e523bb43601e0e.zip tcl-56a57cbad4a080e6df254ee672e523bb43601e0e.tar.gz tcl-56a57cbad4a080e6df254ee672e523bb43601e0e.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.
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 |