Attached is a patch to allow PHP 6 to build on windows (ext/string/string.c).
MS compiler doesnt allow arithmetic operations on void *.
This hopefully will work everywhere as I noticed some of these were changed before to support GCC 4.

Rob
Index: string.c
===================================================================
RCS file: /repository/php-src/ext/standard/string.c,v
retrieving revision 1.476
diff -u -r1.476 string.c
--- string.c    5 Sep 2005 10:55:35 -0000       1.476
+++ string.c    5 Sep 2005 13:05:02 -0000
@@ -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));

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to