Remove some unsafety (#131)
* Remove unsafety * Remove transmutes and pointer casts
This commit is contained in:
parent
ad4236263a
commit
3854ecdad6
|
@ -316,7 +316,7 @@ impl MemoryInstance {
|
||||||
|
|
||||||
unsafe { ::std::ptr::copy(
|
unsafe { ::std::ptr::copy(
|
||||||
buffer[read_region.range()].as_ptr(),
|
buffer[read_region.range()].as_ptr(),
|
||||||
buffer[write_region.range()].as_ptr() as *mut _,
|
buffer[write_region.range()].as_mut_ptr(),
|
||||||
len,
|
len,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ impl MemoryInstance {
|
||||||
|
|
||||||
unsafe { ::std::ptr::copy_nonoverlapping(
|
unsafe { ::std::ptr::copy_nonoverlapping(
|
||||||
buffer[read_region.range()].as_ptr(),
|
buffer[read_region.range()].as_ptr(),
|
||||||
buffer[write_region.range()].as_ptr() as *mut _,
|
buffer[write_region.range()].as_mut_ptr(),
|
||||||
len,
|
len,
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
|
||||||
use nan_preserving_float::{F32, F64};
|
use nan_preserving_float::{F32, F64};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::mem::transmute;
|
|
||||||
use std::{f32, i32, i64, u32, u64};
|
use std::{f32, i32, i64, u32, u64};
|
||||||
use TrapKind;
|
use TrapKind;
|
||||||
|
|
||||||
|
@ -547,11 +546,11 @@ impl TransmuteInto<f64> for i64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TransmuteInto<i32> for u32 {
|
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 {
|
impl TransmuteInto<i64> for u64 {
|
||||||
fn transmute_into(self) -> i64 { unsafe { transmute(self) } }
|
fn transmute_into(self) -> i64 { self as _ }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LittleEndianConvert for i8 {
|
impl LittleEndianConvert for i8 {
|
||||||
|
|
Loading…
Reference in New Issue