remove unsafe copy code

copy_nonoverlapping is basically a memcpy which can also be done
via copy_from_slice which is not unsafe
(copy_from_slice uses copy_nonoverlapping internally)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-06-18 13:55:19 +02:00 committed by Dietmar Maurer
parent 3352ee5656
commit bde8e243cf

View File

@ -363,9 +363,7 @@ impl<S: ReadChunk> std::io::Read for BufferedDynamicReader<S> {
data.len()
};
unsafe {
std::ptr::copy_nonoverlapping(data.as_ptr(), buf.as_mut_ptr(), n);
}
buf[0..n].copy_from_slice(&data[0..n]);
self.read_offset += n as u64;