From 3257f01771691ae2e093110351d378ec2df822c3 Mon Sep 17 00:00:00 2001 From: David Herman Date: Tue, 10 Sep 2024 23:25:58 -0700 Subject: [PATCH] argc can be usize now that we're not using the c++ backend --- crates/neon/src/sys/fun.rs | 4 ++-- crates/neon/src/types_impl/mod.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/neon/src/sys/fun.rs b/crates/neon/src/sys/fun.rs index fffd03cc3..9d9d461c1 100644 --- a/crates/neon/src/sys/fun.rs +++ b/crates/neon/src/sys/fun.rs @@ -87,10 +87,10 @@ pub unsafe fn construct( out: &mut Local, env: Env, fun: Local, - argc: i32, + argc: usize, argv: *const c_void, ) -> bool { - let status = napi::new_instance(env, fun, argc as usize, argv as *const _, out as *mut _); + let status = napi::new_instance(env, fun, argc, argv as *const _, out as *mut _); status == napi::Status::Ok } diff --git a/crates/neon/src/types_impl/mod.rs b/crates/neon/src/types_impl/mod.rs index 9b985b5d1..f6dcbf4ff 100644 --- a/crates/neon/src/types_impl/mod.rs +++ b/crates/neon/src/types_impl/mod.rs @@ -1051,7 +1051,7 @@ const V8_ARGC_LIMIT: usize = 65535; unsafe fn prepare_call<'a, 'b, C: Context<'a>>( cx: &mut C, args: &[Handle<'b, JsValue>], -) -> NeonResult<(i32, *const c_void)> { +) -> NeonResult<(usize, *const c_void)> { // Note: This cast is only save because `Handle<'_, JsValue>` is // guaranteed to have the same layout as a pointer because `Handle` // and `JsValue` are both `repr(C)` newtypes. @@ -1060,7 +1060,7 @@ unsafe fn prepare_call<'a, 'b, C: Context<'a>>( if argc > V8_ARGC_LIMIT { return cx.throw_range_error("too many arguments"); } - Ok((argc as i32, argv)) + Ok((argc, argv)) } impl JsFunction { @@ -1173,7 +1173,7 @@ where env.to_raw(), this.to_local(), callee, - argc as usize, + argc, argv.cast(), result.as_mut_ptr(), );