Compilation fails due to void pointer arithmetic (issue 24).
authorBernhard Schommer <bernhardschommer@gmail.com>
Thu, 31 Jul 2014 11:05:38 +0000 (12:05 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 31 Jul 2014 11:06:34 +0000 (12:06 +0100)
bitstring_c.c

index 3ea2547..d376f76 100644 (file)
@@ -75,7 +75,7 @@
   ocaml_bitstring_extract_fastpath_int##size##_##endian##_##signed     \
   (value strv, value offv)                                             \
   {                                                                    \
-    type *ptr = (type *) ((void *) String_val (strv) + Int_val (offv));        \
+    type *ptr = (type *) ((char *) String_val (strv) + Int_val (offv));        \
     type r;                                                            \
     memcpy(&r, ptr, sizeof(r));                                        \
     swap_##endian(size,r);                                             \
@@ -96,7 +96,7 @@ fastpath1(16,ne,signed,int16_t)
   {                                                                    \
     CAMLparam2 (strv, offv);                                            \
     CAMLlocal1 (rv);                                                    \
-    type *ptr = (type *) ((void *) String_val (strv) + Int_val (offv));        \
+    type *ptr = (type *) ((char *) String_val (strv) + Int_val (offv));        \
     type r;                                                            \
     memcpy(&r, ptr, sizeof(r));                                         \
     swap_##endian(size,r);                                             \