Fixed cppcheck errors

This commit is contained in:
SChernykh 2023-05-23 20:11:00 +02:00
parent cd57ab6ad9
commit 3fdadf3eb5
5 changed files with 7 additions and 7 deletions

View file

@ -290,9 +290,9 @@ private:
static FORCEINLINE void strip_colors(char* buf, uint32_t& size)
{
char* p_read = buf;
const char* p_read = buf;
char* p_write = buf;
char* buf_end = buf + size;
const char* buf_end = buf + size;
bool is_color = false;

View file

@ -1714,7 +1714,7 @@ void P2PServer::P2PClient::send_handshake_solution(const uint8_t (&challenge)[CH
return;
}
uint64_t* value = reinterpret_cast<uint64_t*>(work->solution.h);
const uint64_t* value = reinterpret_cast<uint64_t*>(work->solution.h);
uint64_t high;
umul128(value[HASH_SIZE / sizeof(uint64_t) - 1], CHALLENGE_DIFFICULTY, &high);
@ -1861,7 +1861,7 @@ bool P2PServer::P2PClient::on_handshake_solution(const uint8_t* buf)
// Check that incoming connection provided enough PoW
if (m_isIncoming) {
uint64_t* value = reinterpret_cast<uint64_t*>(solution.h);
const uint64_t* value = reinterpret_cast<uint64_t*>(solution.h);
uint64_t high;
umul128(value[HASH_SIZE / sizeof(uint64_t) - 1], CHALLENGE_DIFFICULTY, &high);

View file

@ -940,7 +940,7 @@ void SideChain::print_status(bool obtain_sidechain_lock) const
blocks_in_window.emplace(uncle_id);
auto it = m_blocksById.find(uncle_id);
if (it != m_blocksById.end()) {
PoolBlock* uncle = it->second;
const PoolBlock* uncle = it->second;
if (tip_height - uncle->m_sidechainHeight < window_size) {
++total_uncles_in_window;
if (uncle->m_minerWallet == w) {

View file

@ -1119,7 +1119,7 @@ bool TCPServer::Client::on_proxy_handshake(char* data, uint32_t size)
case Socks5ProxyState::ConnectRequestSent:
if (m_numRead >= 4) {
uint8_t* p = reinterpret_cast<uint8_t*>(m_readBuf);
const uint8_t* p = reinterpret_cast<uint8_t*>(m_readBuf);
if ((p[0] != 5) && (p[1] != 0) && p[2] != 0) {
LOGWARN(5, "SOCKS5 proxy returned an invalid reply to CONNECT");
return false;

View file

@ -188,7 +188,7 @@ bool ZMQReader::connect(const std::string& address)
void ZMQReader::parse(char* data, size_t size)
{
char* value = data;
char* end = data + size;
const char* end = data + size;
while ((value < end) && (*value != ':')) {
++value;