From a060bfc83abd3ede4e970cef1959af6d9f75946e Mon Sep 17 00:00:00 2001 From: mdejong Date: Thu, 6 Mar 2003 09:16:12 +0000 Subject: * generic/tclIO.c (Tcl_SetChannelOption): Invoke the Tcl_SetChannelBufferSize method as a result of changing the -buffersize option to fconfigure. The previous implementation used some inlined code that reset the buffer size to the default size instead of ignoring the request as implemented in Tcl_SetChannelBufferSize. * tests/io.test: Update test case so that it actually checks the implementation of Tcl_SetChannelBufferSize. --- ChangeLog | 14 ++++++++++++++ generic/tclIO.c | 8 +++----- tests/io.test | 4 ++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b19b5c6..edcb79d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2003-03-06 Mo DeJong + + * generic/tclIO.c (Tcl_SetChannelOption): + Invoke the Tcl_SetChannelBufferSize method + as a result of changing the -buffersize + option to fconfigure. The previous + implementation used some inlined code that + reset the buffer size to the default size + instead of ignoring the request as + implemented in Tcl_SetChannelBufferSize. + * tests/io.test: Update test case so that + it actually checks the implementation of + Tcl_SetChannelBufferSize. + 2003-03-05 David Gravereaux * win/rules.vc: updated default tcl version to 8.5. diff --git a/generic/tclIO.c b/generic/tclIO.c index 556a2fe..250fd2c 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 2003/02/19 01:04:57 hobbs Exp $ + * RCS: @(#) $Id: tclIO.c,v 1.62 2003/03/06 09:16:19 mdejong Exp $ */ #include "tclInt.h" @@ -6393,10 +6393,8 @@ Tcl_SetChannelOption(interp, chan, optionName, newValue) return TCL_OK; } else if ((len > 7) && (optionName[1] == 'b') && (strncmp(optionName, "-buffersize", len) == 0)) { - statePtr->bufSize = atoi(newValue); /* INTL: "C", UTF safe. */ - if ((statePtr->bufSize < 10) || (statePtr->bufSize > (1024 * 1024))) { - statePtr->bufSize = CHANNELBUFFER_DEFAULT_SIZE; - } + Tcl_SetChannelBufferSize(chan, + atoi(newValue)); /* INTL: "C", UTF safe. */ } else if ((len > 2) && (optionName[1] == 'e') && (strncmp(optionName, "-encoding", len) == 0)) { Tcl_Encoding encoding; diff --git a/tests/io.test b/tests/io.test index d74fa9d..46aaa6c 100644 --- a/tests/io.test +++ b/tests/io.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: io.test,v 1.40 2003/02/25 22:03:38 andreas_kupries Exp $ +# RCS: @(#) $Id: io.test,v 1.41 2003/03/06 09:16:21 mdejong Exp $ if {[catch {package require tcltest 2}]} { puts stderr "Skipping tests in [info script]. tcltest 2 required." @@ -4803,7 +4803,7 @@ test io-38.2 {Tcl_SetChannelBufferSize, Tcl_GetChannelBufferSize} { lappend l [fconfigure $f -buffersize] close $f set l -} {4096 10000 4096 4096 4096 100000 4096} +} {4096 10000 10000 10000 10000 100000 100000} test io-38.3 {Tcl_SetChannelBufferSize, changing buffersize between reads} { # This test crashes the interp if Bug #427196 is not fixed -- cgit v0.12