mirror of
https://github.com/gabime/spdlog.git
synced 2026-04-10 11:34:29 +08: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:
@@ -69,10 +69,9 @@ public:
|
|||||||
// Send exactly n_bytes of the given data.
|
// Send exactly n_bytes of the given data.
|
||||||
// On error close the connection and throw.
|
// On error close the connection and throw.
|
||||||
void send(const char *data, size_t n_bytes) {
|
void send(const char *data, size_t n_bytes) {
|
||||||
ssize_t toslen = 0;
|
socklen_t tolen = sizeof(sockAddr_);
|
||||||
socklen_t tolen = sizeof(struct sockaddr);
|
if (::sendto(socket_, data, n_bytes, 0, reinterpret_cast<const sockaddr *>(&sockAddr_),
|
||||||
if ((toslen = ::sendto(socket_, data, n_bytes, 0, (struct sockaddr *)&sockAddr_, tolen)) ==
|
tolen) == -1) {
|
||||||
-1) {
|
|
||||||
throw_spdlog_ex("sendto(2) failed", errno);
|
throw_spdlog_ex("sendto(2) failed", errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user