diff options
| -rw-r--r-- | dome_key_map.h | 2 | ||||
| -rw-r--r-- | includer.c | 2 | ||||
| -rw-r--r-- | src/cocoa_bridge.rs | 7 | 
3 files changed, 6 insertions, 5 deletions
| diff --git a/dome_key_map.h b/dome_key_map.h index f3c3f68..c6bf4c1 100644 --- a/dome_key_map.h +++ b/dome_key_map.h @@ -27,4 +27,4 @@ typedef struct {    size_t length;  } Trigger; -const CKeyActionResult *c_run_key_action(Trigger trigger); +const CKeyActionResult *c_run_key_action(const Trigger *trigger); @@ -9,7 +9,7 @@ int main() {  		.buttons = buttons,  		.length = SIZE  	}; -	const CKeyActionResult *result = c_run_key_action(trigger); +	const CKeyActionResult *result = c_run_key_action(&trigger);  	printf("%s", result->action);  	return 0; diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index 9392fcb..4d63c44 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -61,12 +61,13 @@ pub struct CKeyActionResult {  #[no_mangle]  pub extern "C" fn c_run_key_action( -    trigger: Trigger, +    trigger: *const Trigger,  ) -> *const CKeyActionResult {      let trigger = unsafe { -        assert!(!trigger.buttons.is_null()); +        assert!(!trigger.is_null()); +        assert!(!(*trigger).buttons.is_null()); -        slice::from_raw_parts(trigger.buttons, trigger.length as usize) +        slice::from_raw_parts((*trigger).buttons, (*trigger).length as usize)      };      let result = match run_key_action_for_mode(trigger, None) { | 
