From b893c5b7bae81f894416574c0a18465314d46015 Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Thu, 16 Apr 2020 18:56:27 +0530 Subject: [PATCH] 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 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil --- src/tcp_wrap.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 1aca3a5e6aeeee..619c9ef6196373 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -185,7 +185,7 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo& args) { Environment* env = wrap->env(); int enable; if (!args[0]->Int32Value(env->context()).To(&enable)) return; - unsigned int delay = args[1].As()->Value(); + unsigned int delay = static_cast(args[1].As()->Value()); int err = uv_tcp_keepalive(&wrap->handle_, enable, delay); args.GetReturnValue().Set(err); } @@ -278,7 +278,8 @@ void TCPWrap::Listen(const FunctionCallbackInfo& args) { void TCPWrap::Connect(const FunctionCallbackInfo& args) { CHECK(args[2]->IsUint32()); - int port = args[2].As()->Value(); + // explicit cast to fit to libuv's type expectation + int port = static_cast(args[2].As()->Value()); Connect(args, [port](const char* ip_address, sockaddr_in* addr) { return uv_ip4_addr(ip_address, port, addr);