jani            Tue May 26 04:45:21 2009 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/zlib   zlib.c 
  Log:
  cs + ws
  
http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib.c?r1=1.183.2.6.2.9&r2=1.183.2.6.2.10&diff_format=u
Index: php-src/ext/zlib/zlib.c
diff -u php-src/ext/zlib/zlib.c:1.183.2.6.2.9 
php-src/ext/zlib/zlib.c:1.183.2.6.2.10
--- php-src/ext/zlib/zlib.c:1.183.2.6.2.9       Thu May 14 16:17:47 2009
+++ php-src/ext/zlib/zlib.c     Tue May 26 04:45:21 2009
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: zlib.c,v 1.183.2.6.2.9 2009/05/14 16:17:47 lbarnaud Exp $ */
+/* $Id: zlib.c,v 1.183.2.6.2.10 2009/05/26 04:45:21 jani Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -34,47 +34,51 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+
 #ifdef PHP_WIN32
-#define O_RDONLY _O_RDONLY
-#include "win32/param.h"
+# define O_RDONLY _O_RDONLY
+# include "win32/param.h"
 #else
-#include <sys/param.h>
+# include <sys/param.h>
 /* #include <sys/uio.h> */
 #endif
+
 #include "ext/standard/head.h"
 #include "safe_mode.h"
 #include "ext/standard/php_standard.h"
 #include "ext/standard/info.h"
 #include "php_zlib.h"
 #include "fopen_wrappers.h"
+
 #if HAVE_PWD_H
-#ifdef PHP_WIN32
-#include "win32/pwd.h"
-#else
-#include <pwd.h>
-#endif
+# ifdef PHP_WIN32
+#  include "win32/pwd.h"
+# else
+#  include <pwd.h>
+# endif
 #endif
+
 #if defined(HAVE_UNISTD_H) && defined(PHP_WIN32)
-#undef HAVE_UNISTD_H
+# undef HAVE_UNISTD_H
 #endif
 
 #ifdef COMPILE_DL_ZLIB
-#ifndef PUTS
-#define PUTS(a) php_printf("%s",a)
-#endif
-#ifndef PUTC
-#define PUTC(a) PUTS(a)
-#endif
-#ifndef PHPWRITE
-#define PHPWRITE(a,n) php_write((a),(n) TSRMLS_CC)
-#endif
+# ifndef PUTS
+#  define PUTS(a) php_printf("%s",a)
+# endif
+# ifndef PUTC
+#  define PUTC(a) PUTS(a)
+# endif
+# ifndef PHPWRITE
+#  define PHPWRITE(a,n) php_write((a),(n) TSRMLS_CC)
+# endif
 #endif
 
 /* Win32 needs some more memory */
 #ifdef PHP_WIN32
-#define PHP_ZLIB_MODIFIER 100
+# define PHP_ZLIB_MODIFIER 100
 #else
-#define PHP_ZLIB_MODIFIER 1000
+# define PHP_ZLIB_MODIFIER 1000
 #endif
 
 #define OS_CODE                        0x03 /* FIXME */
@@ -119,10 +123,10 @@
        PHP_FALIAS(gzwrite,             fwrite,                 NULL)
        PHP_FALIAS(gzputs,              fwrite,                 NULL)
        PHP_FE(gzfile,                                                  NULL)
-       PHP_FE(gzcompress,                              NULL)
-       PHP_FE(gzuncompress,                            NULL)
-       PHP_FE(gzdeflate,                               NULL)
-       PHP_FE(gzinflate,                               NULL)
+       PHP_FE(gzcompress,                                              NULL)
+       PHP_FE(gzuncompress,                                    NULL)
+       PHP_FE(gzdeflate,                                               NULL)
+       PHP_FE(gzinflate,                                               NULL)
        PHP_FE(gzencode,                                                NULL)
        PHP_FE(ob_gzhandler,                                    NULL)
        PHP_FE(zlib_get_coding_type,                    NULL)
@@ -177,7 +181,7 @@
        if (new_value == NULL) {
                return FAILURE;
        }
-       
+
        if (!strncasecmp(new_value, "off", sizeof("off"))) {
                new_value = "0";
                new_value_length = sizeof("0");
@@ -186,7 +190,7 @@
                new_value_length = sizeof("1");
        }
 
-       ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 
0); 
+       ini_value = zend_ini_string("output_handler", sizeof("output_handler"), 
0);
        if (ini_value != NULL && strlen(ini_value) != 0 && zend_atoi(new_value, 
new_value_length) != 0) {
                php_error_docref("ref.outcontrol" TSRMLS_CC, E_CORE_ERROR, 
"Cannot use both zlib.output_compression and output_handler together!!");
                return FAILURE;
@@ -274,7 +278,7 @@
 {
        php_unregister_url_stream_wrapper("zlib" TSRMLS_CC);
        php_stream_filter_unregister_factory("zlib.*" TSRMLS_CC);
-       
+
        UNREGISTER_INI_ENTRIES();
 
        return SUCCESS;
@@ -331,7 +335,7 @@
        while (php_stream_gets(stream, buf, sizeof(buf) - 1) != NULL) {
                if (PG(magic_quotes_runtime)) {
                        int len;
-                       
+
                        slashed = php_addslashes(buf, 0, &len, 0 TSRMLS_CC); /* 
0 = don't free source string */
                        add_index_stringl(return_value, i++, slashed, len, 0);
                } else {
@@ -351,7 +355,7 @@
        long flags = 0;
        php_stream *stream;
        int use_include_path = 0;
-       
+
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, 
&filename_len, &mode, &mode_len, &flags) == FAILURE) {
                return;
        }
@@ -364,7 +368,7 @@
                RETURN_FALSE;
        }
        php_stream_to_zval(stream, return_value);
-}      
+}
 /* }}} */
 
 /*
@@ -380,7 +384,7 @@
        php_stream *stream;
        int size;
        int use_include_path = 0;
-       
+
        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, 
&filename_len, &flags) == FAILURE) {
                return;
        }
@@ -392,12 +396,12 @@
                RETURN_FALSE;
        }
        size = php_stream_passthru(stream);
-       php_stream_close(stream);
+       php_stream_close(stream);
        RETURN_LONG(size);
 }
 /* }}} */
 
