From 9576a35d027d090713bbf5755909b567c55271b1 Mon Sep 17 00:00:00 2001 From: pooryorick Date: Tue, 28 Mar 2023 19:29:21 +0000 Subject: Combine two branches in write(). --- generic/tclIO.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/generic/tclIO.c b/generic/tclIO.c index 5414e73..ca6cb84 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -4422,19 +4422,17 @@ Write( * current output encoding and strict encoding is active. */ - if (result == TCL_CONVERT_UNKNOWN || result == TCL_CONVERT_SYNTAX) { - encodingError = 1; - result = TCL_OK; - } - - if ((result != TCL_OK) && (srcRead + dstWrote == 0)) { + if ( + (result == TCL_CONVERT_UNKNOWN || result == TCL_CONVERT_SYNTAX) + || /* * We're reading from invalid/incomplete UTF-8. */ - + ((result != TCL_OK) && (srcRead + dstWrote == 0)) + ) { encodingError = 1; result = TCL_OK; - } + } bufPtr->nextAdded += dstWrote; src += srcRead; -- cgit v0.12