Skip to content

Commit

Permalink
Merge pull request #82 from Pomettini/main
Browse files Browse the repository at this point in the history
Fixed mismatched type error in menu item API
  • Loading branch information
boozook authored Jan 17, 2024
2 parents df48ecd + 4a3a025 commit 5367162
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl System {
let raw_callback_ptr = Box::into_raw(wrapped_callback);
let raw_menu_item = pd_func_caller!(
(*self.0).addMenuItem,
c_text.as_ptr() as *mut core::ffi::c_char,
c_text.as_ptr(),
Some(Self::menu_item_callback),
raw_callback_ptr as *mut c_void
)?;
Expand Down Expand Up @@ -96,7 +96,7 @@ impl System {
let raw_callback_ptr = Box::into_raw(wrapped_callback);
let raw_menu_item = pd_func_caller!(
(*self.0).addCheckmarkMenuItem,
c_text.as_ptr() as *mut core::ffi::c_char,
c_text.as_ptr(),
initial_checked_state as c_int,
Some(Self::menu_item_callback),
raw_callback_ptr as *mut c_void
Expand Down Expand Up @@ -127,14 +127,14 @@ impl System {
.iter()
.map(|s| CString::new(s.clone()).map_err(|e| anyhow!("CString::new: {}", e)))
.collect::<Result<Vec<CString>, Error>>()?;
let c_options_ptrs: Vec<*const i8> = c_options.iter().map(|c| c.as_ptr()).collect();
let c_options_ptrs: Vec<*const u8> = c_options.iter().map(|c| c.as_ptr()).collect();
let c_options_ptrs_ptr = c_options_ptrs.as_ptr();
let option_titles = c_options_ptrs_ptr as *mut *const c_char;
let wrapped_callback = Box::new(callback);
let raw_callback_ptr = Box::into_raw(wrapped_callback);
let raw_menu_item = pd_func_caller!(
(*self.0).addOptionsMenuItem,
c_text.as_ptr() as *mut core::ffi::c_char,
c_text.as_ptr(),
option_titles,
options_count,
Some(Self::menu_item_callback),
Expand Down

0 comments on commit 5367162

Please sign in to comment.