From: Matt Corallo Date: Sat, 7 Aug 2021 17:57:02 +0000 (+0000) Subject: Add an accessor to UInt5 to get the value and correct conversion X-Git-Tag: v0.0.99.2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=1ed75665c2ddbffab5da978648872d3d63ff8852;p=ldk-java Add an accessor to UInt5 to get the value and correct conversion --- diff --git a/gen_type_mapping.py b/gen_type_mapping.py index 9fcdc402..6cf389aa 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -412,7 +412,7 @@ class TypeMappingGenerator: arg_conv = "", arg_conv_name = "(LDKu5){ ._0 = " + ty_info.var_name + " }", arg_conv_cleanup = None, ret_conv = ("uint8_t " + ty_info.var_name + "_val = ", "._0;"), ret_conv_name = ty_info.var_name + "_val", to_hu_conv = ty_info.java_hu_ty + " " + ty_info.var_name + "_conv = new " + ty_info.java_hu_ty + "(" + ty_info.var_name + ");", - to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = (ty_info.var_name + ".ptr", "")) + to_hu_conv_name = ty_info.var_name + "_conv", from_hu_conv = (ty_info.var_name + ".getVal()", "")) assert ty_info.rust_obj == "LDKTxOut" if not ty_info.is_ptr and not holds_ref: diff --git a/src/main/java/org/ldk/util/UInt5.java b/src/main/java/org/ldk/util/UInt5.java index 1bd627b8..a818d9d8 100644 --- a/src/main/java/org/ldk/util/UInt5.java +++ b/src/main/java/org/ldk/util/UInt5.java @@ -11,4 +11,11 @@ public class UInt5 { } this.val = val; } + + /** + * @return the value represented + */ + public byte getVal() { + return val; + } }