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
|
From 2d19ba1d6fe8f0f650d7b9bc02c5f1cb10dbb9e0 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 6 May 2020 08:54:43 +0200
Subject: [PATCH] fix [-Wformat=] warning on 32-bit
---
cluster_library.c | 2 +-
redis_array.c | 4 ++--
redis_cluster.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/cluster_library.c b/cluster_library.c
index 191947c57..b21a68758 100644
--- a/cluster_library.c
+++ b/cluster_library.c
@@ -552,7 +552,7 @@ unsigned short cluster_hash_key_zval(zval *z_key) {
klen = Z_STRLEN_P(z_key);
break;
case IS_LONG:
- klen = snprintf(buf,sizeof(buf),"%ld",Z_LVAL_P(z_key));
+ klen = snprintf(buf,sizeof(buf),ZEND_LONG_FMT,Z_LVAL_P(z_key));
kptr = (const char *)buf;
break;
case IS_DOUBLE:
diff --git a/redis_array.c b/redis_array.c
index 7f8fa129d..bdd7120ef 100644
--- a/redis_array.c
+++ b/redis_array.c
@@ -926,7 +926,7 @@ PHP_METHOD(RedisArray, mget)
key_len = Z_STRLEN_P(data);
key_lookup = Z_STRVAL_P(data);
} else {
- key_len = snprintf(kbuf, sizeof(kbuf), "%ld", Z_LVAL_P(data));
+ key_len = snprintf(kbuf, sizeof(kbuf), ZEND_LONG_FMT, Z_LVAL_P(data));
key_lookup = (char*)kbuf;
}
@@ -1052,7 +1052,7 @@ PHP_METHOD(RedisArray, mset)
key_len = ZSTR_LEN(zkey);
key = ZSTR_VAL(zkey);
} else {
- key_len = snprintf(kbuf, sizeof(kbuf), "%lu", idx);
+ key_len = snprintf(kbuf, sizeof(kbuf), ZEND_ULONG_FMT, idx);
key = kbuf;
}
diff --git a/redis_cluster.c b/redis_cluster.c
index ee218ba05..7f79b5fe8 100644
--- a/redis_cluster.c
+++ b/redis_cluster.c
@@ -2245,7 +2245,7 @@ cluster_cmd_get_slot(redisCluster *c, zval *z_arg)
/* Inform the caller if they've passed bad data */
if (slot < 0) {
- php_error_docref(0, E_WARNING, "Unknown node %s:%ld",
+ php_error_docref(0, E_WARNING, "Unknown node %s:" ZEND_LONG_FMT,
Z_STRVAL_P(z_host), Z_LVAL_P(z_port));
}
} else {
|