This patch fixes a couple of cases where arithmetic on void * pointers
is being done, which isn't valid although gcc seems to allow it.

Of course the memory.c code is broken anyway because it assumes a 
pointer will fit in an IV and I'm not sure that will always be true
will it? Anyway with this patch and the others it now builds on
a Unixware box with the system compiler:

Index: memory.c
===================================================================
RCS file: /home/perlcvs/parrot/memory.c,v
retrieving revision 1.3
diff -u -r1.3 memory.c
--- memory.c    2001/09/12 17:58:55     1.3
+++ memory.c    2001/09/13 09:00:34
@@ -26,7 +26,7 @@
     
   mem = malloc(max_to_alloc);
   if (((IV)mem & mask) < (IV)mem) {
-    mem = (void *)((IV)mem & mask) + ~mask + 1;
+    mem = (void *)(((IV)mem & mask) + ~mask + 1);
   } 
   return mem;
 }
Index: strnative.c
===================================================================
RCS file: /home/perlcvs/parrot/strnative.c,v
retrieving revision 1.5
diff -u -r1.5 strnative.c
--- strnative.c 2001/09/13 08:44:08     1.5
+++ strnative.c 2001/09/13 09:00:34
@@ -26,7 +26,7 @@
     
     /* b is now in native format */
     string_grow(a, a->strlen + b->strlen);
-    Sys_Memcopy(a->bufstart + a->strlen, b->bufstart, b->strlen);
+    Sys_Memcopy((char *)a->bufstart + a->strlen, b->bufstart, b->strlen);
     a->strlen = a->bufused = a->strlen + b->strlen;
     return a;
 }
@@ -47,7 +47,7 @@
     
     /* Offset and length have already been "normalized" */
     string_grow(dest, src->strlen - length);
-    Sys_Memcopy(dest->bufstart, src->bufstart + offset, length);
+    Sys_Memcopy(dest->bufstart, (char *)src->bufstart + offset, length);
     dest->strlen = dest->bufused = length;
     
     return dest;

Tom

-- 
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu

Reply via email to