Remove #define loop from util.h

Replace the loop macro with while (true). The #define caused
problems for Qt.
This commit is contained in:
Gavin Andresen 2013-07-31 14:06:44 +10:00
parent c4316fefa5
commit 050d2e953f
13 changed files with 17 additions and 23 deletions

View file

@ -414,7 +414,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
int ReadHTTPHeaders(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
{
int nLen = 0;
loop
while (true)
{
string str;
std::getline(stream, str);

View file

@ -4615,7 +4615,7 @@ void static BitcoinMiner(CWallet *pwallet)
CReserveKey reservekey(pwallet);
unsigned int nExtraNonce = 0;
try { loop {
try { while (true) {
if (Params().NetworkID() != CChainParams::REGTEST) {
// Busy-wait for the network to come online so we don't waste time mining
// on an obsolete chain. In regtest mode we expect to fly solo.
@ -4659,7 +4659,7 @@ void static BitcoinMiner(CWallet *pwallet)
uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256();
uint256 hashbuf[2];
uint256& hash = *alignup<16>(hashbuf);
loop
while (true)
{
unsigned int nHashesDone = 0;
unsigned int nNonceFound;

View file

@ -129,7 +129,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);
@ -301,7 +301,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))
{
@ -741,7 +741,7 @@ static list<CNode*> vNodesDisconnected;
void ThreadSocketHandler()
{
unsigned int nPrevNodeCount = 0;
loop
while (true)
{
//
// Disconnect nodes
@ -1105,7 +1105,7 @@ void ThreadMapPort()
string strDesc = "Bitcoin " + FormatFullVersion();
try {
loop {
while (true) {
#ifndef UPNPDISCOVER_SUCCESS
/* miniupnpc 1.5 */
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
@ -1268,7 +1268,7 @@ void ThreadOpenConnections()
// Initiate network connections
int64 nStart = GetTime();
loop
while (true)
{
ProcessOneShot();
@ -1309,7 +1309,7 @@ void ThreadOpenConnections()
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);

View file

@ -15,7 +15,6 @@
#include "splashscreen.h"
#include "intro.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
#include <QMessageBox>
#if QT_VERSION < 0x050000

View file

@ -28,7 +28,6 @@
#include "macdockiconhandler.h"
#endif
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
#include <QMenuBar>
#include <QMenu>

View file

@ -7,7 +7,6 @@
#include "util.h"
#include "init.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
#include <QDateTime>
#include <QDoubleValidator>

View file

@ -8,7 +8,6 @@
#include "ui_interface.h"
#include "util.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
#include <QByteArray>
#include <QDataStream>

View file

@ -2,7 +2,6 @@
#include "clientversion.h"
#include "util.h"
#undef loop /* Todo: ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
#include <QPainter>

View file

@ -1163,7 +1163,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
// Compare
CScript::const_iterator pc1 = script1.begin();
CScript::const_iterator pc2 = script2.begin();
loop
while (true)
{
if (pc1 == script1.end() && pc2 == script2.end())
{

View file

@ -311,7 +311,7 @@ string vstrprintf(const char *format, va_list ap)
char* p = buffer;
int limit = sizeof(buffer);
int ret;
loop
while (true)
{
va_list arg_ptr;
va_copy(arg_ptr, ap);
@ -371,7 +371,7 @@ void ParseString(const string& str, char c, vector<string>& v)
return;
string::size_type i1 = 0;
string::size_type i2;
loop
while (true)
{
i2 = str.find(c, i1);
if (i2 == str.npos)
@ -487,7 +487,7 @@ vector<unsigned char> ParseHex(const char* psz)
{
// convert hex dump to vector
vector<unsigned char> vch;
loop
while (true)
{
while (isspace(*psz))
psz++;
@ -941,7 +941,7 @@ string DecodeBase32(const string& str)
bool WildcardMatch(const char* psz, const char* mask)
{
loop
while (true)
{
switch (*mask)
{

View file

@ -35,7 +35,6 @@ typedef unsigned long long uint64;
static const int64 COIN = 100000000;
static const int64 CENT = 1000000;
#define loop for (;;)
#define BEGIN(a) ((char*)&(a))
#define END(a) ((char*)&((&(a))[1]))
#define UBEGIN(a) ((unsigned char*)&(a))

View file

@ -1194,7 +1194,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend,
LOCK2(cs_main, cs_wallet);
{
nFeeRet = nTransactionFee;
loop
while (true)
{
wtxNew.vin.clear();
wtxNew.vout.clear();

View file

@ -73,7 +73,7 @@ void CWalletDB::ListAccountCreditDebit(const string& strAccount, list<CAccountin
if (!pcursor)
throw runtime_error("CWalletDB::ListAccountCreditDebit() : cannot create DB cursor");
unsigned int fFlags = DB_SET_RANGE;
loop
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
@ -437,7 +437,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
return DB_CORRUPT;
}
loop
while (true)
{
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);