Skip to content

Commit

Permalink
argc can be usize now that we're not using the c++ backend
Browse files Browse the repository at this point in the history
  • Loading branch information
dherman committed Sep 11, 2024
1 parent dd1ffdf commit 3257f01
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/neon/src/sys/fun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions crates/neon/src/types_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 {
Expand Down Expand Up @@ -1173,7 +1173,7 @@ where
env.to_raw(),
this.to_local(),
callee,
argc as usize,
argc,
argv.cast(),
result.as_mut_ptr(),
);
Expand Down

0 comments on commit 3257f01

Please sign in to comment.