From: Matt Corallo Date: Tue, 17 Aug 2021 22:18:46 +0000 (+0000) Subject: Correct Rust -> Java method call semantics to avoid double-conversion X-Git-Tag: v0.0.100.0~2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=commitdiff_plain;h=58ed33c235ecd7fc94ed2afa09941b9e8c9b57f1 Correct Rust -> Java method call semantics to avoid double-conversion --- diff --git a/java_strings.py b/java_strings.py index 3482dfb9..2ddecab7 100644 --- a/java_strings.py +++ b/java_strings.py @@ -849,7 +849,7 @@ import javax.annotation.Nullable; elif not fn_line.ret_ty_info.passed_as_ptr: out_c += "\t" + fn_line.ret_ty_info.c_ty + " ret = (*env)->Call" + fn_line.ret_ty_info.java_ty.title() + "Method(env, obj, j_calls->" + fn_line.fn_name + "_meth" else: - out_c = out_c + "\t" + fn_line.ret_ty_info.rust_obj + "* ret = (" + fn_line.ret_ty_info.rust_obj + "*)(*env)->CallLongMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth" + out_c = out_c + "\tuint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->" + fn_line.fn_name + "_meth" for idx, arg_info in enumerate(fn_line.args_ty): if arg_info.ret_conv is not None: diff --git a/typescript_strings.py b/typescript_strings.py index d1eae4e0..9f0676a5 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -723,7 +723,7 @@ const decodeString = (stringPointer, free = true) => { elif not fn_line.ret_ty_info.passed_as_ptr: out_c = out_c + "\treturn js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth" else: - out_c = out_c + "\t" + fn_line.ret_ty_info.rust_obj + "* ret = (" + fn_line.ret_ty_info.rust_obj + "*)js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth" + out_c = out_c + "\tuint32_t ret = js_invoke_function_" + str(len(fn_line.args_ty)) + "(j_calls->" + fn_line.fn_name + "_meth" for idx, arg_info in enumerate(fn_line.args_ty): if arg_info.ret_conv is not None: