refactor: replace multiple C-style casts to reinterpret_cast

This commit is contained in:
Konstantin Akimov 2024-02-23 17:23:42 +07:00
parent f36bb1f085
commit 3abeab16d3
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
3 changed files with 6 additions and 6 deletions

View File

@ -297,10 +297,10 @@ struct SaltedHasherImpl<llmq::CQuorumDataRequestKey>
static std::size_t CalcHash(const llmq::CQuorumDataRequestKey& v, uint64_t k0, uint64_t k1)
{
CSipHasher c(k0, k1);
c.Write((unsigned char*)&(v.proRegTx), sizeof(v.proRegTx));
c.Write((unsigned char*)&(v.m_we_requested), sizeof(v.m_we_requested));
c.Write((unsigned char*)&(v.quorumHash), sizeof(v.quorumHash));
c.Write((unsigned char*)&(v.llmqType), sizeof(v.llmqType));
c.Write(reinterpret_cast<const unsigned char*>(&v.proRegTx), sizeof(v.proRegTx));
c.Write(reinterpret_cast<const unsigned char*>(&v.m_we_requested), sizeof(v.m_we_requested));
c.Write(reinterpret_cast<const unsigned char*>(&v.quorumHash), sizeof(v.quorumHash));
c.Write(reinterpret_cast<const unsigned char*>(&v.llmqType), sizeof(v.llmqType));
return c.Finalize();
}
};

View File

@ -231,7 +231,7 @@ int StatsdClient::send(const std::string& message)
{
return ret;
}
ret = sendto(d->sock, message.data(), message.size(), 0, (struct sockaddr *) &d->server, sizeof(d->server));
ret = sendto(d->sock, message.data(), message.size(), 0, reinterpret_cast<const sockaddr*>(&d->server), sizeof(d->server));
if ( ret == -1) {
snprintf(d->errmsg, sizeof(d->errmsg),
"sendto server fail, host=%s:%d, err=%m", d->host.c_str(), d->port);

View File

@ -244,7 +244,7 @@ using DebugLock = UniqueLock<typename std::remove_reference<typename std::remove
#define LEAVE_CRITICAL_SECTION(cs) \
{ \
std::string lockname; \
CheckLastCritical((void*)(&cs), lockname, #cs, __FILE__, __LINE__); \
CheckLastCritical(reinterpret_cast<void*>(&cs), lockname, #cs, __FILE__, __LINE__); \
(cs).unlock(); \
LeaveCritical(); \
}