]> granicus.if.org Git - php/commitdiff
- avoid a loop around deflate() by using Z_SYNC_FLUSH for standard write
authorMichael Wallner <mike@php.net>
Wed, 30 Aug 2006 12:07:04 +0000 (12:07 +0000)
committerMichael Wallner <mike@php.net>
Wed, 30 Aug 2006 12:07:04 +0000 (12:07 +0000)
ext/zlib/zlib.c

index 2bf592c0631d74fb6e17ff2af2f69d70a2992748..fc99d485f5b3f601cac322076beb7e3d21087afc 100644 (file)
@@ -89,7 +89,7 @@ php_output_handler *php_zlib_output_handler_init(zval *handler_name TSRMLS_DC)
 int php_zlib_output_handler(void **handler_context, php_output_context *output_context)
 {
        php_zlib_context *ctx = *(php_zlib_context **) handler_context;
-       int flags = Z_NO_FLUSH, level;
+       int flags = Z_SYNC_FLUSH, status;
        PHP_OUTPUT_TSRMLS(output_context);
        
        if (!php_zlib_output_encoding(TSRMLS_C)) {
@@ -147,10 +147,10 @@ int php_zlib_output_handler(void **handler_context, php_output_context *output_c
                if (output_context->op & PHP_OUTPUT_HANDLER_FINAL) {
                        flags = Z_FINISH;
                } else if (output_context->op & PHP_OUTPUT_HANDLER_FLUSH) {
-                       flags = Z_SYNC_FLUSH;
+                       flags = Z_FULL_FLUSH;
                }
                
-               switch (deflate(&ctx->Z, flags)) {
+               switch ((status = deflate(&ctx->Z, flags))) {
                        case Z_OK:
                                if (flags == Z_FINISH) {
                                        deflateEnd(&ctx->Z);