summaryrefslogtreecommitdiffstats
path: root/generic/tclEncoding.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-26 12:56:18 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-02-26 12:56:18 (GMT)
commit5ffda39949b785859a8ab5b9b4977536dde6f9f2 (patch)
tree42ed69b37fd93b6513996fe23213298eb95ff4e4 /generic/tclEncoding.c
parent2a5b403768444ddf2d6379ffe3644e9d5b230e19 (diff)
downloadtcl-5ffda39949b785859a8ab5b9b4977536dde6f9f2.zip
tcl-5ffda39949b785859a8ab5b9b4977536dde6f9f2.tar.gz
tcl-5ffda39949b785859a8ab5b9b4977536dde6f9f2.tar.bz2
Move the "srcLen -= srcChunkRead;" past the "if ((result != TCL_CONVERT_NOSPACE)..." (where it originally was), since this isn't needed if the loop ends anyway.
Diffstat (limited to 'generic/tclEncoding.c')
-rw-r--r--generic/tclEncoding.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c
index 3a39966..a6ecc26 100644
--- a/generic/tclEncoding.c
+++ b/generic/tclEncoding.c
@@ -1187,7 +1187,7 @@ Tcl_ExternalToUtfDStringEx(
while (1) {
int srcChunkLen, srcChunkRead;
int dstChunkLen, dstChunkWrote, dstChunkChars;
-
+
if (srcLen > INT_MAX) {
srcChunkLen = INT_MAX;
} else {
@@ -1202,7 +1202,6 @@ Tcl_ExternalToUtfDStringEx(
soFar = dst + dstChunkWrote - Tcl_DStringValue(dstPtr);
src += srcChunkRead;
- srcLen -= srcChunkRead;
/*
* Keep looping in two case -
@@ -1210,7 +1209,7 @@ Tcl_ExternalToUtfDStringEx(
* - we had not passed in all the data and error indicated fragment
* of a multibyte character
* In both cases we have to grow buffer, move the input source pointer
- * and loop. Otherwise, return the result we got.
+ * and loop. Otherwise, return the result we got.
*/
if ((result != TCL_CONVERT_NOSPACE) &&
!(result == TCL_CONVERT_MULTIBYTE && (flags & TCL_ENCODING_END))) {
@@ -1219,6 +1218,7 @@ Tcl_ExternalToUtfDStringEx(
}
flags &= ~TCL_ENCODING_START;
+ srcLen -= srcChunkRead;
if (Tcl_DStringLength(dstPtr) == 0) {
Tcl_DStringSetLength(dstPtr, dstLen);
@@ -1460,7 +1460,6 @@ Tcl_UtfToExternalDStringEx(
/* Move past the part processed in this go around */
src += srcChunkRead;
- srcLen -= srcChunkRead;
/*
* Keep looping in two case -
@@ -1468,7 +1467,7 @@ Tcl_UtfToExternalDStringEx(
* - we had not passed in all the data and error indicated fragment
* of a multibyte character
* In both cases we have to grow buffer, move the input source pointer
- * and loop. Otherwise, return the result we got.
+ * and loop. Otherwise, return the result we got.
*/
if ((result != TCL_CONVERT_NOSPACE) &&
!(result == TCL_CONVERT_MULTIBYTE && (flags & TCL_ENCODING_END))) {
@@ -1481,6 +1480,7 @@ Tcl_UtfToExternalDStringEx(
}
flags &= ~TCL_ENCODING_START;
+ srcLen -= srcChunkRead;
if (Tcl_DStringLength(dstPtr) == 0) {
Tcl_DStringSetLength(dstPtr, dstLen);