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
|
From d2f0184e58d6d05569624bc52d2be76c65a9d297 Mon Sep 17 00:00:00 2001
From: Remi Collet <fedora@famillecollet.com>
Date: Mon, 30 Mar 2015 19:00:17 +0200
Subject: [PATCH] Fix PHP 7 compatibility
---
framework/lz4/horde_lz4.c | 6 +++---
framework/lz4/horde_lz4.h | 7 +++++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/framework/lz4/horde_lz4.c b/framework/lz4/horde_lz4.c
index 28ec47f..23625be 100644
--- a/framework/lz4/horde_lz4.c
+++ b/framework/lz4/horde_lz4.c
@@ -87,7 +87,7 @@ PHP_FUNCTION(horde_lz4_compress)
RETURN_FALSE;
}
- data_len = Z_STRLEN_P(data);
+ data_len = (int)Z_STRLEN_P(data);
output = (char *)emalloc(LZ4_compressBound(data_len) + header_offset);
if (!output) {
@@ -107,7 +107,7 @@ PHP_FUNCTION(horde_lz4_compress)
if (output_len <= 0) {
RETVAL_FALSE;
} else {
- RETVAL_STRINGL(output, output_len + header_offset, 1);
+ HORDE_LZ4_RETSTRL(output, output_len + header_offset);
}
efree(output);
@@ -155,7 +155,7 @@ PHP_FUNCTION(horde_lz4_uncompress)
if (output_len <= 0) {
RETVAL_FALSE;
} else {
- RETVAL_STRINGL(output, data_len, 1);
+ HORDE_LZ4_RETSTRL(output, data_len);
}
efree(output);
diff --git a/framework/lz4/horde_lz4.h b/framework/lz4/horde_lz4.h
index eb4e7a5..8ff3f7c 100644
--- a/framework/lz4/horde_lz4.h
+++ b/framework/lz4/horde_lz4.h
@@ -23,4 +23,11 @@ PHP_MINFO_FUNCTION(horde_lz4);
PHP_FUNCTION(horde_lz4_compress);
PHP_FUNCTION(horde_lz4_uncompress);
+#if PHP_MAJOR_VERSION < 7
+#define HORDE_LZ4_RETSTRL(a,l) RETURN_STRINGL(a,l,1)
+#else
+typedef size_t strsize;
+#define HORDE_LZ4_RETSTRL(a,l) RETURN_STRINGL(a,l)
+#endif
+
#endif /* PHP_HORDE_LZ4_H */
|