summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authorferrieux <ferrieux@users.sourceforge.net>2012-04-24 08:55:55 (GMT)
committerferrieux <ferrieux@users.sourceforge.net>2012-04-24 08:55:55 (GMT)
commited76f23a67ff725a3ef859435e72a1d809d53f8e (patch)
tree06aec4c10110301564a8a95d3a5080f61c8f5513 /generic/tclZlib.c
parent3ca91bcffca105a9023965df4a51a84ece77d737 (diff)
parentcc79d413c959197709155dc84b0680e37c20400e (diff)
downloadtcl-ed76f23a67ff725a3ef859435e72a1d809d53f8e.zip
tcl-ed76f23a67ff725a3ef859435e72a1d809d53f8e.tar.gz
tcl-ed76f23a67ff725a3ef859435e72a1d809d53f8e.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 81012dc..341f8e0 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -2495,27 +2495,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;
}