Use intptr_t in C when talking about a pointer.
authorMatt Corallo <git@bluematt.me>
Mon, 17 Jan 2022 02:50:23 +0000 (02:50 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 17 Jan 2022 04:34:52 +0000 (04:34 +0000)
This fixes a bug in TS where we'd return an int64_t when we intended
to return a pointer, confusing JavaScript as to why it has a bigint
instead of a number.

This may make it harder to support 32-bit Java platforms in the
future if we have a reason to do so, but that seems unlikely and
its possible we can simply redefine the type.

genbindings.py

index 8b067f72a8d27c36840e53089be0eaaaeee9c375..175340d6246c1eb789411aec04c9a07a72a617f1 100755 (executable)
@@ -288,7 +288,7 @@ def java_c_types(fn_arg, ret_arr_len):
             fn_arg = fn_arg[8:].strip()
         else:
             java_ty = consts.ptr_native_ty
-            c_ty = "int64_t"
+            c_ty = "intptr_t"
             arr_ty = "uintptr_t"
             rust_obj = "uintptr_t"
             fn_arg = fn_arg[9:].strip()