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

Richard W.M. Jones rjones at redhat.com
Wed Mar 29 18:17:59 UTC 2017


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/




More information about the Libguestfs mailing list