diff options
author | Jack Lloyd <[email protected]> | 2016-11-09 14:21:49 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-09 14:21:49 -0500 |
commit | e6bf87b6b0d4d9c3877b79de53de58dc34a3acca (patch) | |
tree | dfd672f072ec5fa97ea51c188dfa877818e1cd5a /src | |
parent | 72a898b26e0657391348a121d501328cb6b6cfdd (diff) |
Remove remaining old style casts.
Still not a hard error even in maintainer mode because sometimes
system headers pull in C style casts via macros (eg MAP_FAILED).
But, it not being a hard error makes it easy to backslide.
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/tls_client.cpp | 5 | ||||
-rw-r--r-- | src/cli/tls_server.cpp | 6 | ||||
-rw-r--r-- | src/lib/utils/http_util/http_util.cpp | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/cli/tls_client.cpp b/src/cli/tls_client.cpp index b97688386..de7e08086 100644 --- a/src/cli/tls_client.cpp +++ b/src/cli/tls_client.cpp @@ -240,7 +240,7 @@ class TLS_Client final : public Command, public Botan::TLS::Callbacks socket_info.sin_addr = *reinterpret_cast<struct in_addr*>(host_addr->h_addr); // FIXME - if(::connect(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0) + if(::connect(fd, reinterpret_cast<sockaddr*>(&socket_info), sizeof(struct sockaddr)) != 0) { ::close(fd); throw CLI_Error("connect failed"); @@ -289,8 +289,7 @@ class TLS_Client final : public Command, public Botan::TLS::Callbacks while(length) { - ssize_t sent = ::send(m_sockfd, (const char*)buf + offset, - length, MSG_NOSIGNAL); + ssize_t sent = ::send(m_sockfd, buf + offset, length, MSG_NOSIGNAL); if(sent == -1) { diff --git a/src/cli/tls_server.cpp b/src/cli/tls_server.cpp index 7fc38cf31..dd1c7f450 100644 --- a/src/cli/tls_server.cpp +++ b/src/cli/tls_server.cpp @@ -92,10 +92,10 @@ class TLS_Server final : public Command socklen_t from_len = sizeof(sockaddr_in); if(::recvfrom(server_fd, nullptr, 0, MSG_PEEK, - (struct sockaddr*)&from, &from_len) != 0) + reinterpret_cast<struct sockaddr*>(&from), &from_len) != 0) throw CLI_Error("Could not peek next packet"); - if(::connect(server_fd, (struct sockaddr*)&from, from_len) != 0) + if(::connect(server_fd, reinterpret_cast<struct sockaddr*>(&from), from_len) != 0) throw CLI_Error("Could not connect UDP socket"); fd = server_fd; @@ -192,7 +192,7 @@ class TLS_Server final : public Command // FIXME: support limiting listeners socket_info.sin_addr.s_addr = INADDR_ANY; - if(::bind(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0) + if(::bind(fd, reinterpret_cast<struct sockaddr*>(&socket_info), sizeof(struct sockaddr)) != 0) { ::close(fd); throw CLI_Error("server bind failed"); diff --git a/src/lib/utils/http_util/http_util.cpp b/src/lib/utils/http_util/http_util.cpp index 85bd1828b..970b90238 100644 --- a/src/lib/utils/http_util/http_util.cpp +++ b/src/lib/utils/http_util/http_util.cpp @@ -91,7 +91,7 @@ std::string http_transact(const std::string& hostname, socket_info.sin_addr = *reinterpret_cast<struct in_addr*>(host_addr->h_addr); // FIXME - if(::connect(fd, (sockaddr*)&socket_info, sizeof(struct sockaddr)) != 0) + if(::connect(fd, reinterpret_cast<sockaddr*>(&socket_info), sizeof(struct sockaddr)) != 0) throw HTTP_Error("HTTP connection to " + hostname + " failed"); size_t sent_so_far = 0; |