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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
From e81e57aadf5647511f5c27843ea565a141cf2e3d Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 29 Jan 2024 16:47:49 +0100
Subject: [PATCH 1/3] Fix incompatible pointer types
---
src/php_pqlob.c | 2 +-
src/php_pqres.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/php_pqlob.c b/src/php_pqlob.c
index 0cb44a8..a419390 100644
--- a/src/php_pqlob.c
+++ b/src/php_pqlob.c
@@ -169,7 +169,7 @@ static int php_pqlob_stream_flush(php_stream *stream)
return SUCCESS;
}
-static ZEND_RESULT_CODE php_pqlob_stream_seek(php_stream *stream, off_t offset, int whence, off_t *newoffset)
+static ZEND_RESULT_CODE php_pqlob_stream_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset)
{
ZEND_RESULT_CODE rv = FAILURE;
php_pqlob_object_t *obj = stream->abstract;
diff --git a/src/php_pqres.c b/src/php_pqres.c
index e9de463..c8262ac 100644
--- a/src/php_pqres.c
+++ b/src/php_pqres.c
@@ -398,24 +398,24 @@ static zend_object_iterator_funcs php_pqres_iterator_funcs = {
#endif
};
-static inline ZEND_RESULT_CODE php_pqres_count_elements_ex(zend_object *object, long *count)
+static inline ZEND_RESULT_CODE php_pqres_count_elements_ex(zend_object *object, zend_long *count)
{
php_pqres_object_t *obj = PHP_PQ_OBJ(NULL, object);
if (!obj->intern) {
return FAILURE;
} else {
- *count = (long) PQntuples(obj->intern->res);
+ *count = (zend_long) PQntuples(obj->intern->res);
return SUCCESS;
}
}
#if PHP_VERSION_ID >= 80000
-static ZEND_RESULT_CODE php_pqres_count_elements(zend_object *object, long *count)
+static ZEND_RESULT_CODE php_pqres_count_elements(zend_object *object, zend_long *count)
{
return php_pqres_count_elements_ex(object, count);
}
#else
-static ZEND_RESULT_CODE php_pqres_count_elements(zval *object, long *count)
+static ZEND_RESULT_CODE php_pqres_count_elements(zval *object, zend_long *count)
{
return php_pqres_count_elements_ex(Z_OBJ_P(object), count);
}
From 77dce501422e1402bb70ba3aad94e070850aaa3b Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 29 Jan 2024 16:50:42 +0100
Subject: [PATCH 2/3] Fix [-Wformat=]
---
src/php_pqres.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/php_pqres.c b/src/php_pqres.c
index c8262ac..e3986c5 100644
--- a/src/php_pqres.c
+++ b/src/php_pqres.c
@@ -736,7 +736,7 @@ static ZEND_RESULT_CODE column_nn(php_pqres_object_t *obj, zval *zcol, php_pqres
}
if (!col->name) {
- php_error_docref(NULL, E_WARNING, "Failed to find column at index %ld", index);
+ php_error_docref(NULL, E_WARNING, "Failed to find column at index " ZEND_LONG_FMT, index);
return FAILURE;
}
if (col->num == -1) {
@@ -791,7 +791,7 @@ static int apply_bound(zval *zbound, int argc, va_list argv, zend_hash_key *key)
ZEND_RESULT_CODE *rv = va_arg(argv, ZEND_RESULT_CODE *);
if (!(zvalue = zend_hash_index_find(Z_ARRVAL_P(zrow), key->h))) {
- php_error_docref(NULL, E_WARNING, "Failed to find column ad index %lu", key->h);
+ php_error_docref(NULL, E_WARNING, "Failed to find column ad index " ZEND_ULONG_FMT, key->h);
*rv = FAILURE;
return ZEND_HASH_APPLY_STOP;
} else {
From ea88a82879ac87d41c03d80ea285d843346f2114 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 29 Jan 2024 17:05:04 +0100
Subject: [PATCH 3/3] Fix incompatible pointer types
---
src/php_pqres.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/php_pqres.c b/src/php_pqres.c
index e3986c5..802fcf4 100644
--- a/src/php_pqres.c
+++ b/src/php_pqres.c
@@ -1172,7 +1172,7 @@ static PHP_METHOD(pqres, count) {
zend_restore_error_handling(&zeh);
if (SUCCESS == rv) {
- long count;
+ zend_long count;
if (SUCCESS != php_pqres_count_elements_ex(Z_OBJ_P(getThis()), &count)) {
throw_exce(EX_UNINITIALIZED, "pq\\Result not initialized");
|