Skip to content

Commit

Permalink
mistake
Browse files Browse the repository at this point in the history
  • Loading branch information
oehhar committed Aug 18, 2022
1 parent dc70947 commit 23d16fb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
27 changes: 26 additions & 1 deletion generic/tclIO.c
Original file line number Diff line number Diff line change
Expand Up @@ -7905,7 +7905,20 @@ Tcl_GetChannelOption(
return TCL_OK;
}
}
if (len == 0 || HaveOpt(1, "-translation")) {
if (len == 0 || HaveOpt(2, "-tolerantencoding")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-tolerantencoding");
}
Tcl_DStringAppendElement(dsPtr,
(flags & CHANNEL_TOLERANT_ENCODING) ? "1" : "0");
if (len > 0) {
return TCL_OK;
}
if (len > 0) {
return TCL_OK;
}
}
if (len == 0 || HaveOpt(2, "-translation")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-translation");
}
Expand Down Expand Up @@ -8158,6 +8171,18 @@ Tcl_SetChannelOption(
ResetFlag(statePtr, CHANNEL_EOF|CHANNEL_STICKY_EOF|CHANNEL_BLOCKED);
statePtr->inputEncodingFlags &= ~TCL_ENCODING_END;
return TCL_OK;
} else if (HaveOpt(2, "-tolerantencoding")) {
int newMode;

if (Tcl_GetBoolean(interp, newValue, &newMode) == TCL_ERROR) {
return TCL_ERROR;
}
if (newMode) {
statePtr->flags |= CHANNEL_TOLERANT_ENCODING;
} else {
statePtr->flags &= ~CHANNEL_TOLERANT_ENCODING;
}
return TCL_OK;
} else if (HaveOpt(1, "-translation")) {
const char *readMode, *writeMode;

Expand Down
2 changes: 2 additions & 0 deletions generic/tclIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ typedef struct ChannelState {
* changes. */
#define CHANNEL_RAW_MODE (1<<16) /* When set, notes that the Raw API is
* being used. */
#define CHANNEL_TOLERANT_ENCODING (1<<17) /* set if option -tolerantencoding
* is set to 1 */

#define CHANNEL_INCLOSE (1<<19) /* Channel is currently being closed.
* Its structures are still live and
Expand Down

0 comments on commit 23d16fb

Please sign in to comment.