X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-java;a=blobdiff_plain;f=typescript_strings.py;h=d669821301b53fdde1bff004c51e86f8f56ab9dd;hp=3596c2b8f34a988a745ac68f8ab5436e0706cd26;hb=cf5dbd06f37b9e98d391a93e9b9299aed0c95995;hpb=39ca1868e3495be75218a44bd2f978d5fc9abd2e diff --git a/typescript_strings.py b/typescript_strings.py index 3596c2b8..d6698213 100644 --- a/typescript_strings.py +++ b/typescript_strings.py @@ -117,12 +117,14 @@ export async function initializeWasm(uri: string) { if (decodeString(wasm.TS_get_lib_version_string()) !== version.get_ldk_java_bindings_version()) throw new Error(\"Compiled LDK library and LDK class failes do not match\"); // Fetching the LDK versions from C also checks that the header and binaries match - if (wasm.TS_get_ldk_c_bindings_version() == 0) + const c_bindings_ver: number = wasm.TS_get_ldk_c_bindings_version(); + const ldk_ver: number = wasm.TS_get_ldk_version(); + if (c_bindings_ver == 0) throw new Error(\"LDK version did not match the header we built against\"); - if (wasm.TS_get_ldk_version() == 0) + if (ldk_ver == 0) throw new Error(\"LDK C bindings version did not match the header we built against\"); - const c_bindings_version: string = decodeString(wasm.TS_get_ldk_c_bindings_version()); - const ldk_version: string = decodeString(wasm.TS_get_ldk_version()); + const c_bindings_version: string = decodeString(c_bindings_ver) + const ldk_version: string = decodeString(ldk_ver); console.log(\"Loaded LDK-Java Bindings with LDK \" + ldk_version + \" and LDK-C-Bindings \" + c_bindings_version); isWasmInitialized = true; @@ -584,12 +586,12 @@ import * as bindings from '../bindings.mjs' def get_native_arr_contents(self, arr_name, dest_name, arr_len, ty_info, copy): if ty_info.c_ty == "int8_tArray": if copy: - return "memcpy(" + dest_name + ", " + arr_name + "->elems, " + arr_len + ")" + return "memcpy(" + dest_name + ", " + arr_name + "->elems, " + arr_len + "); FREE(" + arr_name + ")" if ty_info.c_ty == "ptrArray": - return "(void*) " + arr_name + "->elems" + return "(void*) " + arr_name + "->elems /* XXX " + arr_name + " leaks */" else: assert not copy - return arr_name + "->elems" + return arr_name + "->elems /* XXX " + arr_name + " leaks */" def get_native_arr_elem(self, arr_name, idxc, ty_info): assert False # Only called if above is None def get_native_arr_ptr_call(self, ty_info):