From fcdcc8c0c3316857e327bb3c0109fd244f1ec409 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 26 Nov 2022 06:37:43 -0800 Subject: feat(ops): support raw pointer arguments (#16826) See https://github.com/denoland/deno/pull/16814#discussion_r1032744083. Allows nullable buffers in low-level ops like FFI: ```rust fn op_ffi_ptr_of( state: &mut OpState, buf: *const u8, out: &mut [u32], ) where FP: FfiPermissions + 'static { // .. } ``` --- ext/ffi/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/ffi') diff --git a/ext/ffi/lib.rs b/ext/ffi/lib.rs index 3de204ef3..65d64af33 100644 --- a/ext/ffi/lib.rs +++ b/ext/ffi/lib.rs @@ -2065,7 +2065,7 @@ fn op_ffi_call_nonblocking<'scope>( #[op(fast)] fn op_ffi_ptr_of( state: &mut deno_core::OpState, - buf: &[u8], + buf: *const u8, out: &mut [u32], ) -> Result<(), AnyError> where @@ -2084,7 +2084,7 @@ where // SAFETY: Out buffer was asserted to be at least large enough to hold a usize, and properly aligned. let out = unsafe { &mut *outptr }; - *out = buf.as_ptr() as usize; + *out = buf as usize; Ok(()) } -- cgit v1.2.3