From: alex Date: Sat, 24 Aug 2013 14:55:18 +0000 (+0400) Subject: Remove loop macro from util.h X-Git-Tag: v0.4.4.4~28 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=21c897e170c14da4754fb699d701b9980f092959 Remove loop macro from util.h This macro causes a lot of problems for Qt. --- diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 645fa97..61f88f2 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -426,7 +426,7 @@ int ReadHTTPStatus(std::basic_istream& stream, int &proto) int ReadHTTPHeader(std::basic_istream& stream, map& mapHeadersRet) { int nLen = 0; - loop + while (true) { string str; std::getline(stream, str); @@ -976,7 +976,8 @@ void ThreadRPCServer3(void* parg) AcceptedConnection *conn = (AcceptedConnection *) parg; bool fRun = true; - loop { + while (true) + { if (fShutdown || !fRun) { conn->close(); diff --git a/src/db.cpp b/src/db.cpp index a277508..31abe1d 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -837,7 +837,7 @@ bool CTxDB::LoadBlockIndexGuts() // Load mapBlockIndex unsigned int fFlags = DB_SET_RANGE; - loop + while (true) { // Read next record CDataStream ssKey(SER_DISK, CLIENT_VERSION); diff --git a/src/irc.cpp b/src/irc.cpp index 0499c8f..4a87fb7 100644 --- a/src/irc.cpp +++ b/src/irc.cpp @@ -77,7 +77,7 @@ static bool Send(SOCKET hSocket, const char* pszSend) bool RecvLineIRC(SOCKET hSocket, string& strLine) { - loop + while (true) { bool fRet = RecvLine(hSocket, strLine); if (fRet) @@ -100,7 +100,7 @@ bool RecvLineIRC(SOCKET hSocket, string& strLine) int RecvUntil(SOCKET hSocket, const char* psz1, const char* psz2=NULL, const char* psz3=NULL, const char* psz4=NULL) { - loop + while (true) { string strLine; strLine.reserve(10000); @@ -135,7 +135,7 @@ bool Wait(int nSeconds) bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet) { strRet.clear(); - loop + while (true) { string strLine; if (!RecvLineIRC(hSocket, strLine)) diff --git a/src/main.cpp b/src/main.cpp index 77d5acd..9a99ad7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2668,7 +2668,7 @@ static unsigned int nCurrentBlockFile = 1; FILE* AppendBlockFile(unsigned int& nFileRet) { nFileRet = 0; - loop + while (true) { FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab"); if (!file) @@ -3740,7 +3740,7 @@ bool ProcessMessages(CNode* pfrom) // (x) data // - loop + while (true) { // Don't bother if send buffer is too full to respond anyway if (pfrom->vSend.size() >= SendBufferSize()) diff --git a/src/net.cpp b/src/net.cpp index 455ab12..72ec614 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -140,7 +140,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer) bool RecvLine(SOCKET hSocket, string& strLine) { strLine = ""; - loop + while (true) { char c; int nBytes = recv(hSocket, &c, 1, 0); @@ -313,7 +313,7 @@ bool GetMyExternalIP2(const CService& addrConnect, const char* pszGet, const cha { if (strLine.empty()) // HTTP response is separated from headers by blank line { - loop + while (true) { if (!RecvLine(hSocket, strLine)) { @@ -665,7 +665,7 @@ void ThreadSocketHandler2(void* parg) list vNodesDisconnected; unsigned int nPrevNodeCount = 0; - loop + while (true) { // // Disconnect nodes @@ -1078,7 +1078,8 @@ void ThreadMapPort2(void* parg) else printf("UPnP Port Mapping successful.\n"); int i = 1; - loop { + while (true) + { if (fShutdown || !fUseUPnP) { r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0); @@ -1113,7 +1114,8 @@ void ThreadMapPort2(void* parg) freeUPNPDevlist(devlist); devlist = 0; if (r != 0) FreeUPNPUrls(&urls); - loop { + while (true) + { if (fShutdown || !fUseUPnP) return; Sleep(2000); @@ -1349,7 +1351,7 @@ void ThreadOpenConnections2(void* parg) // Initiate network connections int64 nStart = GetTime(); - loop + while (true) { ProcessOneShot(); @@ -1408,7 +1410,7 @@ void ThreadOpenConnections2(void* parg) int64 nANow = GetAdjustedTime(); int nTries = 0; - loop + while (true) { // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections) CAddress addr = addrman.Select(10 + min(nOutbound,8)*10); @@ -1501,7 +1503,7 @@ void ThreadOpenAddedConnections2(void* parg) } } } - loop + while (true) { vector > vservConnectAddresses = vservAddressesToAdd; // Attempt to connect to each IP for each addnode entry until at least one is successful per addnode entry diff --git a/src/qt/qtipcserver.cpp b/src/qt/qtipcserver.cpp index 707cd02..bb49dac 100644 --- a/src/qt/qtipcserver.cpp +++ b/src/qt/qtipcserver.cpp @@ -98,7 +98,7 @@ static void ipcThread2(void* pArg) size_t nSize = 0; unsigned int nPriority = 0; - loop + while (true) { ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100); if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d)) diff --git a/src/script.cpp b/src/script.cpp index 645b67c..34c02cf 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1257,7 +1257,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector& v) return; string::size_type i1 = 0; string::size_type i2; - loop + while (true) { i2 = str.find(c, i1); if (i2 == str.npos) @@ -466,7 +466,7 @@ vector ParseHex(const char* psz) { // convert hex dump to vector vector vch; - loop + while (true) { while (isspace(*psz)) psz++; @@ -920,7 +920,7 @@ string DecodeBase32(const string& str) bool WildcardMatch(const char* psz, const char* mask) { - loop + while (true) { switch (*mask) { diff --git a/src/util.h b/src/util.h index e83f554..df1a3b1 100644 --- a/src/util.h +++ b/src/util.h @@ -35,7 +35,6 @@ typedef unsigned long long uint64; static const int64 COIN = 1000000; static const int64 CENT = 10000; -#define loop for (;;) #define BEGIN(a) ((char*)&(a)) #define END(a) ((char*)&((&(a))[1])) #define UBEGIN(a) ((unsigned char*)&(a)) diff --git a/src/wallet.cpp b/src/wallet.cpp index aecb227..71b19c5 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1257,7 +1257,7 @@ bool CWallet::CreateTransaction(const vector >& vecSend, CW CTxDB txdb("r"); { nFeeRet = nTransactionFee; - loop + while (true) { wtxNew.vin.clear(); wtxNew.vout.clear(); @@ -1602,7 +1602,7 @@ bool CWallet::CreateCoinStake(const CKeyStore& keystore, unsigned int nBits, int } int64 nMinFee = 0; - loop + while (true) { // Set output amount if (txNew.vout.size() == 3) diff --git a/src/walletdb.cpp b/src/walletdb.cpp index 07a062e..087ac9b 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -74,7 +74,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list