datastore: avoid unsafe transmute, use to_ne_bytes
which is stable since rustc 1.32 but wasn't available in out
toolchain when this was originally written in commit 7bc1d7277
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
bc001e12e2
commit
b8858d5186
@ -373,14 +373,14 @@ impl DynamicIndexWriter {
|
||||
);
|
||||
}
|
||||
|
||||
let offset_le: &[u8; 8] = unsafe { &std::mem::transmute::<u64, [u8; 8]>(offset.to_le()) };
|
||||
let offset_le: [u8; 8] = offset.to_le().to_ne_bytes();
|
||||
|
||||
if let Some(ref mut csum) = self.csum {
|
||||
csum.update(offset_le);
|
||||
csum.update(&offset_le);
|
||||
csum.update(digest);
|
||||
}
|
||||
|
||||
self.writer.write_all(offset_le)?;
|
||||
self.writer.write_all(&offset_le)?;
|
||||
self.writer.write_all(digest)?;
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user