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 <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]>
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‎

Lines changed: 3 additions & 2 deletions
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-
unsignedint delay = args[1].As<Uint32>()->Value();
188+
unsignedint delay = static_cast<unsignedint>(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
voidTCPWrap::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](constchar* ip_address, sockaddr_in* addr){
284285
returnuv_ip4_addr(ip_address, port, addr);

0 commit comments

Comments
(0)