Skip to content

Commit beec26b

Browse files
committed
ported ext/zlib
1 parent b9c44ce commit beec26b

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

ext/zlib/php_zlib.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ typedef struct _php_zlib_context {
5050
ZEND_BEGIN_MODULE_GLOBALS(zlib)
5151
/* variables for transparent gzip encoding */
5252
int compression_coding;
53-
long output_compression;
54-
long output_compression_level;
53+
php_int_t output_compression;
54+
php_int_t output_compression_level;
5555
char *output_handler;
5656
php_zlib_context *ob_gzhandler;
57-
long output_compression_default;
57+
php_int_t output_compression_default;
5858
zend_bool handler_registered;
5959
ZEND_END_MODULE_GLOBALS(zlib);
6060

ext/zlib/zlib.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ static PHP_FUNCTION(ob_gzhandler)
448448
{
449449
char *in_str;
450450
int in_len;
451-
long flags = 0;
451+
php_int_t flags = 0;
452452
php_output_context ctx = {0};
453453
int encoding, rv;
454454

@@ -460,7 +460,7 @@ static PHP_FUNCTION(ob_gzhandler)
460460
* - OG(running) is not set or set to any other output handler
461461
* - we have to mess around with php_output_context */
462462

463-
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &in_str, &in_len, &flags)) {
463+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "si", &in_str, &in_len, &flags)) {
464464
RETURN_FALSE;
465465
}
466466

@@ -537,10 +537,10 @@ static PHP_FUNCTION(gzfile)
537537
int flags = REPORT_ERRORS;
538538
char buf[8192] = {0};
539539
register int i = 0;
540-
long use_include_path = 0;
540+
php_int_t use_include_path = 0;
541541
php_stream *stream;
542542

543-
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &filename, &filename_len, &use_include_path)) {
543+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|i", &filename, &filename_len, &use_include_path)) {
544544
return;
545545
}
546546

@@ -578,9 +578,9 @@ static PHP_FUNCTION(gzopen)
578578
int filename_len, mode_len;
579579
int flags = REPORT_ERRORS;
580580
php_stream *stream;
581-
long use_include_path = 0;
581+
php_int_t use_include_path = 0;
582582

583-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
583+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|i", &filename, &filename_len, &mode, &mode_len, &use_include_path) == FAILURE) {
584584
return;
585585
}
586586

@@ -606,9 +606,9 @@ static PHP_FUNCTION(readgzfile)
606606
int flags = REPORT_ERRORS;
607607
php_stream *stream;
608608
int size;
609-
long use_include_path = 0;
609+
php_int_t use_include_path = 0;
610610

611-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &filename, &filename_len, &use_include_path) == FAILURE) {
611+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &filename, &filename_len, &use_include_path) == FAILURE) {
612612
return;
613613
}
614614

@@ -631,19 +631,19 @@ static PHP_FUNCTION(readgzfile)
631631
static PHP_FUNCTION(name) \
632632
{ \
633633
zend_string *in, *out; \
634-
long level = -1; \
635-
long encoding = default_encoding; \
634+
php_int_t level = -1; \
635+
php_int_t encoding = default_encoding; \
636636
if (default_encoding) { \
637-
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ll", &in, &level, &encoding)) { \
637+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|ii", &in, &level, &encoding)) { \
638638
return; \
639639
} \
640640
} else { \
641-
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Sl|l", &in, &encoding, &level)) { \
641+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Si|i", &in, &encoding, &level)) { \
642642
return; \
643643
} \
644644
} \
645645
if (level < -1 || level > 9) { \
646-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%ld) must be within -1..9", level); \
646+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "compression level (%pd) must be within -1..9", level); \
647647
RETURN_FALSE; \
648648
} \
649649
switch (encoding) { \
@@ -667,12 +667,12 @@ static PHP_FUNCTION(name) \
667667
char *in_buf, *out_buf; \
668668
int in_len; \
669669
size_t out_len; \
670-
long max_len = 0; \
671-
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &in_buf, &in_len, &max_len)) { \
670+
php_int_t max_len = 0; \
671+
if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|i", &in_buf, &in_len, &max_len)) { \
672672
return; \
673673
} \
674674
if (max_len < 0) { \
675-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%ld) must be greater or equal zero", max_len); \
675+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "length (%pd) must be greater or equal zero", max_len); \
676676
RETURN_FALSE; \
677677
} \
678678
if (SUCCESS != php_zlib_decode(in_buf, in_len, &out_buf, &out_len, encoding, max_len TSRMLS_CC)) { \

ext/zlib/zlib_fopen_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static size_t php_gziop_write(php_stream *stream, const char *buf, size_t count
5656
return (wrote < 0) ? 0 : wrote;
5757
}
5858

59-
static int php_gziop_seek(php_stream *stream, off_t offset, int whence, off_t *newoffs TSRMLS_DC)
59+
static int php_gziop_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffs TSRMLS_DC)
6060
{
6161
struct php_gz_stream_data_t *self = (struct php_gz_stream_data_t *) stream->abstract;
6262

0 commit comments

Comments
 (0)