From f40955e03cd361966f927acfaa477cfceb8930e5 Mon Sep 17 00:00:00 2001 From: Christian Göttsche Date: Wed, 29 May 2024 20:38:23 +0200 Subject: Avoid dropping const qualifier in casts Adjusts casts to void dropping const qualifiers. This helps to avoid mistakes, e.g. modifying string literals. Also use size_t for length, similar to the upstream php interfaces. --- src/sp_ifilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp_ifilter.c') diff --git a/src/sp_ifilter.c b/src/sp_ifilter.c index 9c46875..67eb5f3 100644 --- a/src/sp_ifilter.c +++ b/src/sp_ifilter.c @@ -24,7 +24,7 @@ static const char sp_is_dangerous_char[256] = { /* 0xf0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static void sp_server_strip(HashTable *svars, char *key, int keylen) { +static void sp_server_strip(HashTable *svars, const char *key, size_t keylen) { zval *value = zend_hash_str_find(svars, key, keylen); if (!value || Z_TYPE_P(value) != IS_STRING) { return; } @@ -39,7 +39,7 @@ static void sp_server_strip(HashTable *svars, char *key, int keylen) { } } -static void sp_server_encode(HashTable *svars, char *key, int keylen) { +static void sp_server_encode(HashTable *svars, const char *key, size_t keylen) { zval *value = zend_hash_str_find(svars, key, keylen); if (!value || Z_TYPE_P(value) != IS_STRING) { return; } -- cgit v1.3