-/* {{{ proto string gzcompress(string data [, int level]) 
+/* {{{ proto string gzcompress(string data [, int level])
    Gzip-compress a string */
 static PHP_FUNCTION(gzcompress)
 {
@@ -420,13 +424,13 @@
        if (!s2) {
                RETURN_FALSE;
        }
-               
+
        if (level >= 0) {
                status = compress2(s2, &l2, data, data_len, level);
        } else {
                status = compress(s2, &l2, data, data_len);
        }
-       
+
        if (status == Z_OK) {
                s2 = erealloc(s2, l2 + 1);
                s2[l2] = '\0';
@@ -439,7 +443,7 @@
 }
 /* }}} */
 
-/* {{{ proto string gzuncompress(string data [, int length]) 
+/* {{{ proto string gzuncompress(string data [, int length])
    Unzip a gzip-compressed string */
 static PHP_FUNCTION(gzuncompress)
 {
@@ -464,7 +468,7 @@
         if none was given as a parameter
         we try from input length * 2 up to input length * 2^15
         doubling it whenever it wasn't big enough
-        that should be eneugh for all real life cases  
+        that should be eneugh for all real life cases
        */
        do {
                length = plength ? plength : (unsigned long)data_len * (1 << 
factor++);
@@ -485,7 +489,7 @@
 }
 /* }}} */
 
-/* {{{ proto string gzdeflate(string data [, int level]) 
+/* {{{ proto string gzdeflate(string data [, int level])
    Gzip-compress a string */
 static PHP_FUNCTION(gzdeflate)
 {
@@ -517,7 +521,7 @@
        if (!s2) {
                RETURN_FALSE;
        }
-       
+
        stream.next_out = s2;
 
        /* init with -MAX_WBITS disables the zlib internal headers */
@@ -546,7 +550,7 @@
 }
 /* }}} */
 
-/* {{{ proto string gzinflate(string data [, int length]) 
+/* {{{ proto string gzinflate(string data [, int length])
    Unzip a gzip-compressed string */
 static PHP_FUNCTION(gzinflate)
 {
@@ -590,7 +594,7 @@
          if none was given as a parameter
          we try from input length * 2 up to input length * 2^15
          doubling it whenever it wasn't big enough
-         that should be enaugh for all real life cases 
+         that should be enaugh for all real life cases
        */
        do {
                length = plength ? plength : (unsigned long)data_len * (1 << 
factor++);
@@ -660,7 +664,7 @@
        } else {
                buffer = *p_buffer;
        }
-       
+
        ZLIBG(stream).next_out = buffer + start_offset;
        ZLIBG(stream).avail_out = outlen;
 
@@ -671,7 +675,7 @@
                if ((outlen + start_offset + end_offset) > *p_buffer_len) {
                        buffer = erealloc(buffer, outlen + start_offset + 
end_offset);
                }
-               
+
                ZLIBG(stream).next_out = buffer + start_offset + prev_outlen;
                ZLIBG(stream).avail_out = prev_outlen * 2;
 
@@ -708,7 +712,7 @@
                                        /* TODO: print out error */
                                        return FAILURE;
                                }
-               
+
                                ZLIBG(crc) = crc32(0L, Z_NULL, 0);
                                break;
 
@@ -717,7 +721,7 @@
                                        /* TODO: print out error */
                                        return FAILURE;
                                }
-                               break;          
+                               break;
                }
        }
 
@@ -813,14 +817,14 @@
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"%s", zError(status));
                                RETURN_FALSE;
                        }
-               
+
                        break;
                case CODING_DEFLATE:
                        if ((status = deflateInit(&stream, level)) != Z_OK) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"%s", zError(status));
                                RETURN_FALSE;
                        }
-                       break;          
+                       break;
        }
 
        status = deflate(&stream, Z_FINISH);
@@ -854,7 +858,7 @@
                        trailer[7] = (char) (stream.total_in >> 24) & 0xFF;
                        trailer[8] = '\0';
                } else {
-                       s2[stream.total_out + GZIP_HEADER_LENGTH + (coding == 
CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)] = '\0'; 
+                       s2[stream.total_out + GZIP_HEADER_LENGTH + (coding == 
CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)] = '\0';
                }
                RETURN_STRINGL(s2, stream.total_out + GZIP_HEADER_LENGTH + 
(coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0), 0);
        } else {
@@ -908,8 +912,9 @@
                return;
        }
 
-       if(ZLIBG(ob_gzhandler_status) == -1)
+       if (ZLIBG(ob_gzhandler_status) == -1) {
                RETURN_FALSE;
+       }
 
        zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
 
@@ -929,7 +934,7 @@
                ZLIBG(ob_gzhandler_status) = -1;
                RETURN_FALSE;
        }
-       
+
        do_start = ((mode & PHP_OUTPUT_HANDLER_START) ? 1 : 0);
        do_end = ((mode & PHP_OUTPUT_HANDLER_END) ? 1 : 0);
        Z_STRVAL_P(return_value) = NULL;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to