Added cppcheck scripts

This commit is contained in:
SChernykh
2021-09-02 12:29:50 +02:00
parent 7092667301
commit bab148fbad
14 changed files with 30 additions and 6 deletions
+1
View File
@@ -95,6 +95,7 @@ BlockTemplate::BlockTemplate(const BlockTemplate& b)
*this = b;
}
// cppcheck-suppress operatorEqVarError
BlockTemplate& BlockTemplate::operator=(const BlockTemplate& b)
{
if (this == &b) {
+1
View File
@@ -288,6 +288,7 @@ NOINLINE void Stream::writeCurrentTime()
m_numberWidth = 4;
*this << (mcs / 100);
// cppcheck-suppress redundantAssignment
m_numberWidth = 1;
}
+1 -3
View File
@@ -24,7 +24,7 @@
#include <atomic>
#include <type_traits>
#include "dbghelp.h"
#include <DbgHelp.h>
#pragma comment(lib, "Dbghelp.lib")
@@ -103,10 +103,8 @@ FORCEINLINE static void remove_allocation(void* p)
const size_t index = hasher(p) & (N - 1);
bool found = false;
for (uint32_t prev = 0, k = first[index]; k != 0; prev = k, k = next[k]) {
if (allocations[k].p == p) {
found = true;
allocations[k].allocated_size = 0;
if (prev) {
next[prev] = next[k];
+1 -1
View File
@@ -810,7 +810,7 @@ void p2pool::api_update_pool_stats()
}
uint64_t t;
const difficulty_type diff = m_sideChain->difficulty();
const difficulty_type& diff = m_sideChain->difficulty();
const uint64_t hashrate = udiv128(diff.hi, diff.lo, m_sideChain->block_time(), &t);
const uint64_t miners = m_sideChain->miner_count();
const difficulty_type total_hashes = m_sideChain->total_hashes();
+1
View File
@@ -120,6 +120,7 @@ void p2pool_api::dump_to_file()
{
MutexLock lock(m_dumpDataLock);
data = std::move(m_dumpData);
// cppcheck-suppress accessMoved
m_dumpData.clear();
}
+1
View File
@@ -72,6 +72,7 @@ PoolBlock::PoolBlock(const PoolBlock& b)
operator=(b);
}
// cppcheck-suppress operatorEqVarError
PoolBlock& PoolBlock::operator=(const PoolBlock& b)
{
if (this == &b) {
+1
View File
@@ -201,6 +201,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, SideChain& sidechai
const int sidechain_hash_offset = static_cast<int>((data - data_begin) + outputs_blob_size_diff);
READ_BUF(m_sidechainId.h, HASH_SIZE);
// cppcheck-suppress duplicateExpression
if (static_cast<uint64_t>(data - tx_extra_begin) != tx_extra_size) return __LINE__;
EXPECT_BYTE(0);
+1 -1
View File
@@ -748,7 +748,7 @@ void TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::on_new_client_nolock(uv_stream_t*
template<size_t READ_BUF_SIZE, size_t WRITE_BUF_SIZE>
TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::Client::Client()
{
reset();
Client::reset();
uv_mutex_init_checked(&m_writeBuffersLock);
uv_mutex_init_checked(&m_sendLock);
+1 -1
View File
@@ -98,7 +98,7 @@ template<typename T, size_t N> FORCEINLINE constexpr size_t array_size(T(&)[N])
void make_thread_background();
class BackgroundJobTracker
class BackgroundJobTracker : public nocopy_nomove
{
public:
BackgroundJobTracker();
+1
View File
@@ -103,6 +103,7 @@ Wallet::Wallet(const Wallet& w)
operator=(w);
}
// cppcheck-suppress operatorEqVarError
Wallet& Wallet::operator=(const Wallet& w)
{
if (this == &w) {