[Libguestfs] [PATCH] mllib: cast integer pointers to intptr_t as intermediate step

Pino Toscano ptoscano at redhat.com
Wed Mar 29 16:57:16 UTC 2017


This make sure there is no mismatch between the size of the integer
value that Int64_val returns, and the size of the guestfs_h pointer.

This should fix the warning on 32bit environments (and thus build, when
--enable-werror is enabled).
---
 mllib/visit-c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mllib/visit-c.c b/mllib/visit-c.c
index b46dd33..b1c1216 100644
--- a/mllib/visit-c.c
+++ b/mllib/visit-c.c
@@ -54,7 +54,7 @@ value
 guestfs_int_mllib_visit (value gv, value dirv, value fv)
 {
   CAMLparam3 (gv, dirv, fv);
-  guestfs_h *g = (guestfs_h *) Int64_val (gv);
+  guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gv);
   struct visitor_function_wrapper_args args;
   /* The dir string could move around when we call the
    * visitor_function, so we have to take a full copy of it.
-- 
2.9.3




More information about the Libguestfs mailing list