From fb7b5ca9d3d2253238c7a1923dcb211d5cdee7fb Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 16 Apr 2020 14:05:24 +0000 Subject: small amend combining similar parts --- generic/tclZlib.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 53949a5..b3a6ac2 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -3049,29 +3049,19 @@ ZlibTransformInput( *errorCodePtr = Tcl_GetErrno(); return -1; } - if (readBytes == 0) { - /* - * Eof in parent. - * - * Now this is a bit different. The partial data waiting is - * converted and returned. - */ - if (ResultGenerate(cd, 0, Z_SYNC_FLUSH, errorCodePtr) != TCL_OK) { - return -1; - } - - } else /* readBytes > 0 */ { - /* - * Transform the read chunk, which was not empty. Anything we get - * back is a transformation result to be put into our buffers, and - * the next iteration will put it into the result. - */ + /* + * Transform the read chunk, if not empty. Anything we get + * back is a transformation result to be put into our buffers, and + * the next iteration will put it into the result. + * For the case readBytes is 0 which signaling Eof in parent, the + * partial data waiting is converted and returned. + */ - if (ResultGenerate(cd, readBytes, Z_NO_FLUSH, + if (ResultGenerate(cd, readBytes, + (readBytes != 0) ? Z_NO_FLUSH : Z_SYNC_FLUSH, errorCodePtr) != TCL_OK) { - return -1; - } + return -1; } copyDecompressed: -- cgit v0.12