summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYash Ladha <yashladhapankajladha123@gmail.com>2020-04-16 18:56:27 +0530
committerRuben Bridgewater <ruben@bridgewater.de>2020-04-28 13:58:24 +0200
commitf15569001d0d9316a45600993507049fa19cbfc1 (patch)
tree9655b9f90403cd6e8a88f30770a40e5ebba31ec5
parent880969974c78d18eb5f694fe684e13de485e8316 (diff)
downloadnode-new-f15569001d0d9316a45600993507049fa19cbfc1.tar.gz
src: assignment to valid type
We are converting the argument to a uint32_t value but the lvalue is not consistent with the casting. PR-URL: https://github.com/nodejs/node/pull/32879 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
-rw-r--r--src/tcp_wrap.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc
index 1aca3a5e6a..619c9ef619 100644
--- a/src/tcp_wrap.cc
+++ b/src/tcp_wrap.cc
@@ -185,7 +185,7 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
Environment* env = wrap->env();
int enable;
if (!args[0]->Int32Value(env->context()).To(&enable)) return;
- unsigned int delay = args[1].As<Uint32>()->Value();
+ unsigned int delay = static_cast<unsigned int>(args[1].As<Uint32>()->Value());
int err = uv_tcp_keepalive(&wrap->handle_, enable, delay);
args.GetReturnValue().Set(err);
}
@@ -278,7 +278,8 @@ void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
CHECK(args[2]->IsUint32());
- int port = args[2].As<Uint32>()->Value();
+ // explicit cast to fit to libuv's type expectation
+ int port = static_cast<int>(args[2].As<Uint32>()->Value());
Connect<sockaddr_in>(args,
[port](const char* ip_address, sockaddr_in* addr) {
return uv_ip4_addr(ip_address, port, addr);