Remove redundant .c_str()s
After the tinyformat switch sprintf() family functions support passing actual std::string objects. Remove unnecessary c_str calls (236 of them) in logging and formatting.
This commit is contained in:
@@ -374,12 +374,12 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
char fUnused;
|
||||
ssValue >> fTmp >> fUnused >> wtx.strFromAccount;
|
||||
strErr = strprintf("LoadWallet() upgrading tx ver=%d %d '%s' %s",
|
||||
wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount.c_str(), hash.ToString().c_str());
|
||||
wtx.fTimeReceivedIsTxTime, fTmp, wtx.strFromAccount, hash.ToString());
|
||||
wtx.fTimeReceivedIsTxTime = fTmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString().c_str());
|
||||
strErr = strprintf("LoadWallet() repairing tx ver=%d %s", wtx.fTimeReceivedIsTxTime, hash.ToString());
|
||||
wtx.fTimeReceivedIsTxTime = 0;
|
||||
}
|
||||
wss.vWalletUpgrade.push_back(hash);
|
||||
@@ -390,12 +390,12 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
|
||||
|
||||
pwallet->mapWallet[hash] = wtx;
|
||||
//// debug print
|
||||
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString().c_str());
|
||||
//LogPrintf("LoadWallet %s\n", wtx.GetHash().ToString());
|
||||
//LogPrintf(" %12"PRId64" %s %s %s\n",
|
||||
// wtx.vout[0].nValue,
|
||||
// DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()).c_str(),
|
||||
// wtx.hashBlock.ToString().c_str(),
|
||||
// wtx.mapValue["message"].c_str());
|
||||
// DateTimeStrFormat("%Y-%m-%d %H:%M:%S", wtx.GetBlockTime()),
|
||||
// wtx.hashBlock.ToString(),
|
||||
// wtx.mapValue["message"]);
|
||||
}
|
||||
else if (strType == "acentry")
|
||||
{
|
||||
@@ -646,7 +646,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
||||
}
|
||||
}
|
||||
if (!strErr.empty())
|
||||
LogPrintf("%s\n", strErr.c_str());
|
||||
LogPrintf("%s\n", strErr);
|
||||
}
|
||||
pcursor->close();
|
||||
}
|
||||
@@ -779,10 +779,10 @@ bool BackupWallet(const CWallet& wallet, const string& strDest)
|
||||
#else
|
||||
filesystem::copy_file(pathSrc, pathDest);
|
||||
#endif
|
||||
LogPrintf("copied wallet.dat to %s\n", pathDest.string().c_str());
|
||||
LogPrintf("copied wallet.dat to %s\n", pathDest.string());
|
||||
return true;
|
||||
} catch(const filesystem::filesystem_error &e) {
|
||||
LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string().c_str(), e.what());
|
||||
LogPrintf("error copying wallet.dat to %s - %s\n", pathDest.string(), e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -810,10 +810,10 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
|
||||
int result = dbenv.dbenv.dbrename(NULL, filename.c_str(), NULL,
|
||||
newFilename.c_str(), DB_AUTO_COMMIT);
|
||||
if (result == 0)
|
||||
LogPrintf("Renamed %s to %s\n", filename.c_str(), newFilename.c_str());
|
||||
LogPrintf("Renamed %s to %s\n", filename, newFilename);
|
||||
else
|
||||
{
|
||||
LogPrintf("Failed to rename %s to %s\n", filename.c_str(), newFilename.c_str());
|
||||
LogPrintf("Failed to rename %s to %s\n", filename, newFilename);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
|
||||
bool allOK = dbenv.Salvage(newFilename, true, salvagedData);
|
||||
if (salvagedData.empty())
|
||||
{
|
||||
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename.c_str());
|
||||
LogPrintf("Salvage(aggressive) found no records in %s.\n", newFilename);
|
||||
return false;
|
||||
}
|
||||
LogPrintf("Salvage(aggressive) found %"PRIszu" records\n", salvagedData.size());
|
||||
@@ -836,7 +836,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
|
||||
0);
|
||||
if (ret > 0)
|
||||
{
|
||||
LogPrintf("Cannot create database file %s\n", filename.c_str());
|
||||
LogPrintf("Cannot create database file %s\n", filename);
|
||||
return false;
|
||||
}
|
||||
CWallet dummyWallet;
|
||||
@@ -856,7 +856,7 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys)
|
||||
continue;
|
||||
if (!fReadOK)
|
||||
{
|
||||
LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType.c_str(), strErr.c_str());
|
||||
LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, strErr);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user