From 344d33eef110486bc094ba8d97a483379bf62752 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 8 Nov 2018 07:22:13 +0100 Subject: src: fix v8 compiler warnings in src This commit changes the code to use the maybe version. PR-URL: https://github.com/nodejs/node/pull/24246 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann --- src/cares_wrap.cc | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) (limited to 'src/cares_wrap.cc') diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 4fcfa12ba8e..e5d0319fa17 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1851,7 +1851,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) { continue; Local s = OneByteString(env->isolate(), ip); - results->Set(n, s); + results->Set(env->context(), n, s).FromJust(); n++; } }; @@ -2053,10 +2053,12 @@ void GetServers(const FunctionCallbackInfo& args) { CHECK_EQ(err, 0); Local ret = Array::New(env->isolate(), 2); - ret->Set(0, OneByteString(env->isolate(), ip)); - ret->Set(1, Integer::New(env->isolate(), cur->udp_port)); + ret->Set(env->context(), 0, OneByteString(env->isolate(), ip)).FromJust(); + ret->Set(env->context(), + 1, + Integer::New(env->isolate(), cur->udp_port)).FromJust(); - server_array->Set(i, ret); + server_array->Set(env->context(), i, ret).FromJust(); } ares_free_data(servers); @@ -2179,16 +2181,19 @@ void Initialize(Local target, env->SetMethod(target, "strerror", StrError); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET"), - Integer::New(env->isolate(), AF_INET)); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET6"), - Integer::New(env->isolate(), AF_INET6)); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_UNSPEC"), - Integer::New(env->isolate(), AF_UNSPEC)); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_ADDRCONFIG"), - Integer::New(env->isolate(), AI_ADDRCONFIG)); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_V4MAPPED"), - Integer::New(env->isolate(), AI_V4MAPPED)); + target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET"), + Integer::New(env->isolate(), AF_INET)).FromJust(); + target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), "AF_INET6"), + Integer::New(env->isolate(), AF_INET6)).FromJust(); + target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), + "AF_UNSPEC"), + Integer::New(env->isolate(), AF_UNSPEC)).FromJust(); + target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), + "AI_ADDRCONFIG"), + Integer::New(env->isolate(), AI_ADDRCONFIG)).FromJust(); + target->Set(env->context(), FIXED_ONE_BYTE_STRING(env->isolate(), + "AI_V4MAPPED"), + Integer::New(env->isolate(), AI_V4MAPPED)).FromJust(); Local aiw = BaseObject::MakeLazilyInitializedJSTemplate(env); @@ -2196,7 +2201,9 @@ void Initialize(Local target, Local addrInfoWrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "GetAddrInfoReqWrap"); aiw->SetClassName(addrInfoWrapString); - target->Set(addrInfoWrapString, aiw->GetFunction(context).ToLocalChecked()); + target->Set(env->context(), + addrInfoWrapString, + aiw->GetFunction(context).ToLocalChecked()).FromJust(); Local niw = BaseObject::MakeLazilyInitializedJSTemplate(env); @@ -2204,7 +2211,9 @@ void Initialize(Local target, Local nameInfoWrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "GetNameInfoReqWrap"); niw->SetClassName(nameInfoWrapString); - target->Set(nameInfoWrapString, niw->GetFunction(context).ToLocalChecked()); + target->Set(env->context(), + nameInfoWrapString, + niw->GetFunction(context).ToLocalChecked()).FromJust(); Local qrw = BaseObject::MakeLazilyInitializedJSTemplate(env); @@ -2212,7 +2221,9 @@ void Initialize(Local target, Local queryWrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "QueryReqWrap"); qrw->SetClassName(queryWrapString); - target->Set(queryWrapString, qrw->GetFunction(context).ToLocalChecked()); + target->Set(env->context(), + queryWrapString, + qrw->GetFunction(context).ToLocalChecked()).FromJust(); Local channel_wrap = env->NewFunctionTemplate(ChannelWrap::New); @@ -2239,8 +2250,8 @@ void Initialize(Local target, Local channelWrapString = FIXED_ONE_BYTE_STRING(env->isolate(), "ChannelWrap"); channel_wrap->SetClassName(channelWrapString); - target->Set(channelWrapString, - channel_wrap->GetFunction(context).ToLocalChecked()); + target->Set(env->context(), channelWrapString, + channel_wrap->GetFunction(context).ToLocalChecked()).FromJust(); } } // anonymous namespace -- cgit v1.2.3