Remove redundant c_str

This commit is contained in:
R E Broadley 2014-05-21 18:50:46 +08:00
parent 6fcdad787f
commit 79d06dc6e0
7 changed files with 15 additions and 15 deletions

View file

@ -420,7 +420,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().c_str(), nTried, nNew); LogPrint("addrman", "Added %s from %s: %i tried, %i new\n", addr.ToStringIPPort().c_str(), source.ToString(), nTried, nNew);
return fRet; return fRet;
} }
@ -436,7 +436,7 @@ public:
Check(); Check();
} }
if (nAdd) if (nAdd)
LogPrint("addrman", "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString().c_str(), nTried, nNew); LogPrint("addrman", "Added %i addresses from %s: %i tried, %i new\n", nAdd, source.ToString(), nTried, nNew);
return nAdd > 0; return nAdd > 0;
} }

View file

@ -914,7 +914,7 @@ bool AppInit2(boost::thread_group& threadGroup)
for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi) for (map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.begin(); mi != mapBlockIndex.end(); ++mi)
{ {
uint256 hash = (*mi).first; uint256 hash = (*mi).first;
if (strncmp(hash.ToString().c_str(), strMatch.c_str(), strMatch.size()) == 0) if (boost::algorithm::starts_with(hash.ToString(), strMatch))
{ {
CBlockIndex* pindex = (*mi).second; CBlockIndex* pindex = (*mi).second;
CBlock block; CBlock block;

View file

@ -93,7 +93,7 @@ public:
if (!status.ok()) { if (!status.ok()) {
if (status.IsNotFound()) if (status.IsNotFound())
return false; return false;
LogPrintf("LevelDB read failure: %s\n", status.ToString().c_str()); LogPrintf("LevelDB read failure: %s\n", status.ToString());
HandleError(status); HandleError(status);
} }
try { try {
@ -122,7 +122,7 @@ public:
if (!status.ok()) { if (!status.ok()) {
if (status.IsNotFound()) if (status.IsNotFound())
return false; return false;
LogPrintf("LevelDB read failure: %s\n", status.ToString().c_str()); LogPrintf("LevelDB read failure: %s\n", status.ToString());
HandleError(status); HandleError(status);
} }
return true; return true;

View file

@ -862,13 +862,13 @@ public:
{ {
return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)", return strprintf("CBlockIndex(pprev=%p, nHeight=%d, merkle=%s, hashBlock=%s)",
pprev, nHeight, pprev, nHeight,
hashMerkleRoot.ToString().c_str(), hashMerkleRoot.ToString(),
GetBlockHash().ToString().c_str()); GetBlockHash().ToString());
} }
void print() const void print() const
{ {
LogPrintf("%s\n", ToString().c_str()); LogPrintf("%s\n", ToString());
} }
// Check whether this block index entry is valid up to the passed validity level. // Check whether this block index entry is valid up to the passed validity level.
@ -953,14 +953,14 @@ public:
std::string str = "CDiskBlockIndex("; std::string str = "CDiskBlockIndex(";
str += CBlockIndex::ToString(); str += CBlockIndex::ToString();
str += strprintf("\n hashBlock=%s, hashPrev=%s)", str += strprintf("\n hashBlock=%s, hashPrev=%s)",
GetBlockHash().ToString().c_str(), GetBlockHash().ToString(),
hashPrev.ToString().c_str()); hashPrev.ToString());
return str; return str;
} }
void print() const void print() const
{ {
LogPrintf("%s\n", ToString().c_str()); LogPrintf("%s\n", ToString());
} }
}; };

View file

@ -430,7 +430,7 @@ public:
nRequestTime = it->second; nRequestTime = it->second;
else else
nRequestTime = 0; nRequestTime = 0;
LogPrint("net", "askfor %s %d (%s)\n", inv.ToString().c_str(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str()); LogPrint("net", "askfor %s %d (%s)\n", inv.ToString(), nRequestTime, DateTimeStrFormat("%H:%M:%S", nRequestTime/1000000).c_str());
// 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

@ -722,7 +722,7 @@ public:
void print() const void print() const
{ {
LogPrintf("%s\n", ToString().c_str()); LogPrintf("%s\n", ToString());
} }
CScriptID GetID() const CScriptID GetID() const

View file

@ -720,12 +720,12 @@ public:
std::string ToString() const std::string ToString() const
{ {
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString().c_str(), 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).c_str());
} }
void print() const void print() const
{ {
LogPrintf("%s\n", ToString().c_str()); LogPrintf("%s\n", ToString());
} }
}; };