diff options
author | dgp <dgp@users.sourceforge.net> | 2017-02-27 15:33:38 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-02-27 15:33:38 (GMT) |
commit | 90fc87af1c68c83ee5f7ea525b5f6df13e18e1e6 (patch) | |
tree | 758f03d3632a69944936628867a9106ca4bec9e3 | |
parent | dc151ef624774207acdd55309d1812f75c528d99 (diff) | |
parent | 0f7d84bbbf23439450bb55a551219457d66fce16 (diff) | |
download | tcl-90fc87af1c68c83ee5f7ea525b5f6df13e18e1e6.zip tcl-90fc87af1c68c83ee5f7ea525b5f6df13e18e1e6.tar.gz tcl-90fc87af1c68c83ee5f7ea525b5f6df13e18e1e6.tar.bz2 |
merge trunk
-rw-r--r-- | generic/tclParse.c | 5 | ||||
-rw-r--r-- | generic/tclZlib.c | 4 | ||||
-rw-r--r-- | tests/zlib.test | 42 |
3 files changed, 48 insertions, 3 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 3a04df4..9b801a3 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -1169,6 +1169,8 @@ ParseTokens( numBytes--; nestedPtr = TclStackAlloc(parsePtr->interp, sizeof(Tcl_Parse)); while (1) { + const char *curEnd; + if (Tcl_ParseCommand(parsePtr->interp, src, numBytes, 1, nestedPtr) != TCL_OK) { parsePtr->errorType = nestedPtr->errorType; @@ -1177,8 +1179,9 @@ ParseTokens( TclStackFree(parsePtr->interp, nestedPtr); return TCL_ERROR; } + curEnd = src + numBytes; src = nestedPtr->commandStart + nestedPtr->commandSize; - numBytes = parsePtr->end - src; + numBytes = curEnd - src; Tcl_FreeParse(nestedPtr); /* diff --git a/generic/tclZlib.c b/generic/tclZlib.c index c231f44..96b8318 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -1204,10 +1204,10 @@ Tcl_ZlibStreamPut( zshPtr->stream.avail_in = size; /* - * Must not do a zero-length compress. [Bug 25842c161] + * Must not do a zero-length compress unless finalizing. [Bug 25842c161] */ - if (size == 0) { + if (size == 0 && flush != Z_FINISH) { return TCL_OK; } diff --git a/tests/zlib.test b/tests/zlib.test index ae8742b..1e69745 100644 --- a/tests/zlib.test +++ b/tests/zlib.test @@ -157,6 +157,48 @@ test zlib-7.8 {zlib stream: Bug b26e38a3e4} -constraints zlib -setup { catch {$strm close} unset -nocomplain randdata data } -result {120185 18003000} +test zlib-7.9 {zlib stream finalize (bug 25842c161)} -constraints zlib -setup { + set z1 [zlib stream gzip] + set z2 [zlib stream gzip] +} -body { + $z1 put ABCDEedbca.. + $z1 finalize + zlib gunzip [$z1 get] +} -cleanup { + $z1 close +} -result ABCDEedbca.. +test zlib-7.10 {zlib stream finalize (bug 25842c161)} -constraints zlib -setup { + set z2 [zlib stream gzip] +} -body { + $z2 put -finalize ABCDEedbca.. + zlib gunzip [$z2 get] +} -cleanup { + $z2 close +} -result ABCDEedbca.. +test zlib-7.11 {zlib stream put -finalize (bug 25842c161)} -constraints zlib -setup { + set c [zlib stream gzip] + set d [zlib stream gunzip] +} -body { + $c put abcdeEDCBA.. + $c finalize + $d put [$c get] + $d finalize + $d get +} -cleanup { + $c close + $d close +} -result abcdeEDCBA.. +test zlib-7.12 {zlib stream put; zlib stream finalize (bug 25842c161)} -constraints zlib -setup { + set c [zlib stream gzip] + set d [zlib stream gunzip] +} -body { + $c put -finalize abcdeEDCBA.. + $d put -finalize [$c get] + $d get +} -cleanup { + $c close + $d close +} -result abcdeEDCBA.. test zlib-8.1 {zlib transformation} -constraints zlib -setup { set file [makeFile {} test.gz] |