cvs: php-src /ext/standard string.c
| From: | Rolland Santimano | Date: | Mon, 05 Sep 2005 16:37:46 +0000 |
| Subject: | cvs: php-src /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-33821@lists.php.net to get a copy of this message | ||
rolland Mon Sep 5 12:37:46 2005 EDT
Modified files:
/php-src/ext/standard string.c
Log:
Pointer arithmetic with char * rather than void *
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.476&r2=1.477&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.476 php-src/ext/standard/string.c:1.477
--- php-src/ext/standard/string.c:1.476 Mon Sep 5 06:55:35 2005
+++ php-src/ext/standard/string.c Mon Sep 5 12:37:45 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.476 2005/09/05 10:55:35 rolland Exp $ */
+/* $Id: string.c,v 1.477 2005/09/05 16:37:45 rolland Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -5273,20 +5273,20 @@
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 @@
} 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));