Skip to content

Commit

Permalink
Merge pull request #2737 from jamescowens/fix_compilation_warnings
Browse files Browse the repository at this point in the history
refactor: Fix compilation warnings
  • Loading branch information
jamescowens authored Feb 11, 2024
2 parents 616fc2d + 81c8154 commit baa544b
Show file tree
Hide file tree
Showing 39 changed files with 89 additions and 96 deletions.
4 changes: 2 additions & 2 deletions src/alert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ bool CAlert::Cancels(const CAlert& alert) const
return (alert.nID <= nCancel || setCancel.count(alert.nID));
}

bool CAlert::AppliesTo(int nVersion, std::string strSubVerIn) const
bool CAlert::AppliesTo(int version, std::string strSubVerIn) const
{
// TODO: rework for client-version-embedded-in-strSubVer ?
return (IsInEffect() &&
nMinVer <= nVersion && nVersion <= nMaxVer &&
nMinVer <= version && version <= nMaxVer &&
(setSubVer.empty() || setSubVer.count(strSubVerIn)));
}

Expand Down
2 changes: 1 addition & 1 deletion src/alert.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class CAlert : public CUnsignedAlert
uint256 GetHash() const;
bool IsInEffect() const;
bool Cancels(const CAlert& alert) const;
bool AppliesTo(int nVersion, std::string strSubVerIn) const;
bool AppliesTo(int version, std::string strSubVerIn) const;
bool AppliesToMe() const;
bool RelayTo(CNode* pnode) const;
bool CheckSignature() const;
Expand Down
2 changes: 1 addition & 1 deletion src/gridcoin/beacon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ template<> void BeaconRegistry::BeaconDB::HandleCurrentHistoricalEntries(GRC::Be
}

if (entry.m_status == BeaconStatusForStorage::ACTIVE) {
// Note that in the orginal activation, all the activations happen for a superblock, and then the expired_entry set is
// Note that in the original activation, all the activations happen for a superblock, and then the expired_entry set is
// cleared and then new expired entries recorded from the just committed SB. This method operates at the record level, but
// clearing the expired_entries for each ACTIVE record posting will achieve the same effect, because the entries are ordered
// the proper way. It is a little bit of undesired work, but it is not worth the complexity of feeding the boundaries
Expand Down
4 changes: 2 additions & 2 deletions src/gridcoin/contract/registry_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RegistryDB
//! \param entries The map of current entries.
//! \param pending_entries. The map of pending entries. This is not used in the general template, only in the beacons
//! specialization.
//! \param expired_entries. The map of expired pending entries. This is not used in the geenral template, only in the
//! \param expired_entries. The map of expired pending entries. This is not used in the general template, only in the
//! beacons specialization.
//!
//! \return block height up to and including which the entry records were stored.
Expand Down Expand Up @@ -230,7 +230,7 @@ class RegistryDB
}

//!
//! \brief Handles the passivation of previous historical entries that have been superceded by current entries.
//! \brief Handles the passivation of previous historical entries that have been superseded by current entries.
//!
//! \param historical_entry_ptr. Shared smart pointer to current historical entry already inserted into historical map.
//!
Expand Down
4 changes: 2 additions & 2 deletions src/gridcoin/gridcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ void InitializeContracts(CBlockIndex* pindexBest)
// for polls and votes. The reason for this is quite simple. Polls and votes are UNIQUE. The reversion of an add
// is simply to delete them. The wallet startup replay requirement is still required for polls and votes, because
// the Poll/Vote classes do not have a backing registry db yet.
const int& start_height = std::min(std::max(db_heights.GetLowestRegistryBlockHeight(), V11_height),
lookback_window_low_height);
int start_height = std::min(std::max(db_heights.GetLowestRegistryBlockHeight(), V11_height),
lookback_window_low_height);

LogPrintf("Gridcoin: Starting contract replay from height %i.", start_height);

