Remove some unsafety (#131)

* Remove unsafety

* Remove transmutes and pointer casts
This commit is contained in:
Jef 2018-10-25 14:17:25 +02:00 committed by Sergey Pepyakin
parent ad4236263a
commit 3854ecdad6
2 changed files with 4 additions and 5 deletions

View File

@ -316,7 +316,7 @@ impl MemoryInstance {
unsafe { ::std::ptr::copy(
buffer[read_region.range()].as_ptr(),
buffer[write_region.range()].as_ptr() as *mut _,
buffer[write_region.range()].as_mut_ptr(),
len,
)}
@ -345,7 +345,7 @@ impl MemoryInstance {
unsafe { ::std::ptr::copy_nonoverlapping(
buffer[read_region.range()].as_ptr(),
buffer[write_region.range()].as_ptr() as *mut _,
buffer[write_region.range()].as_mut_ptr(),
len,
)}

View File

@ -1,7 +1,6 @@
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use nan_preserving_float::{F32, F64};
use std::io;
use std::mem::transmute;
use std::{f32, i32, i64, u32, u64};
use TrapKind;
@ -547,11 +546,11 @@ impl TransmuteInto<f64> for i64 {
}
impl TransmuteInto<i32> for u32 {
fn transmute_into(self) -> i32 { unsafe { transmute(self) } }
fn transmute_into(self) -> i32 { self as _ }
}
impl TransmuteInto<i64> for u64 {
fn transmute_into(self) -> i64 { unsafe { transmute(self) } }
fn transmute_into(self) -> i64 { self as _ }
}
impl LittleEndianConvert for i8 {