diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2023-03-09 10:47:12 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2023-03-09 10:47:12 (GMT) |
commit | 56f5c7751c0f9e4da9c1a40ee533ce392a43e4a2 (patch) | |
tree | 5188e177560deadea8ae811e8af440dd301deda3 /generic/tclIO.c | |
parent | 9f1cf8d5eff18f24ea27e9df3692318673bed932 (diff) | |
download | tcl-56f5c7751c0f9e4da9c1a40ee533ce392a43e4a2.zip tcl-56f5c7751c0f9e4da9c1a40ee533ce392a43e4a2.tar.gz tcl-56f5c7751c0f9e4da9c1a40ee533ce392a43e4a2.tar.bz2 |
Fix SetChannelOption parsing of -encoding* to match GetChannelOption
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r-- | generic/tclIO.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 97ca8d0..4a6dbf4 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -8194,7 +8194,7 @@ Tcl_SetChannelOption( } Tcl_SetChannelBufferSize(chan, newBufferSize); return TCL_OK; - } else if (HaveOpt(2, "-encoding")) { + } else if (HaveOpt(8, "-encoding")) { Tcl_Encoding encoding; int profile; @@ -8230,6 +8230,15 @@ Tcl_SetChannelOption( ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR); UpdateInterest(chanPtr); return TCL_OK; + } else if (HaveOpt(9, "-encodingprofile")) { + int profile; + if (TclEncodingProfileNameToId(interp, newValue, &profile) != TCL_OK) { + return TCL_ERROR; + } + TCL_ENCODING_PROFILE_SET(statePtr->inputEncodingFlags, profile); + TCL_ENCODING_PROFILE_SET(statePtr->outputEncodingFlags, profile); + ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR); + return TCL_OK; } else if (HaveOpt(2, "-eofchar")) { if (!newValue[0] || (!(newValue[0] & 0x80) && !newValue[1])) { if (GotFlag(statePtr, TCL_READABLE)) { @@ -8285,15 +8294,6 @@ Tcl_SetChannelOption( ResetFlag(statePtr, CHANNEL_EOF|CHANNEL_STICKY_EOF|CHANNEL_BLOCKED); statePtr->inputEncodingFlags &= ~TCL_ENCODING_END; return TCL_OK; - } else if (HaveOpt(1, "-encodingprofile")) { - int profile; - if (TclEncodingProfileNameToId(interp, newValue, &profile) != TCL_OK) { - return TCL_ERROR; - } - TCL_ENCODING_PROFILE_SET(statePtr->inputEncodingFlags, profile); - TCL_ENCODING_PROFILE_SET(statePtr->outputEncodingFlags, profile); - ResetFlag(statePtr, CHANNEL_NEED_MORE_DATA|CHANNEL_ENCODING_ERROR); - return TCL_OK; } else if (HaveOpt(1, "-translation")) { const char *readMode, *writeMode; |