From 6b240a892d40f91f30b81cae73964219ab04c55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ka=C4=9Fan=20Can=20=C5=9Eit?= Date: Sun, 4 Jan 2026 22:45:53 +0300 Subject: [PATCH] Replace C-style cast with reinterpret_cast in udp_client (#3509) * Replace C-style cast with reinterpret_cast in udp_Client * Update include/spdlog/details/udp_client.h Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Gabi Melman Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- include/spdlog/details/udp_client.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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); } }