Skip to content

Commit

Permalink
Fix several LogPrint related variadic warnings from linter
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Mar 27, 2022
1 parent 0863ea3 commit 02f167e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
8 changes: 4 additions & 4 deletions src/gridcoin/scraper/scraper_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@ EXCLUSIVE_LOCKS_REQUIRED(CScraperManifest::cs_mapManifest)
iter->second)));
if (!iter2.second)
{
LogPrint("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
"hash = %s, already exists. This should not happen.", __func__, nHash.GetHex());
LogPrintf("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
"hash = %s, already exists. This should not happen.", __func__, nHash.GetHex());
}
else
{
Expand Down Expand Up @@ -605,8 +605,8 @@ CScraperManifest::DeleteManifest(std::map<uint256, std::shared_ptr<CScraperManif
iter->second)));
if (!iter2.second)
{
LogPrint("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
"hash = %s, already exists. This should not happen.", __func__, iter->first.GetHex());
LogPrintf("WARN: %s: Manifest insertion attempt into pending deleted map failed because an entry with the same "
"hash = %s, already exists. This should not happen.", __func__, iter->first.GetHex());
}
else
{
Expand Down
44 changes: 26 additions & 18 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3260,36 +3260,44 @@ void PrintBlockTree() EXCLUSIVE_LOCKS_REQUIRED(cs_main)
CBlockIndex* pindex = vStack.back().second;
vStack.pop_back();

std::stringstream output;

// print split or gap
if (nCol > nPrevCol)
{
for (int i = 0; i < nCol-1; i++)
LogPrintf("| ");
LogPrintf("|\\");
for (int i = 0; i < nCol-1; i++) {
output << "| \n";
}

output << "|\\\n";
}
else if (nCol < nPrevCol)
{
for (int i = 0; i < nCol; i++)
LogPrintf("| ");
LogPrintf("|");
}
for (int i = 0; i < nCol; i++) {
output << "| \n";
}

output << "|\n";
}
nPrevCol = nCol;

// print columns
for (int i = 0; i < nCol; i++)
LogPrintf("| ");
for (int i = 0; i < nCol; i++) {
output << "| \n";
}

// print item
// print item (and also prepend above formatting)
CBlock block;
ReadBlockFromDisk(block, pindex, Params().GetConsensus());
LogPrintf("%d (%u,%u) %s %08x %s tx %" PRIszu "",
pindex->nHeight,
pindex->nFile,
pindex->nBlockPos,
block.GetHash(true).ToString().c_str(),
block.nBits,
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
block.vtx.size());
LogPrintf("%s%d (%u,%u) %s %08x %s tx %" PRIszu "",
output.str(),
pindex->nHeight,
pindex->nFile,
pindex->nBlockPos,
block.GetHash(true).ToString().c_str(),
block.nBits,
DateTimeStrFormat("%x %H:%M:%S", block.GetBlockTime()).c_str(),
block.vtx.size());

PrintWallets(block);

Expand Down
5 changes: 3 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,8 @@ void SplitCoinStakeOutput(CBlock &blocknew, int64_t &nReward, bool &fEnableStake

if (dSumAllocation + iterSideStake->second > 1.0)
{
LogPrintf("WARN: SplitCoinStakeOutput: allocation percentage over 100\%, ending sidestake allocations.");
LogPrintf("WARN: SplitCoinStakeOutput: allocation percentage over 100 percent, "
"ending sidestake allocations.");
break;
}

Expand Down Expand Up @@ -1327,7 +1328,7 @@ SideStakeAlloc GetSideStakingStatusAndAlloc()
dSumAllocation += dAllocation;
if (dSumAllocation > 1.0)
{
LogPrintf("WARN: %s: allocation percentage over 100\%, ending sidestake allocations.", __func__);
LogPrintf("WARN: %s: allocation percentage over 100 percent, ending sidestake allocations.", __func__);
break;
}

Expand Down
8 changes: 4 additions & 4 deletions src/util/time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ int64_t MilliTimer::GetStartTime(const std::string& label)
internal_timer = timer_map.at(label);
}
catch (std::out_of_range&) {
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zero start time.");
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zero start time.", __func__);
}

return internal_timer.start_time;
Expand Down Expand Up @@ -291,7 +291,7 @@ const MilliTimer::timer MilliTimer::GetTimes(const std::string& log_string, cons
}
catch (std::out_of_range&)
{
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zeroed timer.");
LogPrintf("WARNING: %s: Timer with specified label does not exist. Returning zeroed timer.", __func__);
timer = {};
return timer;
}
Expand All @@ -300,8 +300,8 @@ const MilliTimer::timer MilliTimer::GetTimes(const std::string& log_string, cons
// minimize lock time.
if (internal_timer.log)
{
LogPrintf("timer %s: %s: elapsed time: %" PRId64 " ms, time since last check: %" PRId64 " ms.",
label, log_string, timer.elapsed_time, timer.time_since_last_check);
LogPrintf("INFO: %s: timer %s: %s: elapsed time: %" PRId64 " ms, time since last check: %" PRId64 " ms.",
__func__, label, log_string, timer.elapsed_time, timer.time_since_last_check);
}

return timer;
Expand Down

0 comments on commit 02f167e

Please sign in to comment.