]> granicus.if.org Git - php/commitdiff
ported ext/zlib
authorAnatol Belski <ab@php.net>
Tue, 19 Aug 2014 09:33:51 +0000 (11:33 +0200)
committerAnatol Belski <ab@php.net>
Tue, 19 Aug 2014 09:33:51 +0000 (11:33 +0200)
ext/zlib/php_zlib.h
ext/zlib/zlib.c
ext/zlib/zlib_fopen_wrapper.c

index bd2a85bea6b02d238a2ed8608bce41cf72fb8c3d..5a2985c11b9f0c42064ff6d90ee147d7d4e6d094 100644 (file)
@@ -50,11 +50,11 @@ typedef struct _php_zlib_context {
 ZEND_BEGIN_MODULE_GLOBALS(zlib)
        /* variables for transparent gzip encoding */
        int compression_coding;
-       long output_compression;
-       long output_compression_level;
+       php_int_t output_compression;
+       php_int_t output_compression_level;
        char *output_handler;
        php_zlib_context *ob_gzhandler;
-       long output_compression_default;
+       php_int_t output_compression_default;
     zend_bool handler_registered;
 ZEND_END_MODULE_GLOBALS(zlib);
 
index cf6a2c5cb746ae82f75eea6f9727086f350ee90f..67f575ec9aed964330fb7f1ee5843def1daadaf9 100644 (file)
@@ -448,7 +448,7 @@ static PHP_FUNCTION(ob_gzhandler)
 {
        char *in_str;
        int in_len;
-       long flags = 0;
+       php_int_t flags = 0;
        php_output_context ctx = {0};
        int encoding, rv;
 
@@ -460,7 +460,7 @@ static PHP_FUNCTION(ob_gzhandler)
         * - OG(running) is not set or set to any other output handler
         * - we have to mess around with php_output_context */
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &in_str, &in_len, &flags)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &in_str, &in_len, &flags)) {
                RETURN_FALSE;
        }
 
@@ -537,10 +537,10 @@ static PHP_FUNCTION(gzfile)
        int flags = REPORT_ERRORS;
        char buf[8192] = {0};
        register int i = 0;
-       long use_include_path = 0;
+       php_int_t use_include_path = 0;
        php_stream *stream;
 
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) {
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &use_include_path)) {
                return;
        }
 
@@ -578,9 +578,9 @@ static PHP_FUNCTION(gzopen)
        int filename_len, mode_len;
        int flags = REPORT_ERRORS;
        php_stream *stream;
-       long use_include_path = 0;
+       php_int_t use_include_path = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
                return;
        }
 
@@ -606,9 +606,9 @@ static PHP_FUNCTION(readgzfile)
        int flags = REPORT_ERRORS;
        php_stream *stream;
        int size;
-       long use_include_path = 0;
+       php_int_t use_include_path = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &filename, &filename_len, &use_include_path) == FAILURE) {
                return;
        }
 
@@ -631,19 +631,19 @@ static PHP_FUNCTION(readgzfile)
 static PHP_FUNCTION(name) \
 { \
        zend_string *in, *out; \
-       long level = -1; \
-       long encoding = default_encoding; \
+       php_int_t level = -1; \
+       php_int_t encoding = default_encoding; \
        if (default_encoding) { \
-               if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &in, &level, &encoding)) { \
+               if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &in, &level, &encoding)) { \
                        return; \
                } \
        } else { \
-               if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &in, &encoding, &level)) { \
+               if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &in, &encoding, &level)) { \
                        return; \
                } \
        } \
        if (level < -1 || level > 9) { \
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%ld) must be within -1..9", level); \
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%pd) must be within -1..9", level); \
                RETURN_FALSE; \
        } \
        switch (encoding) { \
@@ -667,12 +667,12 @@ static PHP_FUNCTION(name) \
        char *in_buf, *out_buf; \
        int in_len; \
        size_t out_len; \
-       long max_len = 0; \
-       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &in_buf, &in_len, &max_len)) { \
+       php_int_t max_len = 0; \
+       if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &in_buf, &in_len, &max_len)) { \
                return; \
        } \
        if (max_len < 0) { \
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%ld) must be greater or equal zero", max_len); \
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%pd) must be greater or equal zero", max_len); \
                RETURN_FALSE; \
        } \
        if (SUCCESS != php_zlib_decode(in_buf, in_len, &out_buf, &out_len, encoding, max_len TSRMLS_CC)) { \
index be0ebd4382c274ab8fca5716507bd67b7473025a..713a6ecfb272ebcd7e1904704315493b285aeb83 100644 (file)
@@ -56,7 +56,7 @@ static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count
        return (wrote < 0) ? 0 : wrote;
 }
 
-static int php_gziop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
+static int php_gziop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
 {
        struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;