summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-08 17:17:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-10-08 17:17:04 (GMT)
commit1f8db5d00d12453d5c3a56488e884b5d2264e72d (patch)
tree8a899cf45b5f2b373fd7e7018c5d13f7192cfe8a /generic/tclIO.c
parente502bcacc7dc47f6a6331b74318e0a6f8d4c9791 (diff)
parent56de8426b72bb8a143b98cd358f3a39cc4dae0f8 (diff)
downloadtcl-1f8db5d00d12453d5c3a56488e884b5d2264e72d.zip
tcl-1f8db5d00d12453d5c3a56488e884b5d2264e72d.tar.gz
tcl-1f8db5d00d12453d5c3a56488e884b5d2264e72d.tar.bz2
Merge 9.0
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index af3243a..57a3994 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4367,7 +4367,10 @@ Write(
if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
statePtr->outputEncodingFlags |= TCL_ENCODING_STRICT;
} else if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) {
+ statePtr->outputEncodingFlags &= ~TCL_ENCODING_STRICT;
statePtr->outputEncodingFlags |= TCL_ENCODING_NOCOMPLAIN;
+ } else {
+ statePtr->outputEncodingFlags &= ~TCL_ENCODING_STRICT;
}
/*
@@ -4694,7 +4697,10 @@ Tcl_GetsObj(
if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
statePtr->inputEncodingFlags |= TCL_ENCODING_STRICT;
} else if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
statePtr->inputEncodingFlags |= TCL_ENCODING_NOCOMPLAIN;
+ } else {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
}
/*
@@ -5462,7 +5468,10 @@ FilterInputBytes(
if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
statePtr->inputEncodingFlags |= TCL_ENCODING_STRICT;
} else if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
statePtr->inputEncodingFlags |= TCL_ENCODING_NOCOMPLAIN;
+ } else {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
}
result = Tcl_ExternalToUtf(NULL, gsPtr->encoding, raw, rawLen,
@@ -6242,11 +6251,13 @@ ReadChars(
* Transfer encoding nocomplain/strict option to the encoding flags
*/
-
if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
statePtr->inputEncodingFlags |= TCL_ENCODING_STRICT;
} else if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
statePtr->inputEncodingFlags |= TCL_ENCODING_NOCOMPLAIN;
+ } else {
+ statePtr->inputEncodingFlags &= ~TCL_ENCODING_STRICT;
}
/*
@@ -8269,6 +8280,14 @@ Tcl_SetChannelOption(
return TCL_ERROR;
}
if (newMode) {
+ if (GotFlag(statePtr, CHANNEL_ENCODING_STRICT)) {
+ if (interp) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-nocomplainencoding cannot be used with -strictencoding",
+ -1));
+ }
+ return TCL_ERROR;
+ }
SetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN);
} else {
ResetFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN);
@@ -8281,9 +8300,17 @@ Tcl_SetChannelOption(
return TCL_ERROR;
}
if (newMode) {
+ if (GotFlag(statePtr, CHANNEL_ENCODING_NOCOMPLAIN)) {
+ if (interp) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(
+ "-strictencoding cannot be used with -nocomplainencoding",
+ -1));
+ }
+ return TCL_ERROR;
+ }
SetFlag(statePtr, CHANNEL_ENCODING_STRICT);
} else {
- ResetFlag(statePtr, CHANNEL_ENCODING_STRICT);
+ ResetFlag(statePtr, CHANNEL_ENCODING_STRICT);
}
return TCL_OK;
} else if (HaveOpt(1, "-translation")) {