summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>1999-01-06 22:56:24 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>1999-01-06 22:56:24 (GMT)
commit6892aa372de9852fabbcb0d1f005493ac8035345 (patch)
treef5685c88c50e0e968ac375f1cbf749369b67a209
parent015f22a0fa6b2f818300bc35ccfd2be05b126933 (diff)
downloadcpython-6892aa372de9852fabbcb0d1f005493ac8035345.zip
cpython-6892aa372de9852fabbcb0d1f005493ac8035345.tar.gz
cpython-6892aa372de9852fabbcb0d1f005493ac8035345.tar.bz2
fix bug in PyZlib_flush.
patch from Grzegorz Makarewicz & Rafal Smotrzyk.
-rw-r--r--Modules/zlibmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
index 5afa709..9402e99 100644
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -530,7 +530,7 @@ PyZlib_flush(self, args)
/* When flushing the zstream, there's no input data.
If zst.avail_out == 0, that means that more output space is
needed to complete the flush operation. */
- do {
+ while (err == Z_OK) {
err = deflate(&(self->zst), Z_FINISH);
if (self->zst.avail_out <= 0) {
if (_PyString_Resize(&RetVal, length << 1) == -1) {
@@ -542,9 +542,9 @@ PyZlib_flush(self, args)
self->zst.avail_out = length;
length = length << 1;
}
- } while (self->zst.avail_out == 0);
+ }
- if (err!=Z_OK && err != Z_STREAM_END)
+ if (err != Z_STREAM_END)
{
if (self->zst.msg == Z_NULL)
PyErr_Format(ZlibError, "Error %i while flushing",
@@ -554,7 +554,7 @@ PyZlib_flush(self, args)
err, self->zst.msg);
Py_DECREF(RetVal);
return NULL;
- }
+ }
if (flushmode == Z_FINISH) {
err=deflateEnd(&(self->zst));
if (err!=Z_OK) {