summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 90451c1..46ebf28 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.9 2005/01/27 22:53:32 andreas_kupries Exp $
+ * RCS: @(#) $Id: tclIO.c,v 1.61.2.10 2005/04/14 07:10:06 davygrvy Exp $
*/
#include "tclInt.h"
@@ -5998,7 +5998,7 @@ Tcl_ChannelBuffered(chan)
* Tcl_SetChannelBufferSize --
*
* Sets the size of buffers to allocate to store input or output
- * in the channel. The size must be between 10 bytes and 1 MByte.
+ * in the channel. The size must be between 1 byte and 1 MByte.
*
* Results:
* None.
@@ -6018,11 +6018,11 @@ Tcl_SetChannelBufferSize(chan, sz)
ChannelState *statePtr; /* State of real channel structure. */
/*
- * If the buffer size is smaller than 10 bytes or larger than one MByte,
+ * If the buffer size is smaller than 1 byte or larger than one MByte,
* do not accept the requested size and leave the current buffer size.
*/
- if (sz < 10) {
+ if (sz < 1) {
return;
}
if (sz > (1024 * 1024)) {
@@ -6473,10 +6473,11 @@ 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;
- }
+ int newBufferSize;
+ if (Tcl_GetInt(interp, newValue, &newBufferSize) == TCL_ERROR) {
+ return TCL_ERROR;
+ }
+ Tcl_SetChannelBufferSize(chan, newBufferSize);
} else if ((len > 2) && (optionName[1] == 'e') &&
(strncmp(optionName, "-encoding", len) == 0)) {
Tcl_Encoding encoding;