From 1ed75665c2ddbffab5da978648872d3d63ff8852 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 7 Aug 2021 17:57:02 +0000 Subject: [PATCH] Add an accessor to UInt5 to get the value and correct conversion --- gen_type_mapping.py | 2 +- src/main/java/org/ldk/util/UInt5.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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; + } } -- 2.30.2