@@ -172,8 +172,8 @@ void TCPServer::handleConnect()
172172{
173173 struct sockaddr_storage client_addr;
174174 socklen_t addrlen = sizeof (client_addr);
175- int client_fd = accept (listen_fd_, (struct sockaddr *)&client_addr, &addrlen);
176- if (client_fd < 0 )
175+ socket_t client_fd = accept (listen_fd_, (struct sockaddr *)&client_addr, &addrlen);
176+ if (client_fd == INVALID_SOCKET )
177177 {
178178 std::ostringstream ss;
179179 ss << " Failed to accept connection request on port " << port_;
@@ -207,7 +207,7 @@ void TCPServer::spin()
207207 tempfds_ = masterfds_;
208208
209209 // blocks until activity on any socket from tempfds
210- int sel = select (maxfd_ + 1 , &tempfds_, NULL , NULL , NULL );
210+ int sel = select (static_cast < int >( maxfd_ + 1 ) , &tempfds_, NULL , NULL , NULL );
211211 if (sel < 0 )
212212 {
213213 URCL_LOG_ERROR (" select() failed. Shutting down socket event handler." );
@@ -239,7 +239,7 @@ void TCPServer::spin()
239239 }
240240}
241241
242- void TCPServer::handleDisconnect (const int fd)
242+ void TCPServer::handleDisconnect (const socket_t fd)
243243{
244244 URCL_LOG_DEBUG (" %d disconnected." , fd);
245245 ur_close (fd);
@@ -259,7 +259,7 @@ void TCPServer::handleDisconnect(const int fd)
259259 }
260260}
261261
262- void TCPServer::readData (const int fd)
262+ void TCPServer::readData (const socket_t fd)
263263{
264264 memset (input_buffer_, 0 , INPUT_BUFFER_SIZE); // clear input buffer
265265 int nbytesrecv = recv (fd, input_buffer_, INPUT_BUFFER_SIZE, 0 );
@@ -307,7 +307,7 @@ void TCPServer::start()
307307 worker_thread_ = std::thread (&TCPServer::worker, this );
308308}
309309
310- bool TCPServer::write (const int fd, const uint8_t * buf, const size_t buf_len, size_t & written)
310+ bool TCPServer::write (const socket_t fd, const uint8_t * buf, const size_t buf_len, size_t & written)
311311{
312312 written = 0 ;
313313
@@ -316,7 +316,7 @@ bool TCPServer::write(const int fd, const uint8_t* buf, const size_t buf_len, si
316316 // handle partial sends
317317 while (written < buf_len)
318318 {
319- ssize_t sent = ::send (fd, reinterpret_cast <const char *>(buf + written), remaining, 0 );
319+ ssize_t sent = ::send (fd, reinterpret_cast <const char *>(buf + written), static_cast < socklen_t >( remaining) , 0 );
320320
321321 if (sent <= 0 )
322322 {
0 commit comments