summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-07-24 07:38:23 +0200
committerRemi Collet <remi@remirepo.net>2019-07-24 07:38:23 +0200
commit36f22b1c5c80bfd2ba7a33160d9c186521d76bc0 (patch)
tree68d2f918ecaffa22f9eb7254acb753fcea847225
parent07b29fe767f0a7f98b856fb02879ed595f9be1ac (diff)
add patch for 7.4.0beta1 from https://github.com/kjdev/php-ext-zstd/pull/24
-rw-r--r--24.patch83
-rw-r--r--php-zstd.spec10
2 files changed, 92 insertions, 1 deletions
diff --git a/24.patch b/24.patch
new file mode 100644
index 0000000..3ae7dfe
--- /dev/null
+++ b/24.patch
@@ -0,0 +1,83 @@
+From 479c32d63619e3164f3a49bca856eed0c7cef333 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 23 Jul 2019 16:52:30 +0200
+Subject: [PATCH 1/2] fix for stream changes in 7.4.0beta1
+
+---
+ zstd.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/zstd.c b/zstd.c
+index 46bfc8e..8319abb 100644
+--- a/zstd.c
++++ b/zstd.c
+@@ -488,9 +488,16 @@ static int php_zstd_comp_close(php_stream *stream, int close_handle TSRMLS_DC)
+ }
+
+
++#if PHP_VERSION_ID < 70400
+ static size_t php_zstd_decomp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
+ {
+- size_t x, res, ret = 0;
++ size_t ret = 0;
++#else
++static ssize_t php_zstd_decomp_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
++{
++ ssize_t ret = 0;
++#endif
++ size_t x, res;
+ STREAM_DATA_FROM_STREAM();
+
+ while (count > 0) {
+@@ -536,9 +543,16 @@ static size_t php_zstd_decomp_read(php_stream *stream, char *buf, size_t count T
+ }
+
+
++#if PHP_VERSION_ID < 70400
+ static size_t php_zstd_comp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
+ {
+- size_t res, x, ret = 0;
++ size_t ret = 0;
++#else
++static ssize_t php_zstd_comp_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
++{
++ ssize_t ret = 0;
++#endif
++ size_t x, res;
+
+ STREAM_DATA_FROM_STREAM();
+
+
+From 419542ad635c0aa8fdfc5f49ea6c2ae1ea815220 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 23 Jul 2019 16:58:39 +0200
+Subject: [PATCH 2/2] report error to PHP stream wrapper
+
+---
+ zstd.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/zstd.c b/zstd.c
+index 8319abb..b8f851e 100644
+--- a/zstd.c
++++ b/zstd.c
+@@ -525,6 +525,9 @@ static ssize_t php_zstd_decomp_read(php_stream *stream, char *buf, size_t count
+ res = ZSTD_decompressStream(self->dctx, &self->output , &self->input);
+ if (ZSTD_isError(res)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "libzstd error %s\n", ZSTD_getErrorName(res));
++#if PHP_VERSION_ID >= 70400
++ return -1;
++#endif
+ }
+ /* for us */
+ self->output.size = self->output.pos;
+@@ -586,6 +589,9 @@ static ssize_t php_zstd_comp_write(php_stream *stream, const char *buf, size_t c
+ #endif
+ if (ZSTD_isError(res)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "libzstd error %s\n", ZSTD_getErrorName(res));
++#if PHP_VERSION_ID >= 70400
++ return -1;
++#endif
+ }
+ php_stream_write(self->stream, self->bufout, self->output.pos);
+ } while (self->input.pos != self->input.size);
diff --git a/php-zstd.spec b/php-zstd.spec
index 6f09d81..768dff1 100644
--- a/php-zstd.spec
+++ b/php-zstd.spec
@@ -40,7 +40,7 @@ Version: 0.7.3
%if 0%{?gh_date:1}
Release: 2%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%else
-Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%endif
%if %{?with_libzstd}
License: MIT
@@ -53,6 +53,8 @@ Source0: %{pkg_name}-%{version}-%{gh_short}.tgz
# retrieve a recursive git snapshot with submodule
Source1: makesrc.sh
+Patch0: https://patch-diff.githubusercontent.com/raw/kjdev/php-ext-zstd/pull/24.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
%if %{?with_libzstd}
@@ -114,6 +116,8 @@ These are the files needed to compile programs using %{name}.
mv %{gh_project}-%{gh_commit} NTS
cd NTS
+%patch0 -p1
+
# replace symlink
rm LICENSE-zstd
mv zstd/LICENSE LICENSE-libzstd
@@ -247,6 +251,10 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \
%changelog
+* Wed Jul 24 2019 Remi Collet <remi@remirepo.net> - 0.7.3-4
+- add patch for 7.4.0beta1 from
+ https://github.com/kjdev/php-ext-zstd/pull/24
+
* Tue Jul 23 2019 Remi Collet <remi@remirepo.net> - 0.7.3-3
- rebuild for 7.4.0beta1