diff options
author | Yash Ladha <yashladhapankajladha123@gmail.com> | 2020-04-16 16:26:27 +0300 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2020-04-25 18:15:55 +0300 |
commit | 658cae06846877a16308b100931c7c8d6f1ed27c (patch) | |
tree | 43d1186259707e40e65f59153a9e377f5661e688 /src/tcp_wrap.cc | |
parent | 74c393dd93cc0e461e3796fbcc09545fcacdecaf (diff) |
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>
Diffstat (limited to 'src/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 1aca3a5e6ae..619c9ef6196 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); |