Merge pull request #4868

2c2cc5d Remove some unnecessary c_strs() in logging and the GUI (Philip Kaufmann)
f7d0a86 netbase: Use .data() instead of .c_str() on binary string (Wladimir J. van der Laan)
This commit is contained in:
Pieter Wuille 2014-09-09 16:39:35 +02:00
commit 1575c5171f
No known key found for this signature in database
GPG Key ID: 8F653255C87992E0
8 changed files with 10 additions and 10 deletions

View File

@ -424,7 +424,7 @@ public:
Check(); Check();
} }
if (fRet) if (fRet)
LogPrint("addrman", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort().c_str(), source.ToString(), nTried, nNew); LogPrint("addrman", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort(), source.ToString(), nTried, nNew);
return fRet; return fRet;
} }

View File

@ -4395,7 +4395,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
if (!pto->fDisconnect && state.nBlocksInFlight && if (!pto->fDisconnect && state.nBlocksInFlight &&
state.nLastBlockReceive < state.nLastBlockProcess - BLOCK_DOWNLOAD_TIMEOUT*1000000 && state.nLastBlockReceive < state.nLastBlockProcess - BLOCK_DOWNLOAD_TIMEOUT*1000000 &&
state.vBlocksInFlight.front().nTime < state.nLastBlockProcess - 2*BLOCK_DOWNLOAD_TIMEOUT*1000000) { state.vBlocksInFlight.front().nTime < state.nLastBlockProcess - 2*BLOCK_DOWNLOAD_TIMEOUT*1000000) {
LogPrintf("Peer %s is stalling block download, disconnecting\n", state.name.c_str()); LogPrintf("Peer %s is stalling block download, disconnecting\n", state.name);
pto->fDisconnect = true; pto->fDisconnect = true;
} }
@ -4505,7 +4505,7 @@ bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock
} }
std::string CBlockFileInfo::ToString() const { std::string CBlockFileInfo::ToString() const {
return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst).c_str(), DateTimeStrFormat("%Y-%m-%d", nTimeLast).c_str()); return strprintf("CBlockFileInfo(blocks=%u, size=%u, heights=%u...%u, time=%s...%s)", nBlocks, nSize, nHeightFirst, nHeightLast, DateTimeStrFormat("%Y-%m-%d", nTimeFirst), DateTimeStrFormat("%Y-%m-%d", nTimeLast));
} }

View File

@ -2114,7 +2114,7 @@ void CNode::AskFor(const CInv& inv)
nRequestTime = it->second; nRequestTime = it->second;
else else
nRequestTime = 0; nRequestTime = 0;
LogPrint("net", "askfor %s %d (%s) peer=%d\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str(), id); LogPrint("net", "askfor %s %d (%s) peer=%d\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000), id);
// Make sure not to reuse time indexes to keep things in the same order // Make sure not to reuse time indexes to keep things in the same order
int64_t nNow = GetTimeMicros() - 1000000; int64_t nNow = GetTimeMicros() - 1000000;

View File

@ -259,7 +259,7 @@ bool static Socks5(string strDest, int port, SOCKET& hSocket)
strSocks5 += strDest; strSocks5 += strDest;
strSocks5 += static_cast<char>((port >> 8) & 0xFF); strSocks5 += static_cast<char>((port >> 8) & 0xFF);
strSocks5 += static_cast<char>((port >> 0) & 0xFF); strSocks5 += static_cast<char>((port >> 0) & 0xFF);
ret = send(hSocket, strSocks5.c_str(), strSocks5.size(), MSG_NOSIGNAL); ret = send(hSocket, strSocks5.data(), strSocks5.size(), MSG_NOSIGNAL);
if (ret != (ssize_t)strSocks5.size()) if (ret != (ssize_t)strSocks5.size())
{ {
CloseSocket(hSocket); CloseSocket(hSocket);

View File

@ -705,7 +705,7 @@ void CoinControlDialog::updateView()
QString sAddress = ""; QString sAddress = "";
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress)) if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress))
{ {
sAddress = CBitcoinAddress(outputAddress).ToString().c_str(); sAddress = QString::fromStdString(CBitcoinAddress(outputAddress).ToString());
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs // if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
if (!treeMode || (!(sAddress == sWalletAddress))) if (!treeMode || (!(sAddress == sWalletAddress)))
@ -752,7 +752,7 @@ void CoinControlDialog::updateView()
// transaction hash // transaction hash
uint256 txhash = out.tx->GetHash(); uint256 txhash = out.tx->GetHash();
itemOutput->setText(COLUMN_TXHASH, txhash.GetHex().c_str()); itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
// vout index // vout index
itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i)); itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));

View File

@ -622,7 +622,7 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
CTxDestination address; CTxDestination address;
if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address)) if(!out.fSpendable || !ExtractDestination(cout.tx->vout[cout.i].scriptPubKey, address))
continue; continue;
mapCoins[CBitcoinAddress(address).ToString().c_str()].push_back(out); mapCoins[QString::fromStdString(CBitcoinAddress(address).ToString())].push_back(out);
} }
} }

View File

@ -606,7 +606,7 @@ void CTxMemPool::PrioritiseTransaction(const uint256 hash, const string strHash,
deltas.first += dPriorityDelta; deltas.first += dPriorityDelta;
deltas.second += nFeeDelta; deltas.second += nFeeDelta;
} }
LogPrintf("PrioritiseTransaction: %s priority += %f, fee += %d\n", strHash.c_str(), dPriorityDelta, nFeeDelta); LogPrintf("PrioritiseTransaction: %s priority += %f, fee += %d\n", strHash, dPriorityDelta, nFeeDelta);
} }
void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, int64_t &nFeeDelta) void CTxMemPool::ApplyDeltas(const uint256 hash, double &dPriorityDelta, int64_t &nFeeDelta)

View File

@ -44,7 +44,7 @@ struct CompareValueOnly
std::string COutput::ToString() const std::string COutput::ToString() const
{ {
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString(), i, nDepth, FormatMoney(tx->vout[i].nValue).c_str()); return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString(), i, nDepth, FormatMoney(tx->vout[i].nValue));
} }
const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const