Expand Down
8 changes: 4 additions & 4 deletions src/gridcoin/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* the following conditions are adhered to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
Expand All @@ -31,7 +31,7 @@
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young ([email protected])"
* The word 'cryptographic' can be left out if the rouines from the library
* The word 'cryptographic' can be left out if the routines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
Expand All @@ -49,7 +49,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* The licence and distribution terms for any publicly available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.] */
Expand Down Expand Up @@ -244,7 +244,7 @@ uint8_t *GRC__MD5(const uint8_t *data, size_t len, uint8_t out[MD5_DIGEST_LENGTH

// As pointed out by Wei Dai <[email protected]>, the above can be
// simplified to the code below. Wei attributes these optimizations
// to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel.
// to Peter Gutmann's SSH code, and he attributes it to Rich Schroeppel.
#define F(b, c, d) ((((c) ^ (d)) & (b)) ^ (d))
#define G(b, c, d) ((((b) ^ (c)) & (d)) ^ (c))
#define H(b, c, d) ((b) ^ (c) ^ (d))
Expand Down
2 changes: 0 additions & 2 deletions src/gridcoin/mrc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,6 @@ bool TrySignMRC(
CBlockIndex* pindex,
GRC::MRC& mrc) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
{
AssertLockHeld(cs_main);

// lock needs to be taken on pwallet here.
LOCK(pwallet->cs_wallet);

Expand Down
2 changes: 1 addition & 1 deletion src/gridcoin/quorum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class SuperblockValidator
std::vector<ResolvedPart> m_resolved_parts;

//!
//! \brief Divisor set by the \c ProjectCombiner for iteraton over each
//! \brief Divisor set by the \c ProjectCombiner for iteration over each
//! convergence combination.
//!
size_t m_combiner_mask;
Expand Down
8 changes: 8 additions & 0 deletions src/gridcoin/scraper/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,18 @@ namespace
{
pg->lastruntime = currenttime;

#if LIBCURL_VERSION_NUM >= 0x073700
curl_off_t speed;
#else
double speed;
#endif
CURLcode result;

#if LIBCURL_VERSION_NUM >= 0x073700
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD_T, &speed);
#else
result = curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &speed);
#endif

// Download speed update
if (result == CURLE_OK)
Expand Down
2 changes: 1 addition & 1 deletion src/gridcoin/scraper/scraper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ std::map<uint256, std::shared_ptr<CScraperManifest>> CScraperManifest::mapManife
ConvergedScraperStats ConvergedScraperStatsCache GUARDED_BY(cs_ConvergedScraperStatsCache) = {};

/**
* @brief Scraper loggger function
* @brief Scraper logger function
* @param eType
* @param sCall
* @param sMessage
Expand Down
2 changes: 1 addition & 1 deletion src/gridcoin/sidestake.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Allocation : public Fraction

//!
//! \brief Allocations extend the Fraction class and can also represent the result of the allocation constructed fraction
//! and the result of the muliplication of that fraction times the reward, which is in CAmount (i.e. int64_t).
//! and the result of the multiplication of that fraction times the reward, which is in CAmount (i.e. int64_t).
//!
//! \return CAmount of the Fraction representation of the actual allocation.
//!
Expand Down
22 changes: 11 additions & 11 deletions src/gridcoin/voting/builders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ PollBuilder PollBuilder::SetTitle(std::string title)
ToString(Poll::MAX_TITLE_SIZE)));
}

m_poll->m_title = std::move(title);
m_poll->m_title = title;

return std::move(*this);
}
Expand All @@ -1037,7 +1037,7 @@ PollBuilder PollBuilder::SetUrl(std::string url)
ToString(Poll::MAX_URL_SIZE)));
}

m_poll->m_url = std::move(url);
m_poll->m_url = url;

return std::move(*this);
}
Expand All @@ -1050,7 +1050,7 @@ PollBuilder PollBuilder::SetQuestion(std::string question)
ToString(Poll::MAX_QUESTION_SIZE)));
}

m_poll->m_question = std::move(question);
m_poll->m_question = question;

return std::move(*this);
}
Expand All @@ -1059,13 +1059,13 @@ PollBuilder PollBuilder::SetChoices(std::vector<std::string> labels)
{
m_poll->m_choices = Poll::ChoiceList();

return AddChoices(std::move(labels));
return AddChoices(labels);
}

PollBuilder PollBuilder::AddChoices(std::vector<std::string> labels)
{
for (auto& label : labels) {
*this = AddChoice(std::move(label));
*this = AddChoice(label);
}

return std::move(*this);
Expand Down Expand Up @@ -1096,7 +1096,7 @@ PollBuilder PollBuilder::AddChoice(std::string label)
throw VotingError(strprintf(_("Duplicate poll choice: %s"), label));
}

m_poll->m_choices.Add(std::move(label));
m_poll->m_choices.Add(label);

return std::move(*this);
}
Expand All @@ -1105,20 +1105,20 @@ PollBuilder PollBuilder::SetAdditionalFields(std::vector<Poll::AdditionalField>
{
m_poll->m_additional_fields = Poll::AdditionalFieldList();

return AddAdditionalFields(std::move(fields));
return AddAdditionalFields(fields);
}

PollBuilder PollBuilder::SetAdditionalFields(Poll::AdditionalFieldList fields)
{
m_poll->m_additional_fields = Poll::AdditionalFieldList();

return AddAdditionalFields(std::move(fields));
return AddAdditionalFields(fields);
}

PollBuilder PollBuilder::AddAdditionalFields(std::vector<Poll::AdditionalField> fields)
{
for (auto& field : fields) {
*this = AddAdditionalField(std::move(field));
*this = AddAdditionalField(field);
}

if (!m_poll->m_additional_fields.WellFormed(m_poll->m_type.Value())) {
Expand All @@ -1131,7 +1131,7 @@ PollBuilder PollBuilder::AddAdditionalFields(std::vector<Poll::AdditionalField>
PollBuilder PollBuilder::AddAdditionalFields(Poll::AdditionalFieldList fields)
{
for (auto& field : fields) {
*this = AddAdditionalField(std::move(field));
*this = AddAdditionalField(field);
}

if (!m_poll->m_additional_fields.WellFormed(m_poll->m_type.Value())) {
Expand Down Expand Up @@ -1177,7 +1177,7 @@ PollBuilder PollBuilder::AddAdditionalField(Poll::AdditionalField field)
throw VotingError(strprintf(_("Duplicate poll additional field: %s"), field.m_name));
}

m_poll->m_additional_fields.Add(std::move(field));
m_poll->m_additional_fields.Add(field);

return std::move(*this);
}
Expand Down
7 changes: 7 additions & 0 deletions src/gridcoin/voting/result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ class VoteCandidate
{
LOCK(pwalletMain->cs_wallet);

LogPrint(BCLog::LogFlags::VOTE, "INFO: %s: vote contract tx hash %s ismine status %i",
__func__,
m_tx.GetHash().GetHex(),
pwalletMain->IsMine(m_tx));

return pwalletMain->IsMine(m_tx);
}

Expand Down Expand Up @@ -1256,6 +1261,7 @@ void PollResult::TallyVote(VoteDetail detail)
if (detail.m_ismine != ISMINE_NO) {
bool choice_found = false;

// If the response offset entry already exists, then append to the existing entry...
for (auto& choice : m_self_vote_detail.m_responses) {
if (choice.first == response_offset) {
choice.second += response_weight;
Expand All @@ -1264,6 +1270,7 @@ void PollResult::TallyVote(VoteDetail detail)
}
}

// Otherwise make a new m_responses entry to represent the response offset and the associated weight.
if (!choice_found) {
m_self_vote_detail.m_responses.push_back(std::make_pair(response_offset, response_weight));
}
Expand Down
4 changes: 1 addition & 3 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev,
- 2) * coinstake_output_ser_size;
}

uint64_t nBlockTx = 0;
int nBlockSigOps = 100;

std::make_heap(vecPriority.begin(), vecPriority.end());
Expand Down Expand Up @@ -626,7 +625,6 @@ bool CreateRestOfTheBlock(CBlock &block, CBlockIndex* pindexPrev,

block.vtx.push_back(tx);
nBlockSize += nTxSize;
++nBlockTx;
nBlockSigOps += nTxSigOps;
nFees += nTxFees;

Expand Down Expand Up @@ -939,7 +937,7 @@ void SplitCoinStakeOutput(CBlock &blocknew, int64_t &nReward, bool &fEnableStake
CScript SideStakeScriptPubKey;
GRC::Allocation SumAllocation;

// Lambda for sidestake allocation. This iterates throught the provided sidestake vector until either all elements processed,
// Lambda for sidestake allocation. This iterates through the provided sidestake vector until either all elements processed,
// the maximum number of sidestake outputs is reached via the provided output_limit, or accumulated allocation will exceed 100%.
const auto allocate_sidestakes = [&](SideStakeAlloc sidestakes, unsigned int output_limit) {
for (auto iterSideStake = sidestakes.begin();
Expand Down
2 changes: 0 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1560,14 +1560,12 @@ void ThreadOpenConnections2(void* parg)

// Only connect out to one peer per network group (/16 for IPv4).
// Do this here so we don't have to critsect vNodes inside mapAddresses critsect.
int nOutbound = 0;
set<vector<unsigned char> > setConnected;
{
LOCK(cs_vNodes);
for (auto const& pnode : vNodes) {
if (!pnode->fInbound) {
setConnected.insert(pnode->addr.GetGroup());
nOutbound++;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AddressBookPage : public QDialog
const QString &getReturnValue() const { return returnValue; }

public slots:
void done(int retval);
void done(int retval) override;
void exportClicked();
void changeFilter(const QString& needle);
void resizeTableColumns(const bool& neighbor_pair_adjust = false, const int& index = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ QString dateTimeStr(qint64 nTime)

QString formatPingTime(double dPingTime)
{
return (dPingTime == std::numeric_limits<int64_t>::max()/1e6 || dPingTime == 0) ?
return (dPingTime >= static_cast<double>(std::numeric_limits<int64_t>::max()) / 1e6 || dPingTime <= 0) ?
QObject::tr("N/A") :
QObject::tr("%1 ms").arg(QString::number((int)(dPingTime * 1000), 10));
}
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class TransactionTablePriv
//
// If a status update is needed (blocks came in since last check),
// update the status of this transaction from the wallet. Otherwise,
// simply re-use the cached status.
// simply reuse the cached status.
TRY_LOCK(cs_main, lockMain);
if(lockMain)
{
Expand Down
2 changes: 1 addition & 1 deletion src/qt/voting/additionalfieldstablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void AdditionalFieldsTableModel::refresh()
->reload(additional_fields);
}

Qt::SortOrder AdditionalFieldsTableModel::sort(int column)
Qt::SortOrder AdditionalFieldsTableModel::custom_sort(int column)
{
if (sortColumn() == column) {
QSortFilterProxyModel::sort(column, static_cast<Qt::SortOrder>(!sortOrder()));
Expand Down
2 changes: 1 addition & 1 deletion src/qt/voting/additionalfieldstablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AdditionalFieldsTableModel : public QSortFilterProxyModel

public slots:
void refresh();
Qt::SortOrder sort(int column);
Qt::SortOrder custom_sort(int column);

private:
const PollItem* m_poll_item;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/voting/polltab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void PollTab::filter(const QString& needle)

void PollTab::sort(const int column)
{
const Qt::SortOrder order = m_polltable_model->sort(column);
const Qt::SortOrder order = m_polltable_model->custom_sort(column);
ui->table->horizontalHeader()->setSortIndicator(column, order);
}

Expand Down
4 changes: 1 addition & 3 deletions src/qt/voting/polltablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

using namespace GRC;

namespace {
PollTableDataModel::PollTableDataModel()
{
qRegisterMetaType<QList<QPersistentModelIndex>>();
Expand Down Expand Up @@ -189,7 +188,6 @@ void PollTableDataModel::handlePollStaleFlag(QString poll_txid_string)

emit layoutChanged();
}
} // Anonymous namespace

// -----------------------------------------------------------------------------
// Class: PollTableModel
Expand Down Expand Up @@ -294,7 +292,7 @@ void PollTableModel::changeTitleFilter(const QString& pattern)
emit layoutChanged();
}

Qt::SortOrder PollTableModel::sort(int column)
Qt::SortOrder PollTableModel::custom_sort(int column)
{
if (sortColumn() == column) {
QSortFilterProxyModel::sort(column, static_cast<Qt::SortOrder>(!sortOrder()));
Expand Down
Loading

0 comments on commit baa544b

Please sign in to comment.