diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2012-04-15 10:12:18 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2012-04-15 10:12:18 (GMT) |
| commit | 017b7c16668a95ea22110cbc4d2c0fd6f5cf594c (patch) | |
| tree | f0aa1e792f906fb30056c652360718f6f597e9a9 /generic/tclZlib.c | |
| parent | aa817417d8893ac39d47a29dd4c8af0a6972d212 (diff) | |
| parent | b9f0407e01670f181327ce62eef0ca1da0383268 (diff) | |
| download | tcl-017b7c16668a95ea22110cbc4d2c0fd6f5cf594c.zip tcl-017b7c16668a95ea22110cbc4d2c0fd6f5cf594c.tar.gz tcl-017b7c16668a95ea22110cbc4d2c0fd6f5cf594c.tar.bz2 | |
merge trunk
Diffstat (limited to 'generic/tclZlib.c')
| -rw-r--r-- | generic/tclZlib.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 068308a..9b231df 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -2691,27 +2691,29 @@ ZlibTransformSetOption( /* not used */ */ cd->outStream.avail_in = 0; - do { + while (1) { int e; cd->outStream.next_out = (Bytef *) cd->outBuffer; cd->outStream.avail_out = cd->outAllocated; e = deflate(&cd->outStream, flushType); - if (e != Z_OK) { + if (e == Z_BUF_ERROR) { + break; + } else if (e != Z_OK) { ConvertError(interp, e); return TCL_ERROR; + } else if (cd->outStream.avail_out == 0) { + break; } - if (cd->outStream.avail_out > 0) { - if (Tcl_WriteRaw(cd->parent, cd->outBuffer, - PTR2INT(cd->outStream.next_out)) < 0) { - Tcl_AppendResult(interp, "problem flushing channel: ", - Tcl_PosixError(interp), NULL); - return TCL_ERROR; - } + if (Tcl_WriteRaw(cd->parent, cd->outBuffer, + cd->outStream.next_out - (Bytef*)cd->outBuffer) < 0) { + Tcl_AppendResult(interp, "problem flushing channel: ", + Tcl_PosixError(interp), NULL); + return TCL_ERROR; } - } while (cd->outStream.avail_out > 0); + } return TCL_OK; } |
