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
1 changed files with 1 additions and 3 deletions

View File

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