Skip to content

Commit

Permalink
keep the cast for name_pointers
Browse files Browse the repository at this point in the history
It is needed because currently it fails on Linux ARM64 with:
```
error[E0308]: mismatched types
    --> src/bcf/header.rs:120:17
     |
117  |             htslib::bcf_hdr_subset(
     |             ---------------------- arguments to this function are incorrect
...
120  |                 name_pointers.as_ptr(),
     |                 ^^^^^^^^^^^^^^^^^^^^^^ expected `*const *mut u8`, found `*const *mut i8`
     |
     = note: expected raw pointer `*const *mut u8`
                found raw pointer `*const *mut i8`
```

Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g committed Feb 19, 2025
1 parent 3b64869 commit 97d0c8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bcf/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,13 @@ impl Header {
.map(|&s| ffi::CString::new(s).unwrap())
.collect();
let name_pointers: Vec<_> = names.iter().map(|s| s.as_ptr() as *mut i8).collect();
#[allow(clippy::unnecessary_cast)]
let name_pointers_ptr = name_pointers.as_ptr() as *const *mut c_char;
let inner = unsafe {
htslib::bcf_hdr_subset(
header.inner,
samples.len() as i32,
name_pointers.as_ptr(),
name_pointers_ptr,
imap.as_mut_ptr(),
)
};
Expand Down

0 comments on commit 97d0c8c

Please sign in to comment.