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:
Divy Srivastava 2023-10-28 00:02:57 -07:00 committed by GitHub
parent daf9756127
commit 5b2d9fb8d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -177,7 +177,7 @@ pub fn op_ffi_buf_copy_into<FP>(
state: &mut OpState,
src: *mut c_void,
#[number] offset: isize,
#[buffer] dst: &mut [u8],
#[anybuffer] dst: &mut [u8],
#[number] len: usize,
) -> Result<(), AnyError>
where

View file

@ -327,6 +327,8 @@ const into2 = new Uint8Array(3);
const into2ptr = Deno.UnsafePointer.of(into2);
const into2ptrView = new Deno.UnsafePointerView(into2ptr);
const into3 = new Uint8Array(3);
const into4 = new Uint16Array(3);
ptrView.copyInto(into4);
ptrView.copyInto(into);
console.log([...into]);
ptrView.copyInto(into2, 3);