Skip to content

Commit 981217e

Browse files
XadillaXrichardlau
authored andcommitted
src: replace autos in node_api.cc
PR-URL: #38852 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent b0a1984 commit 981217e

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/node_api.cc

+14-11
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,8 @@ struct napi_async_cleanup_hook_handle__ {
673673
}
674674

675675
static void Hook(void* data, void (*done_cb)(void*), void* done_data) {
676-
auto handle = static_cast<napi_async_cleanup_hook_handle__*>(data);
676+
napi_async_cleanup_hook_handle__* handle =
677+
static_cast<napi_async_cleanup_hook_handle__*>(data);
677678
handle->done_cb_ = done_cb;
678679
handle->done_data_ = done_data;
679680
handle->user_hook_(handle, handle->user_data_);
@@ -807,7 +808,7 @@ napi_status napi_async_init(napi_env env,
807808
v8::Local<v8::String> v8_resource_name;
808809
CHECK_TO_STRING(env, context, v8_resource_name, async_resource_name);
809810

810-
auto async_context =
811+
v8impl::AsyncContext* async_context =
811812
new v8impl::AsyncContext(reinterpret_cast<node_napi_env>(env),
812813
v8_resource,
813814
v8_resource_name,
@@ -863,7 +864,7 @@ napi_status napi_make_callback(napi_env env,
863864
reinterpret_cast<v8::Local<v8::Value>*>(const_cast<napi_value*>(argv)),
864865
{0, 0});
865866
} else {
866-
auto node_async_context =
867+
v8impl::AsyncContext* node_async_context =
867868
reinterpret_cast<v8impl::AsyncContext*>(async_context);
868869
callback_result = node_async_context->MakeCallback(
869870
v8recv,
@@ -892,7 +893,7 @@ napi_status napi_create_buffer(napi_env env,
892893
NAPI_PREAMBLE(env);
893894
CHECK_ARG(env, result);
894895

895-
auto maybe = node::Buffer::New(env->isolate, length);
896+
v8::MaybeLocal<v8::Object> maybe = node::Buffer::New(env->isolate, length);
896897

897898
CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);
898899

@@ -923,11 +924,12 @@ napi_status napi_create_external_buffer(napi_env env,
923924
env, finalize_cb, nullptr, finalize_hint,
924925
v8impl::Finalizer::kKeepEnvReference);
925926

926-
auto maybe = node::Buffer::New(isolate,
927-
static_cast<char*>(data),
928-
length,
929-
v8impl::BufferFinalizer::FinalizeBufferCallback,
930-
finalizer);
927+
v8::MaybeLocal<v8::Object> maybe = node::Buffer::New(
928+
isolate,
929+
static_cast<char*>(data),
930+
length,
931+
v8impl::BufferFinalizer::FinalizeBufferCallback,
932+
finalizer);
931933

932934
CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);
933935

@@ -947,8 +949,9 @@ napi_status napi_create_buffer_copy(napi_env env,
947949
NAPI_PREAMBLE(env);
948950
CHECK_ARG(env, result);
949951

950-
auto maybe = node::Buffer::Copy(env->isolate,
951-
static_cast<const char*>(data), length);
952+
v8::MaybeLocal<v8::Object> maybe = node::Buffer::Copy(
953+
env->isolate,
954+
static_cast<const char*>(data), length);
952955

953956
CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);
954957

0 commit comments

Comments
 (0)