From d352874170829172a44bc27002a67236a0c4610c Mon Sep 17 00:00:00 2001 From: aston Date: Wed, 18 Oct 2023 12:27:50 +0300 Subject: [PATCH] Support x64 addresses --- rust/src/api/instance.rs | 4 ++-- rust/src/api/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rust/src/api/instance.rs b/rust/src/api/instance.rs index b8d388f..9ec068c 100644 --- a/rust/src/api/instance.rs +++ b/rust/src/api/instance.rs @@ -138,11 +138,11 @@ unsafe impl Send for Instance {} /// On Drop, the InstanceReceiver removes the Box from the heap. pub struct InstanceReceiver { pub(crate) rx: Box>, - tx_address: i64, + tx_address: u64, } impl InstanceReceiver { - pub(crate) fn new(rx: Receiver, tx_address: i64) -> InstanceReceiver { + pub(crate) fn new(rx: Receiver, tx_address: u64) -> InstanceReceiver { InstanceReceiver { rx: Box::new(rx), tx_address, diff --git a/rust/src/api/mod.rs b/rust/src/api/mod.rs index 731e563..b14d920 100644 --- a/rust/src/api/mod.rs +++ b/rust/src/api/mod.rs @@ -872,7 +872,7 @@ impl Jvm { let raw_ptr = Box::into_raw(tx); // Find the address of tx let address_string = format!("{:p}", raw_ptr); - let address = i64::from_str_radix(&address_string[2..], 16).unwrap(); + let address = u64::from_str_radix(&address_string[2..], 16).unwrap(); // Second argument: create a jstring to pass as argument for the method_name let method_name_jstring: jstring = @@ -944,7 +944,7 @@ impl Jvm { let raw_ptr = Box::into_raw(tx); // Find the address of tx let address_string = format!("{:p}", raw_ptr); - let address = i64::from_str_radix(&address_string[2..], 16).unwrap(); + let address = u64::from_str_radix(&address_string[2..], 16).unwrap(); // Call the method of the instance let _ = (opt_to_res(cache::get_jni_call_void_method())?)(