[Libguestfs] [PATCH V2 2/2] JAVA: fix the type of optargs_bitmask

Richard W.M. Jones rjones at redhat.com
Mon Sep 3 08:38:46 UTC 2012


On Mon, Sep 03, 2012 at 01:50:59PM +0800, Wanlong Gao wrote:
> If we don't add a "L" at the end of a number, its type will be
> int but not long.
> 
> This bug is found when compiling JAVA binding with the following error:
> 
> ./com/redhat/et/libguestfs/GuestFS.java:14731: error: integer number too large: 2147483648
>       _optargs_bitmask |= 2147483648;
>                           ^
> 
> Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
> ---
>  generator/java.ml | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/generator/java.ml b/generator/java.ml
> index 4f549dc..5cf8c3a 100644
> --- a/generator/java.ml
> +++ b/generator/java.ml
> @@ -136,7 +136,7 @@ public class GuestFS {
>          pr "\n";
>          pr "    /* Unpack optional args. */\n";
>          pr "    Object _optobj;\n";
> -        pr "    long _optargs_bitmask = 0;\n";
> +        pr "    long _optargs_bitmask = 0L;\n";
>          iteri (
>            fun i argt ->
>              let t, boxed_t, convert, n, default =
> @@ -152,7 +152,7 @@ public class GuestFS {
>              pr "      _optobj = optargs.get (\"%s\");\n" n;
>              pr "    if (_optobj != null) {\n";
>              pr "      %s = ((%s) _optobj)%s;\n" n boxed_t convert;
> -            pr "      _optargs_bitmask |= %Ld;\n"
> +            pr "      _optargs_bitmask |= %LdL;\n"
>                (Int64.shift_left Int64.one i);
>              pr "    }\n";
>          ) optargs
> -- 
> 1.7.12

Sorry, I missed this patch.  However the fix I pushed is
equivalent and includes your credit.

Thanks,

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw




More information about the Libguestfs mailing list