mirror of
https://github.com/denoland/deno.git
synced 2024-12-12 02:27:46 -05:00
chore(ext/ffi): Remove unnecessary byte_offset conditional slicing (#15320)
This commit is contained in:
parent
c416553a6b
commit
210e1445f2
1 changed files with 3 additions and 15 deletions
|
@ -1030,11 +1030,7 @@ fn ffi_parse_pointer_arg(
|
||||||
type_error("Invalid FFI ArrayBufferView, expected data in the buffer")
|
type_error("Invalid FFI ArrayBufferView, expected data in the buffer")
|
||||||
})?
|
})?
|
||||||
.get_backing_store();
|
.get_backing_store();
|
||||||
if byte_offset > 0 {
|
&backing_store[byte_offset..] as *const _ as *const u8
|
||||||
&backing_store[byte_offset..] as *const _ as *const u8
|
|
||||||
} else {
|
|
||||||
&backing_store[..] as *const _ as *const u8
|
|
||||||
}
|
|
||||||
} else if let Ok(value) = v8::Local::<v8::BigInt>::try_from(arg) {
|
} else if let Ok(value) = v8::Local::<v8::BigInt>::try_from(arg) {
|
||||||
value.u64_value().0 as usize as *const u8
|
value.u64_value().0 as usize as *const u8
|
||||||
} else if let Ok(value) = v8::Local::<v8::Number>::try_from(arg) {
|
} else if let Ok(value) = v8::Local::<v8::Number>::try_from(arg) {
|
||||||
|
@ -1592,11 +1588,7 @@ unsafe fn do_ffi_callback(
|
||||||
.buffer(scope)
|
.buffer(scope)
|
||||||
.expect("Unable to deserialize result parameter.")
|
.expect("Unable to deserialize result parameter.")
|
||||||
.get_backing_store();
|
.get_backing_store();
|
||||||
if byte_offset > 0 {
|
&backing_store[byte_offset..] as *const _ as *const u8
|
||||||
&backing_store[byte_offset..] as *const _ as *const u8
|
|
||||||
} else {
|
|
||||||
&backing_store[..] as *const _ as *const u8
|
|
||||||
}
|
|
||||||
} else if let Ok(value) = v8::Local::<v8::BigInt>::try_from(value) {
|
} else if let Ok(value) = v8::Local::<v8::BigInt>::try_from(value) {
|
||||||
value.u64_value().0 as usize as *const u8
|
value.u64_value().0 as usize as *const u8
|
||||||
} else if let Ok(value) = v8::Local::<v8::ArrayBuffer>::try_from(value) {
|
} else if let Ok(value) = v8::Local::<v8::ArrayBuffer>::try_from(value) {
|
||||||
|
@ -2039,11 +2031,7 @@ where
|
||||||
})?
|
})?
|
||||||
.get_backing_store();
|
.get_backing_store();
|
||||||
let byte_offset = value.byte_offset();
|
let byte_offset = value.byte_offset();
|
||||||
if byte_offset > 0 {
|
&backing_store[byte_offset..] as *const _ as *const u8
|
||||||
&backing_store[byte_offset..] as *const _ as *const u8
|
|
||||||
} else {
|
|
||||||
&backing_store[..] as *const _ as *const u8
|
|
||||||
}
|
|
||||||
} else if let Ok(value) = v8::Local::<v8::ArrayBuffer>::try_from(buf.v8_value)
|
} else if let Ok(value) = v8::Local::<v8::ArrayBuffer>::try_from(buf.v8_value)
|
||||||
{
|
{
|
||||||
let backing_store = value.get_backing_store();
|
let backing_store = value.get_backing_store();
|
||||||
|
|
Loading…
Reference in a new issue