From ebd41e895b08445275bef0befeadb2eeba156835 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 24 Jul 2019 07:58:34 +0200 Subject: [PATCH] fix for stream change in 7.4.0beta1 --- brotli.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/brotli.c b/brotli.c index 891f706..87f8d2f 100644 --- a/brotli.c +++ b/brotli.c @@ -470,11 +470,19 @@ static int php_brotli_decompress_close(php_stream *stream, return EOF; } +#if PHP_VERSION_ID < 70400 static size_t php_brotli_decompress_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) { size_t ret = 0; +#else +static ssize_t php_brotli_decompress_read(php_stream *stream, + char *buf, + size_t count TSRMLS_DC) +{ + ssize_t ret = 0; +#endif STREAM_DATA_FROM_STREAM(); /* input */ @@ -485,7 +493,11 @@ static size_t php_brotli_decompress_read(php_stream *stream, if (input) { efree(input); } +#if PHP_VERSION_ID < 70400 return 0; +#else + return -1; +#endif } self->available_in = php_stream_read(self->stream, input, brotli_buffer_size ); @@ -592,13 +604,20 @@ static int php_brotli_compress_close(php_stream *stream, return EOF; } +#if PHP_VERSION_ID < 70400 static size_t php_brotli_compress_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC) { - STREAM_DATA_FROM_STREAM(); - size_t ret = 0; +#else +static ssize_t php_brotli_compress_write(php_stream *stream, + const char *buf, + size_t count TSRMLS_DC) +{ + ssize_t ret = 0; +#endif + STREAM_DATA_FROM_STREAM(); size_t available_in = count; const uint8_t *next_in = (uint8_t *)buf;