fix: wrap qsort_r unsafe ptr calls in unsafe blocks (Rust 2024 edition)

This commit is contained in:
Red Bear OS
2026-07-10 01:53:12 +03:00
parent a1b2384631
commit 73226578f0
+3 -3
View File
@@ -1157,10 +1157,10 @@ pub unsafe extern "C" fn qsort_r(
if let Some(comp) = compar {
for i in 0..nel {
for j in (i + 1)..nel {
let a = base.cast::<u8>().add(i * width).cast::<c_void>();
let b = base.cast::<u8>().add(j * width).cast::<c_void>();
let a = unsafe { base.cast::<u8>().add(i * width).cast::<c_void>() };
let b = unsafe { base.cast::<u8>().add(j * width).cast::<c_void>() };
if comp(a, b, arg) > 0 {
ptr::swap_nonoverlapping(a.cast::<u8>(), b.cast::<u8>(), width);
unsafe { ptr::swap_nonoverlapping(a.cast::<u8>(), b.cast::<u8>(), width) };
}
}
}