clang-tidy: google-readability-casting (NFC)

This commit is contained in:
Peter Johnson
2020-12-28 11:04:20 -08:00
parent 32fa97d68d
commit c97c6dc065
17 changed files with 104 additions and 80 deletions

View File

@@ -190,7 +190,7 @@ std::unique_ptr<NetworkStream> TCPAcceptor::accept() {
socklen_t len = sizeof(address);
#endif
std::memset(&address, 0, sizeof(address));
int sd = ::accept(m_lsd, (struct sockaddr*)&address, &len);
int sd = ::accept(m_lsd, reinterpret_cast<struct sockaddr*>(&address), &len);
if (sd < 0) {
if (!m_shutdown) {
WPI_ERROR(m_logger, "accept() on port "

View File

@@ -108,7 +108,8 @@ std::unique_ptr<NetworkStream> TCPConnector::connect(const char* server,
WPI_ERROR(logger, "could not create socket");
return nullptr;
}
if (::connect(sd, (struct sockaddr*)&address, sizeof(address)) != 0) {
if (::connect(sd, reinterpret_cast<struct sockaddr*>(&address),
sizeof(address)) != 0) {
WPI_ERROR(logger, "connect() to " << server << " port " << port
<< " failed: " << SocketStrerror());
#ifdef _WIN32
@@ -152,8 +153,8 @@ std::unique_ptr<NetworkStream> TCPConnector::connect(const char* server,
#endif
// Connect with time limit
if ((result = ::connect(sd, (struct sockaddr*)&address, sizeof(address))) <
0) {
if ((result = ::connect(sd, reinterpret_cast<struct sockaddr*>(&address),
sizeof(address))) < 0) {
int my_errno = SocketErrno();
#ifdef _WIN32
if (my_errno == WSAEWOULDBLOCK || my_errno == WSAEINPROGRESS) {