2
0
mirror of https://github.com/gabime/spdlog.git synced 2026-01-19 04:52:09 +00:00

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 <gmelman1@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Kağan Can Şit
2026-01-04 22:45:53 +03:00
committed by GitHub
parent 79524ddd08
commit 6b240a892d

View File

@@ -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<const sockaddr *>(&sockAddr_),
tolen) == -1) {
throw_spdlog_ex("sendto(2) failed", errno);
}
}