{dynamic,fixed}_index: replace mem::uninitialized
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
f93b55b057
commit
5e58e1bb7d
|
@ -141,10 +141,17 @@ impl DynamicIndexReader {
|
|||
};
|
||||
|
||||
let end = unsafe { *(self.index.add(pos*40) as *const u64) };
|
||||
let mut digest: [u8; 32] = unsafe { std::mem::uninitialized() };
|
||||
unsafe { std::ptr::copy_nonoverlapping(self.index.add(pos*40+8), digest.as_mut_ptr(), 32); }
|
||||
|
||||
Ok((start, end, digest))
|
||||
let mut digest = std::mem::MaybeUninit::<[u8; 32]>::uninit();
|
||||
unsafe {
|
||||
std::ptr::copy_nonoverlapping(
|
||||
self.index.add(pos*40+8),
|
||||
(*digest.as_mut_ptr()).as_mut_ptr(),
|
||||
32,
|
||||
);
|
||||
}
|
||||
|
||||
Ok((start, end, unsafe { digest.assume_init() }))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -153,10 +153,16 @@ impl FixedIndexReader {
|
|||
end = self.size;
|
||||
}
|
||||
|
||||
let mut digest: [u8; 32] = unsafe { std::mem::uninitialized() };
|
||||
unsafe { std::ptr::copy_nonoverlapping(self.index.add(pos*32), digest.as_mut_ptr(), 32); }
|
||||
let mut digest = std::mem::MaybeUninit::<[u8; 32]>::uninit();
|
||||
unsafe {
|
||||
std::ptr::copy_nonoverlapping(
|
||||
self.index.add(pos*32),
|
||||
(*digest.as_mut_ptr()).as_mut_ptr(),
|
||||
32,
|
||||
);
|
||||
}
|
||||
|
||||
Ok((start, end, digest))
|
||||
Ok((start, end, unsafe { digest.assume_init() }))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in New Issue