From 951e89371632e61ed06ddd97b090f4e3b7c36851 Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 15 Apr 2020 18:59:00 +0000 Subject: TclTrimRight/TclTrimLeft: removed mixed declarations and code (forbidden in ISO C90, declaration-after-statement); restored mistakenly removed part of check-in [578c25b43a] (move Tcl_UniChar initializations out of the loop), but "ch2" belongs to the inner loop, so move it inside outer interation. --- generic/tclUtil.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d7d6134..2c20831 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -1686,12 +1686,12 @@ TclTrimRight( * rely on (trim[numTrim] == '\0'). */ { const char *pp, *p = bytes + numBytes; + Tcl_UniChar ch1 = 0; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { return 0; } - Tcl_UniChar ch1 = 0, ch2 = 0; /* * Outer loop: iterate over string to be trimmed. @@ -1700,6 +1700,7 @@ TclTrimRight( do { const char *q = trim; int pInc = 0, bytesLeft = numTrim; + Tcl_UniChar ch2 = 0; pp = Tcl_UtfPrev(p, bytes); do { @@ -1765,6 +1766,7 @@ TclTrimLeft( * rely on (trim[numTrim] == '\0'). */ { const char *p = bytes; + Tcl_UniChar ch1 = 0; /* Empty strings -> nothing to do */ if ((numBytes == 0) || (numTrim == 0)) { @@ -1776,7 +1778,7 @@ TclTrimLeft( */ do { - Tcl_UniChar ch1 = 0; + Tcl_UniChar ch2 = 0; int pInc = TclUtfToUniChar(p, &ch1); const char *q = trim; int bytesLeft = numTrim; @@ -1786,7 +1788,6 @@ TclTrimLeft( */ do { - Tcl_UniChar ch2 = 0; int qInc = TclUtfToUniChar(q, &ch2); if (ch1 == ch2) { -- cgit v0.12 From 6422781fdc73ec84db06ad3611a4a1676b4cb2eb Mon Sep 17 00:00:00 2001 From: sebres Date: Wed, 15 Apr 2020 19:06:38 +0000 Subject: fixes bug [8af92dfb66]: resolve too earlier stop of inflate's cycle (if generating decompressed data on flush case of full buffer) --- generic/tclZlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generic/tclZlib.c b/generic/tclZlib.c index aed38c3..002c6ae 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3832,7 +3832,7 @@ ResultGenerate( if (((flush == Z_SYNC_FLUSH) && (e == Z_BUF_ERROR)) || (e == Z_STREAM_END) - || (e == Z_OK && cd->inStream.avail_out == 0)) { + || (e == Z_OK && written == 0)) { return TCL_OK; } -- cgit v0.12