diff --git a/include/spdlog/details/udp_client.h b/include/spdlog/details/udp_client.h index 8d9c71fa..9825fdb3 100644 --- a/include/spdlog/details/udp_client.h +++ b/include/spdlog/details/udp_client.h @@ -69,10 +69,9 @@ public: // Send exactly n_bytes of the given data. // On error close the connection and throw. void send(const char *data, size_t n_bytes) { - ssize_t toslen = 0; - socklen_t tolen = sizeof(struct sockaddr); - if ((toslen = ::sendto(socket_, data, n_bytes, 0, (struct sockaddr *)&sockAddr_, tolen)) == - -1) { + socklen_t tolen = sizeof(sockAddr_); + if (::sendto(socket_, data, n_bytes, 0, reinterpret_cast(&sockAddr_), + tolen) == -1) { throw_spdlog_ex("sendto(2) failed", errno); } }