Skip to content

Commit 44c157e

Browse files
yashLadhaBethGriggs
authored andcommitted
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: #32879 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 4143c74 commit 44c157e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/tcp_wrap.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void TCPWrap::SetKeepAlive(const FunctionCallbackInfo<Value>& args) {
185185
Environment* env = wrap->env();
186186
int enable;
187187
if (!args[0]->Int32Value(env->context()).To(&enable)) return;
188-
unsigned int delay = args[1].As<Uint32>()->Value();
188+
unsigned int delay = static_cast<unsigned int>(args[1].As<Uint32>()->Value());
189189
int err = uv_tcp_keepalive(&wrap->handle_, enable, delay);
190190
args.GetReturnValue().Set(err);
191191
}
@@ -278,7 +278,8 @@ void TCPWrap::Listen(const FunctionCallbackInfo<Value>& args) {
278278

279279
void TCPWrap::Connect(const FunctionCallbackInfo<Value>& args) {
280280
CHECK(args[2]->IsUint32());
281-
int port = args[2].As<Uint32>()->Value();
281+
// explicit cast to fit to libuv's type expectation
282+
int port = static_cast<int>(args[2].As<Uint32>()->Value());
282283
Connect<sockaddr_in>(args,
283284
[port](const char* ip_address, sockaddr_in* addr) {
284285
return uv_ip4_addr(ip_address, port, addr);

0 commit comments

Comments
 (0)