summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--PHPINFO10
-rw-r--r--REFLECTION62
-rw-r--r--php-xz.spec191
-rw-r--r--pr1.patch75
-rw-r--r--pr2.patch82
-rw-r--r--pr3.patch157
8 files changed, 590 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..5149fd8
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,10 @@
+
+xz
+
+xz support => enabled
+xz extension version => 1.1.1
+liblzma version => 5.2.5
+
+Directive => Local Value => Master Value
+xz.compression_level => 5 => 5
+xz.max_memory => 0 => 0
diff --git a/REFLECTION b/REFLECTION
new file mode 100644
index 0000000..dde87e2
--- /dev/null
+++ b/REFLECTION
@@ -0,0 +1,62 @@
+Extension [ <persistent> extension #108 xz version 1.1.1 ] {
+
+ - INI {
+ Entry [ xz.compression_level <ALL> ]
+ Current = '5'
+ }
+ Entry [ xz.max_memory <SYSTEM> ]
+ Current = '0'
+ }
+ }
+
+ - Functions {
+ Function [ <internal:xz> function xzdecode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $str ]
+ }
+ }
+ Function [ <internal:xz> function xzopen ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> $filename ]
+ Parameter #1 [ <required> $mode ]
+ Parameter #2 [ <optional> $compression_level ]
+ }
+ }
+ Function [ <internal:xz> function xzencode ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $str ]
+ }
+ }
+ Function [ <internal:xz> function xzread ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> $fp ]
+ Parameter #1 [ <required> $length ]
+ }
+ }
+ Function [ <internal:xz> function xzwrite ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> $fp ]
+ Parameter #1 [ <required> $str ]
+ Parameter #2 [ <optional> $length ]
+ }
+ }
+ Function [ <internal:xz> function xzclose ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $fp ]
+ }
+ }
+ Function [ <internal:xz> function xzpassthru ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> $fp ]
+ }
+ }
+ }
+}
+
diff --git a/php-xz.spec b/php-xz.spec
new file mode 100644
index 0000000..68fa9fd
--- /dev/null
+++ b/php-xz.spec
@@ -0,0 +1,191 @@
+# remirepo spec file for php-xz
+#
+# Copyright (c) 2021 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+# we don't want -z defs linker flag
+%undefine _strict_symbol_defs_build
+
+%if 0%{?scl:1}
+%scl_package php-xz
+%else
+%global pkg_name %{name}
+%endif
+
+%global gh_commit 84e8742a9a7cdb985190a02f270298efcf264c21
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner codemasher
+%global gh_project php-ext-xz
+%global pecl_name xz
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
+%global ini_name 40-%{pecl_name}.ini
+
+Summary: XZ (LZMA2) compression/decompression
+Name: %{?scl_prefix}php-%{pecl_name}
+Version: 1.1.1
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+License: PHP
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
+
+# library check
+Patch0: pr1.patch
+# extension version
+Patch1: pr2.patch
+# arginfo
+Patch2: pr3.patch
+
+BuildRequires: make
+BuildRequires: %{?dtsprefix}gcc
+BuildRequires: %{?scl_prefix}php-devel
+BuildRequires: pkgconfig(liblzma)
+
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
+
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{php_version}" > "7.3"
+Obsoletes: php73-%{pecl_name} <= %{version}
+%endif
+%if "%{php_version}" > "7.4"
+Obsoletes: php74-%{pecl_name} <= %{version}
+%endif
+%if "%{php_version}" > "8.0"
+Obsoletes: php80-%{pecl_name} <= %{version}
+%endif
+%if "%{php_version}" > "8.1"
+Obsoletes: php81-%{pecl_name} <= %{version}
+%endif
+%endif
+
+
+%description
+PHP Extension providing XZ (LZMA2) compression/decompression functions.
+
+Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.
+
+
+%prep
+%setup -qc
+mv %{gh_project}-%{gh_commit} NTS
+
+cd NTS
+mv LICENSE.txt LICENSE
+%patch0 -p1 -b .pr1
+%patch1 -p1 -b .pr2
+%patch2 -p1 -b .pr3
+
+# Sanity check, really often broken
+extver=$(sed -n '/#define PHP_XZ_VERSION/{s/.* "//;s/".*$//;p}' php_xz.h)
+if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}%{?gh_date:-dev}.
+ exit 1
+fi
+cd ..
+
+%if %{with_zts}
+# duplicate for ZTS build
+cp -pr NTS ZTS
+%endif
+
+# Drop in the bit of configuration
+cat << 'EOF' | tee %{ini_name}
+; Enable '%{summary}' extension module
+extension = %{pecl_name}.so
+
+; Configuration
+;xz.compression_level = 5
+;xz.max_memory = 0
+EOF
+
+
+%build
+%{?dtsenable}
+
+cd NTS
+%{_bindir}/phpize
+%configure \
+ --with-php-config=%{_bindir}/php-config \
+ --with-libdir=%{_lib} \
+ --with-xz
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+%configure \
+ --with-php-config=%{_bindir}/zts-php-config \
+ --with-libdir=%{_lib} \
+ --with-xz
+make %{?_smp_mflags}
+%endif
+
+
+%install
+%{?dtsenable}
+
+# Install the NTS stuff
+make -C NTS install INSTALL_ROOT=%{buildroot}
+install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
+
+%if %{with_zts}
+# Install the ZTS stuff
+make -C ZTS install INSTALL_ROOT=%{buildroot}
+install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
+%endif
+
+
+
+%check
+cd NTS
+: Minimal load test for NTS extension
+%{__php} --no-php-ini \
+ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
+ --modules | grep '^%{pecl_name}$'
+
+: Upstream test suite for NTS extension
+TEST_PHP_EXECUTABLE=%{__php} \
+TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
+REPORT_EXIT_STATUS=1 \
+%{__php} -n run-tests.php -q --offline --show-diff
+
+%if %{with_zts}
+cd ../ZTS
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
+ --modules | grep '^%{pecl_name}$'
+
+: Upstream test suite for ZTS extension
+TEST_PHP_EXECUTABLE=%{__ztsphp} \
+TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \
+REPORT_EXIT_STATUS=1 \
+%{__ztsphp} -n run-tests.php -q --offline --show-diff
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license NTS/LICENSE
+%doc NTS/README.md
+
+%config(noreplace) %{php_inidir}/%{ini_name}
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%config(noreplace) %{php_ztsinidir}/%{ini_name}
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
+
+%changelog
+* Fri Jul 9 2021 Remi Collet <remi@remirepo.net> - 1.1.1-1
+- new package, version 1.1.1
+- open https://github.com/codemasher/php-ext-xz/pull/1 library check
+- open https://github.com/codemasher/php-ext-xz/pull/2 ext version
+- open https://github.com/codemasher/php-ext-xz/pull/3 arginfo
diff --git a/pr1.patch b/pr1.patch
new file mode 100644
index 0000000..b574d78
--- /dev/null
+++ b/pr1.patch
@@ -0,0 +1,75 @@
+From be78be9c43fc87bc2bc936f60b3091e72cf5492a Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 9 Jul 2021 15:28:51 +0200
+Subject: [PATCH 1/2] fix lib test
+
+---
+ config.m4 | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index 02dd4b7..ec0c30f 100644
+--- a/config.m4
++++ b/config.m4
+@@ -12,12 +12,9 @@ if test "$PHP_XZ" != "no"; then
+
+ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+ [
+- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $XZ_DIR/lib, XZ_SHARED_LIBADD)
+- AC_DEFINE(HAVE_XZLIB,1,[ ])
++ PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD)
+ ],[
+ AC_MSG_ERROR([wrong xz lib version or lib not found])
+- ],[
+- -L$XZ_DIR/lib -lm
+ ])
+ PHP_SUBST(XZ_SHARED_LIBADD)
+
+
+From 3ef5b4ade5bb94358fba1bcba9bc8538749d3479 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 9 Jul 2021 15:50:54 +0200
+Subject: [PATCH 2/2] rely on pkg-config
+
+---
+ config.m4 | 27 +++++++++++++++++++++------
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/config.m4 b/config.m4
+index ec0c30f..e6c03ef 100644
+--- a/config.m4
++++ b/config.m4
+@@ -10,12 +10,27 @@ if test "$PHP_XZ" != "no"; then
+ LIBNAME=lzma # you may want to change this
+ LIBSYMBOL=lzma_stream_encoder # you most likely want to change this
+
+- PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+- [
+- PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD)
+- ],[
+- AC_MSG_ERROR([wrong xz lib version or lib not found])
+- ])
++ AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
++
++ AC_MSG_CHECKING(for liblzma)
++ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists liblzma; then
++ LIBLZMA_INCLINE=`$PKG_CONFIG liblzma --cflags`
++ LIBLZMA_LIBLINE=`$PKG_CONFIG liblzma --libs`
++ LIBLZMA_VERSION=`$PKG_CONFIG liblzma --modversion`
++ AC_MSG_RESULT(from pkg-config: version $LIBLZMA_VERSION)
++ PHP_EVAL_LIBLINE($LIBLZMA_LIBLINE, XZ_SHARED_LIBADD)
++ PHP_EVAL_INCLINE($LIBLZMA_INCLINE)
++ else
++ AC_MSG_WARN([not found using pkg-config, fallback to system directory])
++
++ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
++ [
++ PHP_ADD_LIBRARY($LIBNAME, 1, XZ_SHARED_LIBADD)
++ ],[
++ AC_MSG_ERROR([wrong xz lib version or lib not found])
++ ])
++ fi
++
+ PHP_SUBST(XZ_SHARED_LIBADD)
+
+ PHP_NEW_EXTENSION(xz, xz.c xz_fopen_wrapper.c utils.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
diff --git a/pr2.patch b/pr2.patch
new file mode 100644
index 0000000..394a42d
--- /dev/null
+++ b/pr2.patch
@@ -0,0 +1,82 @@
+From b53da53d60c479baa2e33859bdb03cad0ea5b540 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 9 Jul 2021 16:10:52 +0200
+Subject: [PATCH 1/2] use extension version instead of PHP version
+
+---
+ php_xz.h | 2 ++
+ xz.c | 10 ++++++++--
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/php_xz.h b/php_xz.h
+index 8368c4a..9908cb9 100644
+--- a/php_xz.h
++++ b/php_xz.h
+@@ -20,6 +20,8 @@
+ #ifndef PHP_XZ_H
+ # define PHP_XZ_H
+
++#define PHP_XZ_VERSION "1.1.1"
++
+ extern zend_module_entry xz_module_entry;
+ extern php_stream_wrapper php_stream_xz_wrapper;
+
+diff --git a/xz.c b/xz.c
+index 243167d..e0a4d3a 100644
+--- a/xz.c
++++ b/xz.c
+@@ -92,7 +92,7 @@ zend_module_entry xz_module_entry = {
+ NULL, /* PHP_RINIT(xz) */
+ NULL, /* PHP_RSHUTDOWN(xz) */
+ PHP_MINFO(xz),
+- PHP_VERSION,
++ PHP_XZ_VERSION,
+ STANDARD_MODULE_PROPERTIES
+ };
+ /* }}} */
+@@ -134,7 +134,13 @@ PHP_MINFO_FUNCTION(xz)
+ {
+ php_info_print_table_start();
+ php_info_print_table_header(2, "xz support", "enabled");
+- php_info_print_table_header(2, "liblzma version", lzma_version_string());
++ php_info_print_table_header(2, "xz extension version ", PHP_XZ_VERSION);
++ if (strcmp(LZMA_VERSION_STRING, lzma_version_string())) {
++ php_info_print_table_header(2, "liblzma headers version", LZMA_VERSION_STRING);
++ php_info_print_table_header(2, "liblzma library version", lzma_version_string());
++ } else {
++ php_info_print_table_header(2, "liblzma version", lzma_version_string());
++ }
+ php_info_print_table_end();
+
+ DISPLAY_INI_ENTRIES();
+
+From 1aa1b2763257b9c733c5f636e6ace275e1600891 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 9 Jul 2021 16:13:04 +0200
+Subject: [PATCH 2/2] only 1 header + rows
+
+---
+ xz.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/xz.c b/xz.c
+index e0a4d3a..832c13e 100644
+--- a/xz.c
++++ b/xz.c
+@@ -134,12 +134,12 @@ PHP_MINFO_FUNCTION(xz)
+ {
+ php_info_print_table_start();
+ php_info_print_table_header(2, "xz support", "enabled");
+- php_info_print_table_header(2, "xz extension version ", PHP_XZ_VERSION);
++ php_info_print_table_row(2, "xz extension version ", PHP_XZ_VERSION);
+ if (strcmp(LZMA_VERSION_STRING, lzma_version_string())) {
+- php_info_print_table_header(2, "liblzma headers version", LZMA_VERSION_STRING);
+- php_info_print_table_header(2, "liblzma library version", lzma_version_string());
++ php_info_print_table_row(2, "liblzma headers version", LZMA_VERSION_STRING);
++ php_info_print_table_row(2, "liblzma library version", lzma_version_string());
+ } else {
+- php_info_print_table_header(2, "liblzma version", lzma_version_string());
++ php_info_print_table_row(2, "liblzma version", lzma_version_string());
+ }
+ php_info_print_table_end();
+
diff --git a/pr3.patch b/pr3.patch
new file mode 100644
index 0000000..0fe4fe9
--- /dev/null
+++ b/pr3.patch
@@ -0,0 +1,157 @@
+From 8d05ae5257dba8e077063d0023bd5cdeabf463ac Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 9 Jul 2021 16:57:55 +0200
+Subject: [PATCH] fix arginfo and build warnings
+
+---
+ utils.c | 2 +-
+ utils.h | 2 +-
+ xz.c | 23 +++++++++++++----------
+ xz_fopen_wrapper.c | 11 ++++++-----
+ 4 files changed, 21 insertions(+), 17 deletions(-)
+
+diff --git a/utils.c b/utils.c
+index 45884a3..fd94186 100644
+--- a/utils.c
++++ b/utils.c
+@@ -20,7 +20,7 @@
+
+ #include "php.h"
+
+-void *memmerge(char *ptr1, char *ptr2, size_t len1, size_t len2) /* {{{ */
++void *memmerge(void *ptr1, void *ptr2, size_t len1, size_t len2) /* {{{ */
+ {
+ if ((ptr2 == NULL) || (len2 < 1)) {
+ return ptr1;
+diff --git a/utils.h b/utils.h
+index f2ccdac..929f249 100644
+--- a/utils.h
++++ b/utils.h
+@@ -24,7 +24,7 @@
+ /* Merges two memory fragments by reallocating the first one.
+ Returns a pointer to the first memory segment or, if reallocated, to the new
+ address. */
+-void *memmerge(char *ptr1, char *ptr2, size_t len1, size_t len2);
++void *memmerge(void *ptr1, void *ptr2, size_t len1, size_t len2);
+
+ #endif
+
+diff --git a/xz.c b/xz.c
+index 243167d..5c80ee2 100644
+--- a/xz.c
++++ b/xz.c
+@@ -38,15 +38,12 @@
+ #endif
+
+ /* {{{ arginfo */
+-ZEND_BEGIN_ARG_INFO(arginfo_void, 0)
+-ZEND_END_ARG_INFO()
+-
+ ZEND_BEGIN_ARG_INFO(arginfo_xzread, 0)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_INFO(0, length)
+ ZEND_END_ARG_INFO()
+
+-ZEND_BEGIN_ARG_INFO(arginfo_xzwrite, 0)
++ZEND_BEGIN_ARG_INFO_EX(arginfo_xzwrite, 0, 0, 2)
+ ZEND_ARG_INFO(0, fp)
+ ZEND_ARG_INFO(0, str)
+ ZEND_ARG_INFO(0, length)
+@@ -67,13 +64,19 @@ ZEND_END_ARG_INFO()
+ ZEND_BEGIN_ARG_INFO(arginfo_xzdecode, 0)
+ ZEND_ARG_INFO(0, str)
+ ZEND_END_ARG_INFO()
++
++ZEND_BEGIN_ARG_INFO_EX(arginfo_xzopen, 0, 0, 2)
++ ZEND_ARG_INFO(0, filename)
++ ZEND_ARG_INFO(0, mode)
++ ZEND_ARG_INFO(0, compression_level)
++ZEND_END_ARG_INFO()
+ /* }}} */
+
+ /* {{{ xz_functions[] */
+ static const zend_function_entry xz_functions[] = {
+- PHP_FE(xzdecode, arginfo_void)
+- PHP_FE(xzopen, arginfo_void)
+- PHP_FE(xzencode, arginfo_void)
++ PHP_FE(xzdecode, arginfo_xzdecode)
++ PHP_FE(xzopen, arginfo_xzopen)
++ PHP_FE(xzencode, arginfo_xzencode)
+ PHP_FALIAS(xzread, fread, arginfo_xzread)
+ PHP_FALIAS(xzwrite, fwrite, arginfo_xzwrite)
+ PHP_FALIAS(xzclose, fclose, arginfo_xzclose)
+@@ -247,7 +250,7 @@ PHP_FUNCTION(xzencode)
+
+ lzma_end(&strm);
+
+- RETURN_STRINGL(out, out_len);
++ RETURN_STRINGL((char *)out, out_len);
+ }
+ /* }}} */
+
+@@ -299,14 +302,14 @@ PHP_FUNCTION(xzdecode)
+ strm.next_out = buff;
+ }
+ }
+-
++ (void)status; // avoid -Wunused-but-set-variable warning
+ /* Merging last fragment. */
+ out = memmerge(out, buff, out_len, XZ_BUFFER_SIZE - strm.avail_out);
+ out_len += XZ_BUFFER_SIZE - strm.avail_out;
+
+ lzma_end(&strm);
+
+- RETURN_STRINGL(out, out_len);
++ RETURN_STRINGL((char *)out, out_len);
+ }
+ /* }}} */
+
+diff --git a/xz_fopen_wrapper.c b/xz_fopen_wrapper.c
+index 8bd2843..4dc75a9 100644
+--- a/xz_fopen_wrapper.c
++++ b/xz_fopen_wrapper.c
+@@ -53,7 +53,7 @@ struct php_xz_stream_data_t {
+ int fd;
+
+ /* The type of access required. */
+- char mode[4];
++ char mode[64];
+
+ /* Compression level used. */
+ unsigned long level;
+@@ -69,7 +69,7 @@ static int php_xz_decompress(struct php_xz_stream_data_t *self)
+
+ if (strm->avail_in == 0 && !php_stream_eof(self->stream)) {
+ strm->next_in = self->in_buf;
+- strm->avail_in = php_stream_read(self->stream, self->in_buf, self->in_buf_sz);
++ strm->avail_in = php_stream_read(self->stream, (char *)self->in_buf, self->in_buf_sz);
+ }
+
+ lzma_ret ret = lzma_code(strm, action);
+@@ -92,14 +92,15 @@ static int php_xz_compress(struct php_xz_stream_data_t *self)
+ {
+ lzma_stream *strm = &self->strm;
+ lzma_action action = LZMA_RUN;
+- int wrote = 0, to_write = strm->avail_in;
++ int to_write = strm->avail_in;
+
+ while (strm->avail_in > 0) {
+ lzma_ret ret = lzma_code(strm, action);
+ size_t len = self->out_buf_sz - strm->avail_out;
+- php_stream_write(self->stream, self->out_buf, len);
++ php_stream_write(self->stream, (char *)self->out_buf, len);
+ strm->next_out = self->out_buf;
+ strm->avail_out = self->out_buf_sz;
++ (void)ret; // avoid -Wunused-but-set-variable warning
+ }
+
+ strm->next_in = self->in_buf;
+@@ -266,7 +267,7 @@ static int php_xziop_close(php_stream *stream, int close_handle)
+
+ if (strm->avail_out < self->out_buf_sz) {
+ size_t write_size = self->out_buf_sz - strm->avail_out;
+- php_stream_write(self->stream, self->out_buf, write_size);
++ php_stream_write(self->stream, (char *)self->out_buf, write_size);
+ strm->next_out = self->out_buf;
+ strm->avail_out = self->out_buf_sz;
+ }