summaryrefslogtreecommitdiffstats
path: root/23.patch
blob: 52af90bde24ca1ddcc3cfe3b2885c283ce41c283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From ebd41e895b08445275bef0befeadb2eeba156835 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
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;