Skip to content

Commit

Permalink
common.rs: add missing call to DSS_Dispose_PPAnsiChar
Browse files Browse the repository at this point in the history
  • Loading branch information
PMeira committed Jan 16, 2024
1 parent 5a1b5bf commit 8e68881
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ impl DSSContext {
(c_strs, c_ptrs)
}

pub fn GetStringArray(&self, data: *mut *mut c_char, cnt: [i32; 4]) -> Result<Box::<[String]>, DSSError> {
pub fn GetStringArray(&self, mut data: *mut *mut c_char, cnt: [i32; 4]) -> Result<Box::<[String]>, DSSError> {
self.DSSError()?;
let res_cnt = cnt[0] as usize;
let cdata = unsafe { from_raw_parts_mut(data, res_cnt) };
Ok(unsafe { (*cdata).iter_mut().map(|s| CStr::from_ptr(*s).to_string_lossy().into_owned()).collect() })
let res = unsafe { (*cdata).iter_mut().map(|s| CStr::from_ptr(*s).to_string_lossy().into_owned()).collect() };
unsafe { dss_capi::DSS_Dispose_PPAnsiChar(&mut data, cnt[0]) };
Ok(res)
}

pub fn GetFloat64ArrayGR(&self) -> Result<Box::<[f64]>, DSSError> {
Expand Down

0 comments on commit 8e68881

Please sign in to comment.