[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]