From 840403455216d4afc8576d054187aa059ea041ea Mon Sep 17 00:00:00 2001 From: Rolland Santimano Date: Mon, 5 Sep 2005 16:37:45 +0000 Subject: [PATCH] Pointer arithmetic with char * rather than void * --- ext/standard/string.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/standard/string.c b/ext/standard/string.c index 0969130611..c474d9d27b 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -5273,20 +5273,20 @@ PHP_FUNCTION(substr_count) if (haystack_type == IS_UNICODE) { while ((p = zend_u_memnstr((UChar *)p, (UChar *)needle, needle_len, (UChar *)endp)) != NULL) { /*(UChar *)p += needle_len; // GCC 4.0.0 cannot compile this */ - p += UBYTES(needle_len); + p = (UChar *)p + UBYTES(needle_len); count++; } } else { if (needle_len == 1) { cmp = ((char *)needle)[0]; - while ((p = memchr(p, cmp, endp - p))) { + while ((p = memchr(p, cmp, (char *)endp - (char *)p))) { count++; - (char *)p++; + p = (char *)p + 1; } } else { while ((p = php_memnstr((char *)p, (char *)needle, needle_len, (char *)endp))) { /*(char *)p += needle_len; // GCC 4.0.0 cannot compile this */ - p += needle_len; + p = (char *)p + needle_len; count++; } } @@ -5420,7 +5420,7 @@ PHP_FUNCTION(str_pad) } else { for (i = 0; i < left_pad; i++) *((char *)result + result_len++) = *((char *)padstr + (i % padstr_len)); - memcpy(result + result_len, input, input_len); + memcpy((char *)result + result_len, input, input_len); result_len += input_len; for (i = 0; i < right_pad; i++) *((char *)result + result_len++) = *((char *)padstr + (i % padstr_len)); -- 2.40.0