X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=gen_type_mapping.py;h=5ad3d27f64fe99c631a1ca8378820715255e9fa8;hb=9254f751c55dd40afd17bc129cb72f6af3d35ee8;hp=07d892bfce5d4d847b26eabb5dc7ccbb4bc5a58c;hpb=fdf7dda84c58e6633b678d5cffea1d6e027d1ce6;p=ldk-java diff --git a/gen_type_mapping.py b/gen_type_mapping.py index 07d892bf..5ad3d27f 100644 --- a/gen_type_mapping.py +++ b/gen_type_mapping.py @@ -174,7 +174,7 @@ class TypeMappingGenerator: if ty_info.arr_access is None: return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, arg_conv = None, arg_conv_name = None, arg_conv_cleanup = None, - ret_conv = ("jstring " + ty_info.var_name + "_conv = (*env)->NewStringUTF(env, ", ");"), ret_conv_name = ty_info.var_name + "_conv", + ret_conv = ("jstring " + ty_info.var_name + "_conv = " + self.consts.owned_str_to_c_call[0], self.consts.owned_str_to_c_call[1] + ";"), ret_conv_name = ty_info.var_name + "_conv", to_hu_conv = None, to_hu_conv_name = None, from_hu_conv = None) else: return ConvInfo(ty_info = ty_info, arg_name = ty_info.var_name, @@ -183,7 +183,7 @@ class TypeMappingGenerator: ";\nchar* " + ty_info.var_name + "_buf = MALLOC(" + ty_info.var_name + "_str." + ty_info.arr_len + " + 1, \"str conv buf\");\n" + "memcpy(" + ty_info.var_name + "_buf, " + ty_info.var_name + "_str." + ty_info.arr_access + ", " + ty_info.var_name + "_str." + ty_info.arr_len + ");\n" + ty_info.var_name + "_buf[" + ty_info.var_name + "_str." + ty_info.arr_len + "] = 0;\n" + - "jstring " + ty_info.var_name + "_conv = (*env)->NewStringUTF(env, " + ty_info.var_name + "_str." + ty_info.arr_access + ");\n" + + "jstring " + ty_info.var_name + "_conv = " + self.consts.owned_str_to_c_call[0] + ty_info.var_name + "_str." + ty_info.arr_access + self.consts.owned_str_to_c_call[1] + ";\n" + "FREE(" + ty_info.var_name + "_buf);"), ret_conv_name = ty_info.var_name + "_conv", to_hu_conv = None, to_hu_conv_name = None, from_hu_conv = None) elif ty_info.var_name == "" and not print_void: