mirror of
https://github.com/denoland/deno.git
synced 2025-02-07 23:06:50 -05:00
fix(ext/ffi): use anybuffer for op_ffi_buf_copy_into (#21006)
Fixes https://github.com/denoland/deno/issues/21005
This commit is contained in:
parent
daf9756127
commit
5b2d9fb8d4
2 changed files with 3 additions and 1 deletions
|
@ -177,7 +177,7 @@ pub fn op_ffi_buf_copy_into<FP>(
|
||||||
state: &mut OpState,
|
state: &mut OpState,
|
||||||
src: *mut c_void,
|
src: *mut c_void,
|
||||||
#[number] offset: isize,
|
#[number] offset: isize,
|
||||||
#[buffer] dst: &mut [u8],
|
#[anybuffer] dst: &mut [u8],
|
||||||
#[number] len: usize,
|
#[number] len: usize,
|
||||||
) -> Result<(), AnyError>
|
) -> Result<(), AnyError>
|
||||||
where
|
where
|
||||||
|
|
|
@ -327,6 +327,8 @@ const into2 = new Uint8Array(3);
|
||||||
const into2ptr = Deno.UnsafePointer.of(into2);
|
const into2ptr = Deno.UnsafePointer.of(into2);
|
||||||
const into2ptrView = new Deno.UnsafePointerView(into2ptr);
|
const into2ptrView = new Deno.UnsafePointerView(into2ptr);
|
||||||
const into3 = new Uint8Array(3);
|
const into3 = new Uint8Array(3);
|
||||||
|
const into4 = new Uint16Array(3);
|
||||||
|
ptrView.copyInto(into4);
|
||||||
ptrView.copyInto(into);
|
ptrView.copyInto(into);
|
||||||
console.log([...into]);
|
console.log([...into]);
|
||||||
ptrView.copyInto(into2, 3);
|
ptrView.copyInto(into2, 3);
|
||||||
|
|
Loading…
Add table
Reference in a new issue