scripted-diff: Remove PAIRTYPE

-BEGIN VERIFY SCRIPT-
sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#define std::pair<t1, t2>    std::pair<t1, t2>\n//' ./src/utilstrencodings.h ;
-END VERIFY SCRIPT-
This commit is contained in:
Jorge Timón 2017-06-02 03:28:42 +02:00
parent 18dc3c3962
commit 1238f13cf6
No known key found for this signature in database
GPG key ID: 8866C18EA1C944A2
15 changed files with 28 additions and 29 deletions

View file

@ -611,7 +611,7 @@ void CleanupBlockRevFiles()
// keeping a separate counter. Once we hit a gap (or if 0 doesn't exist) // keeping a separate counter. Once we hit a gap (or if 0 doesn't exist)
// start removing block files. // start removing block files.
int nContigCounter = 0; int nContigCounter = 0;
for (const PAIRTYPE(std::string, fs::path)& item : mapBlockFiles) { for (const std::pair<std::string, fs::path>& item : mapBlockFiles) {
if (atoi(item.first) == nContigCounter) { if (atoi(item.first) == nContigCounter) {
nContigCounter++; nContigCounter++;
continue; continue;

View file

@ -81,7 +81,7 @@ public:
cachedAddressTable.clear(); cachedAddressTable.clear();
{ {
LOCK(wallet->cs_wallet); LOCK(wallet->cs_wallet);
for (const PAIRTYPE(CTxDestination, CAddressBookData)& item : wallet->mapAddressBook) for (const std::pair<CTxDestination, CAddressBookData>& item : wallet->mapAddressBook)
{ {
const CBitcoinAddress& address = item.first; const CBitcoinAddress& address = item.first;
bool fMine = IsMine(*wallet, address.Get()); bool fMine = IsMine(*wallet, address.Get());

View file

@ -628,7 +628,7 @@ void CoinControlDialog::updateView()
std::map<QString, std::vector<COutput> > mapCoins; std::map<QString, std::vector<COutput> > mapCoins;
model->listCoins(mapCoins); model->listCoins(mapCoins);
for (const PAIRTYPE(QString, std::vector<COutput>)& coins : mapCoins) { for (const std::pair<QString, std::vector<COutput>>& coins : mapCoins) {
CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem();
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
QString sWalletAddress = coins.first; QString sWalletAddress = coins.first;

View file

@ -555,7 +555,7 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo(); QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses; QStringList addresses;
for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) { for (const std::pair<CScript, CAmount>& sendingTo : sendingTos) {
// Extract and check destination addresses // Extract and check destination addresses
CTxDestination dest; CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) { if (ExtractDestination(sendingTo.first, dest)) {

View file

@ -196,7 +196,7 @@ void PaymentServerTests::paymentServerTests()
QVERIFY(r.paymentRequest.IsInitialized()); QVERIFY(r.paymentRequest.IsInitialized());
// Extract address and amount from the request // Extract address and amount from the request
QList<std::pair<CScript, CAmount> > sendingTos = r.paymentRequest.getPayTo(); QList<std::pair<CScript, CAmount> > sendingTos = r.paymentRequest.getPayTo();
for (const PAIRTYPE(CScript, CAmount)& sendingTo : sendingTos) { for (const std::pair<CScript, CAmount>& sendingTo : sendingTos) {
CTxDestination dest; CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) if (ExtractDestination(sendingTo.first, dest))
QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false); QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false);

View file

@ -245,14 +245,14 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>"; strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>";
// Message from normal bitcoin:URI (bitcoin:123...?message=example) // Message from normal bitcoin:URI (bitcoin:123...?message=example)
for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm) for (const std::pair<std::string, std::string>& r : wtx.vOrderForm)
if (r.first == "Message") if (r.first == "Message")
strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>"; strHTML += "<br><b>" + tr("Message") + ":</b><br>" + GUIUtil::HtmlEscape(r.second, true) + "<br>";
// //
// PaymentRequest info: // PaymentRequest info:
// //
for (const PAIRTYPE(std::string, std::string)& r : wtx.vOrderForm) for (const std::pair<std::string, std::string>& r : wtx.vOrderForm)
{ {
if (r.first == "PaymentRequest") if (r.first == "PaymentRequest")
{ {

View file

@ -1256,7 +1256,7 @@ UniValue getchaintips(const JSONRPCRequest& request)
std::set<const CBlockIndex*> setOrphans; std::set<const CBlockIndex*> setOrphans;
std::set<const CBlockIndex*> setPrevs; std::set<const CBlockIndex*> setPrevs;
for (const PAIRTYPE(const uint256, CBlockIndex*)& item : mapBlockIndex) for (const std::pair<const uint256, CBlockIndex*>& item : mapBlockIndex)
{ {
if (!chainActive.Contains(item.second)) { if (!chainActive.Contains(item.second)) {
setOrphans.insert(item.second); setOrphans.insert(item.second);

View file

@ -474,7 +474,7 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
UniValue localAddresses(UniValue::VARR); UniValue localAddresses(UniValue::VARR);
{ {
LOCK(cs_mapLocalHost); LOCK(cs_mapLocalHost);
for (const PAIRTYPE(CNetAddr, LocalServiceInfo) &item : mapLocalHost) for (const std::pair<CNetAddr, LocalServiceInfo> &item : mapLocalHost)
{ {
UniValue rec(UniValue::VOBJ); UniValue rec(UniValue::VOBJ);
rec.push_back(Pair("address", item.first.ToString())); rec.push_back(Pair("address", item.first.ToString()));

View file

@ -186,7 +186,7 @@ std::string CRPCTable::help(const std::string& strCommand, const JSONRPCRequest&
jreq.fHelp = true; jreq.fHelp = true;
jreq.params = UniValue(); jreq.params = UniValue();
for (const PAIRTYPE(std::string, const CRPCCommand*)& command : vCommands) for (const std::pair<std::string, const CRPCCommand*>& command : vCommands)
{ {
const CRPCCommand *pcmd = command.second; const CRPCCommand *pcmd = command.second;
std::string strMethod = pcmd->name; std::string strMethod = pcmd->name;

View file

@ -94,7 +94,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector<std::v
// Scan templates // Scan templates
const CScript& script1 = scriptPubKey; const CScript& script1 = scriptPubKey;
for (const PAIRTYPE(txnouttype, CScript)& tplate : mTemplates) for (const std::pair<txnouttype, CScript>& tplate : mTemplates)
{ {
const CScript& script2 = tplate.second; const CScript& script2 = tplate.second;
vSolutionsRet.clear(); vSolutionsRet.clear();

View file

@ -77,7 +77,7 @@ static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch,
{ {
LogPrintf("POTENTIAL DEADLOCK DETECTED\n"); LogPrintf("POTENTIAL DEADLOCK DETECTED\n");
LogPrintf("Previous lock order was:\n"); LogPrintf("Previous lock order was:\n");
for (const PAIRTYPE(void*, CLockLocation) & i : s2) { for (const std::pair<void*, CLockLocation> & i : s2) {
if (i.first == mismatch.first) { if (i.first == mismatch.first) {
LogPrintf(" (1)"); LogPrintf(" (1)");
} }
@ -87,7 +87,7 @@ static void potential_deadlock_detected(const std::pair<void*, void*>& mismatch,
LogPrintf(" %s\n", i.second.ToString()); LogPrintf(" %s\n", i.second.ToString());
} }
LogPrintf("Current lock order is:\n"); LogPrintf("Current lock order is:\n");
for (const PAIRTYPE(void*, CLockLocation) & i : s1) { for (const std::pair<void*, CLockLocation> & i : s1) {
if (i.first == mismatch.first) { if (i.first == mismatch.first) {
LogPrintf(" (1)"); LogPrintf(" (1)");
} }
@ -108,7 +108,7 @@ static void push_lock(void* c, const CLockLocation& locklocation, bool fTry)
(*lockstack).push_back(std::make_pair(c, locklocation)); (*lockstack).push_back(std::make_pair(c, locklocation));
for (const PAIRTYPE(void*, CLockLocation) & i : (*lockstack)) { for (const std::pair<void*, CLockLocation> & i : (*lockstack)) {
if (i.first == c) if (i.first == c)
break; break;
@ -142,14 +142,14 @@ void LeaveCritical()
std::string LocksHeld() std::string LocksHeld()
{ {
std::string result; std::string result;
for (const PAIRTYPE(void*, CLockLocation) & i : *lockstack) for (const std::pair<void*, CLockLocation> & i : *lockstack)
result += i.second.ToString() + std::string("\n"); result += i.second.ToString() + std::string("\n");
return result; return result;
} }
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs) void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, void* cs)
{ {
for (const PAIRTYPE(void*, CLockLocation) & i : *lockstack) for (const std::pair<void*, CLockLocation> & i : *lockstack)
if (i.first == cs) if (i.first == cs)
return; return;
fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str()); fprintf(stderr, "Assertion failed: lock %s not held in %s:%i; locks held:\n%s", pszName, pszFile, nLine, LocksHeld().c_str());

View file

@ -18,7 +18,6 @@
#define UBEGIN(a) ((unsigned char*)&(a)) #define UBEGIN(a) ((unsigned char*)&(a))
#define UEND(a) ((unsigned char*)&((&(a))[1])) #define UEND(a) ((unsigned char*)&((&(a))[1]))
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) #define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
/** Used by SanitizeString() */ /** Used by SanitizeString() */
enum SafeChars enum SafeChars

View file

@ -3300,13 +3300,13 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
// Calculate nChainWork // Calculate nChainWork
std::vector<std::pair<int, CBlockIndex*> > vSortedByHeight; std::vector<std::pair<int, CBlockIndex*> > vSortedByHeight;
vSortedByHeight.reserve(mapBlockIndex.size()); vSortedByHeight.reserve(mapBlockIndex.size());
for (const PAIRTYPE(uint256, CBlockIndex*)& item : mapBlockIndex) for (const std::pair<uint256, CBlockIndex*>& item : mapBlockIndex)
{ {
CBlockIndex* pindex = item.second; CBlockIndex* pindex = item.second;
vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex)); vSortedByHeight.push_back(std::make_pair(pindex->nHeight, pindex));
} }
sort(vSortedByHeight.begin(), vSortedByHeight.end()); sort(vSortedByHeight.begin(), vSortedByHeight.end());
for (const PAIRTYPE(int, CBlockIndex*)& item : vSortedByHeight) for (const std::pair<int, CBlockIndex*>& item : vSortedByHeight)
{ {
CBlockIndex* pindex = item.second; CBlockIndex* pindex = item.second;
pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex); pindex->nChainWork = (pindex->pprev ? pindex->pprev->nChainWork : 0) + GetBlockProof(*pindex);
@ -3355,7 +3355,7 @@ bool static LoadBlockIndexDB(const CChainParams& chainparams)
// Check presence of blk files // Check presence of blk files
LogPrintf("Checking all blk files are present...\n"); LogPrintf("Checking all blk files are present...\n");
std::set<int> setBlkDataFiles; std::set<int> setBlkDataFiles;
for (const PAIRTYPE(uint256, CBlockIndex*)& item : mapBlockIndex) for (const std::pair<uint256, CBlockIndex*>& item : mapBlockIndex)
{ {
CBlockIndex* pindex = item.second; CBlockIndex* pindex = item.second;
if (pindex->nStatus & BLOCK_HAVE_DATA) { if (pindex->nStatus & BLOCK_HAVE_DATA) {

View file

@ -96,7 +96,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
} }
entry.push_back(Pair("bip125-replaceable", rbfStatus)); entry.push_back(Pair("bip125-replaceable", rbfStatus));
for (const PAIRTYPE(std::string, std::string)& item : wtx.mapValue) for (const std::pair<std::string, std::string>& item : wtx.mapValue)
entry.push_back(Pair(item.first, item.second)); entry.push_back(Pair(item.first, item.second));
} }
@ -1673,7 +1673,7 @@ UniValue listaccounts(const JSONRPCRequest& request)
mapAccountBalances[entry.strAccount] += entry.nCreditDebit; mapAccountBalances[entry.strAccount] += entry.nCreditDebit;
UniValue ret(UniValue::VOBJ); UniValue ret(UniValue::VOBJ);
for (const PAIRTYPE(std::string, CAmount)& accountBalance : mapAccountBalances) { for (const std::pair<std::string, CAmount>& accountBalance : mapAccountBalances) {
ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second))); ret.push_back(Pair(accountBalance.first, ValueFromAmount(accountBalance.second)));
} }
return ret; return ret;

View file

@ -804,7 +804,7 @@ void CWallet::MarkDirty()
{ {
{ {
LOCK(cs_wallet); LOCK(cs_wallet);
for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) for (std::pair<const uint256, CWalletTx>& item : mapWallet)
item.second.MarkDirty(); item.second.MarkDirty();
} }
} }
@ -1525,7 +1525,7 @@ void CWallet::ReacceptWalletTransactions()
std::map<int64_t, CWalletTx*> mapSorted; std::map<int64_t, CWalletTx*> mapSorted;
// Sort pending wallet transactions based on their initial wallet insertion order // Sort pending wallet transactions based on their initial wallet insertion order
for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) for (std::pair<const uint256, CWalletTx>& item : mapWallet)
{ {
const uint256& wtxid = item.first; const uint256& wtxid = item.first;
CWalletTx& wtx = item.second; CWalletTx& wtx = item.second;
@ -1539,7 +1539,7 @@ void CWallet::ReacceptWalletTransactions()
} }
// Try to add wallet transactions to memory pool // Try to add wallet transactions to memory pool
for (PAIRTYPE(const int64_t, CWalletTx*)& item : mapSorted) for (std::pair<const int64_t, CWalletTx*>& item : mapSorted)
{ {
CWalletTx& wtx = *(item.second); CWalletTx& wtx = *(item.second);
@ -1796,7 +1796,7 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime, CCon
LOCK(cs_wallet); LOCK(cs_wallet);
// Sort them in chronological order // Sort them in chronological order
std::multimap<unsigned int, CWalletTx*> mapSorted; std::multimap<unsigned int, CWalletTx*> mapSorted;
for (PAIRTYPE(const uint256, CWalletTx)& item : mapWallet) for (std::pair<const uint256, CWalletTx>& item : mapWallet)
{ {
CWalletTx& wtx = item.second; CWalletTx& wtx = item.second;
// Don't rebroadcast if newer than nTime: // Don't rebroadcast if newer than nTime:
@ -1804,7 +1804,7 @@ std::vector<uint256> CWallet::ResendWalletTransactionsBefore(int64_t nTime, CCon
continue; continue;
mapSorted.insert(std::make_pair(wtx.nTimeReceived, &wtx)); mapSorted.insert(std::make_pair(wtx.nTimeReceived, &wtx));
} }
for (PAIRTYPE(const unsigned int, CWalletTx*)& item : mapSorted) for (std::pair<const unsigned int, CWalletTx*>& item : mapSorted)
{ {
CWalletTx& wtx = *item.second; CWalletTx& wtx = *item.second;
if (wtx.RelayWalletTransaction(connman)) if (wtx.RelayWalletTransaction(connman))
@ -3010,7 +3010,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address)
// Delete destdata tuples associated with address // Delete destdata tuples associated with address
std::string strAddress = CBitcoinAddress(address).ToString(); std::string strAddress = CBitcoinAddress(address).ToString();
for (const PAIRTYPE(std::string, std::string) &item : mapAddressBook[address].destdata) for (const std::pair<std::string, std::string> &item : mapAddressBook[address].destdata)
{ {
CWalletDB(*dbw).EraseDestData(strAddress, item.first); CWalletDB(*dbw).EraseDestData(strAddress, item.first);
} }
@ -3388,7 +3388,7 @@ std::set<CTxDestination> CWallet::GetAccountAddresses(const std::string& strAcco
{ {
LOCK(cs_wallet); LOCK(cs_wallet);
std::set<CTxDestination> result; std::set<CTxDestination> result;
for (const PAIRTYPE(CTxDestination, CAddressBookData)& item : mapAddressBook) for (const std::pair<CTxDestination, CAddressBookData>& item : mapAddressBook)
{ {
const CTxDestination& address = item.first; const CTxDestination& address = item.first;
const std::string& strName = item.second.name; const std::string& strName = item.second.name;