Skip to content

Commit

Permalink
fix(ext/ffi): use anybuffer for op_ffi_buf_copy_into (#21006)
Browse files Browse the repository at this point in the history
Fixes #21005
  • Loading branch information
littledivy authored Oct 28, 2023
1 parent daf9756 commit 5b2d9fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/ffi/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test_ffi/tests/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5b2d9fb

Please sign in to comment.