mirror of
https://github.com/actix/actix-web.git
synced 2024-12-30 12:00:38 +00:00
remove unsafe
This commit is contained in:
parent
1c3b32169e
commit
5b7aed101a
1 changed files with 8 additions and 9 deletions
|
@ -260,15 +260,14 @@ impl Frame {
|
||||||
}
|
}
|
||||||
|
|
||||||
// unmask
|
// unmask
|
||||||
if let Some(mask) = mask {
|
let data = if let Some(mask) = mask {
|
||||||
// Unsafe: request body stream is owned by WsStream. only one ref to
|
let mut buf = BytesMut::new();
|
||||||
// bytes exists. Bytes object get freezed in continuous non-overlapping blocks
|
buf.extend_from_slice(&data);
|
||||||
let p: &mut [u8] = unsafe {
|
apply_mask(&mut buf, mask);
|
||||||
let ptr: &[u8] = &data;
|
buf.freeze()
|
||||||
&mut *(ptr as *const _ as *mut _)
|
} else {
|
||||||
};
|
data
|
||||||
apply_mask(p, mask);
|
};
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Async::Ready(Some(Frame {
|
Ok(Async::Ready(Some(Frame {
|
||||||
finished,
|
finished,
|
||||||
|
|
Loading…
Reference in a new issue