X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=java_strings.py;h=25eec48e83ca9762522e8a5f322efa512c54efb3;hb=b1216b13577d42952013c14c88c1155eb6c6499f;hp=90226fa4dd37eef15e2dbc57da0ea304a1c39824;hpb=ed2b4074c8ebe8fe04b92744b81881cbc60bbda9;p=ldk-java diff --git a/java_strings.py b/java_strings.py index 90226fa4..25eec48e 100644 --- a/java_strings.py +++ b/java_strings.py @@ -83,11 +83,13 @@ class CommonBase { long ptr; LinkedList ptrs_to = new LinkedList(); protected CommonBase(long ptr) { this.ptr = ptr; } - public long _test_only_get_ptr() { return this.ptr; } } """ - self.c_file_pfx = """#include \"org_ldk_impl_bindings.h\" + self.c_file_pfx = """#include +// On OSX jlong (ie long long) is not equivalent to int64_t, so we override here +#define int64_t jlong +#include \"org_ldk_impl_bindings.h\" #include #include #include @@ -457,7 +459,10 @@ import java.util.Arrays; res = "JNIEnv *env;\n" res += "jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);\n" res += "if (get_jenv_res == JNI_EDETACHED) {\n" - res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n" + if self.target == Target.ANDROID: + res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, &env, NULL) == JNI_OK);\n" + else: + res += "\tDO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);\n" res += "} else {\n" res += "\tDO_ASSERT(get_jenv_res == JNI_OK);\n" res += "}\n" @@ -1068,7 +1073,7 @@ import java.util.Arrays; if not args_known: out_java_struct += ("\t// Skipped " + method_name + "\n") else: - meth_n = method_name[len(struct_meth) + 1:].strip("_") + meth_n = method_name[len(struct_meth) + 1 if len(struct_meth) != 0 else 0:].strip("_") if doc_comment is not None: out_java_struct += "\t/**\n\t * " + doc_comment.replace("\n", "\n\t * ") + "\n\t */\n" if not takes_self: