Pino Toscano
2017-Mar-29 16:57 UTC
[Libguestfs] [PATCH] mllib: cast integer pointers to intptr_t as intermediate step
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
Richard W.M. Jones
2017-Mar-29 18:17 UTC
Re: [Libguestfs] [PATCH] mllib: cast integer pointers to intptr_t as intermediate step
On Wed, Mar 29, 2017 at 06:57:16PM +0200, Pino Toscano wrote:> 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.ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Maybe Matching Threads
- [PATCH] ocaml: Change calls to caml_named_value() to cope with const value* return.
- [PATCH 1/1] ocaml: make const the return value of caml_named_value()
- [PATCH 0/1] Build fix for future OCaml 4.09
- [PATCH 0/4] sysprep: Remove various backup files.
- [PATCH v3 0/5] sysprep: Remove various backup files.