Merge pull request #290 from svost/patch
authorCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 15 Mar 2016 22:00:00 +0000 (01:00 +0300)
committerCryptoManiac <CryptoManiac@users.noreply.github.com>
Tue, 15 Mar 2016 22:00:00 +0000 (01:00 +0300)
Minor fix

14 files changed:
src/bitcoinrpc.cpp
src/checkpoints.cpp
src/init.cpp
src/irc.cpp
src/main.cpp
src/net.cpp
src/qt/qtipcserver.cpp
src/script.cpp
src/txdb-bdb.cpp
src/txdb-leveldb.cpp
src/util.cpp
src/version.cpp
src/wallet.cpp
src/walletdb.cpp

index d0f4e15..b555f0b 100644 (file)
@@ -441,7 +441,7 @@ int ReadHTTPStatus(std::basic_istream<char>& stream, int &proto)
 int ReadHTTPHeader(std::basic_istream<char>& stream, map<string, string>& mapHeadersRet)
 {
     int nLen = 0;
-    while (true)
+    for ( ; ; )
     {
         string str;
         std::getline(stream, str);
@@ -992,7 +992,7 @@ void ThreadRPCServer3(void* parg)
     AcceptedConnection *conn = (AcceptedConnection *) parg;
 
     bool fRun = true;
-    while (true)
+    for ( ; ; )
     {
         if (fShutdown || !fRun)
         {
index 095def3..05d55a4 100644 (file)
@@ -34,7 +34,7 @@ namespace Checkpoints
         ( 200000, std::make_pair(uint256("0x0000000000029f8bbf66e6ea6f3e5db55009404aae0fe395a53dd33142b2bff2"), 1441127233) )
         ( 221047, std::make_pair(uint256("0xa28aef712e7aa0c285bfe29351ca21ed416689139e3063ef770fc826a8b9e9da"), 1449431646) )
     ;
-    
+
     static ListBannedBlocks listBanned =
         boost::assign::list_of
         // Invalid block #221047 with future timestamp of 2016/02/23 09:24:17 UTC
@@ -129,7 +129,7 @@ namespace Checkpoints
             // that current checkpoint should be a descendant block
             CBlockIndex* pindex = pindexSyncCheckpoint;
             while (pindex->nHeight > pindexCheckpointRecv->nHeight)
-                if (!(pindex = pindex->pprev))
+                if ((pindex = pindex->pprev) == NULL)
                     return error("ValidateSyncCheckpoint: pprev null - block index structure failure");
             if (pindex->GetBlockHash() != hashCheckpoint)
             {
@@ -144,7 +144,7 @@ namespace Checkpoints
         // to verify.
         CBlockIndex* pindex = pindexCheckpointRecv;
         while (pindex->nHeight > pindexSyncCheckpoint->nHeight)
-            if (!(pindex = pindex->pprev))
+            if ((pindex = pindex->pprev) == NULL)
                 return error("ValidateSyncCheckpoint: pprev2 null - block index structure failure");
         if (pindex->GetBlockHash() != hashSyncCheckpoint)
         {
@@ -246,7 +246,7 @@ namespace Checkpoints
             // trace back to same height as sync-checkpoint
             const CBlockIndex* pindex = pindexPrev;
             while (pindex->nHeight > pindexSync->nHeight)
-                if (!(pindex = pindex->pprev))
+                if ((pindex = pindex->pprev) == NULL)
                     return error("CheckSync: pprev null - block index structure failure");
             if (pindex->nHeight < pindexSync->nHeight || pindex->GetBlockHash() != hashSyncCheckpoint)
                 return false; // only descendant of sync-checkpoint can pass check
index 8fec3c6..8fab885 100644 (file)
@@ -1013,7 +1013,7 @@ bool AppInit2()
 #if !defined(QT_GUI)
     // Loop until process is exit()ed from shutdown() function,
     // called from ThreadRPCServer thread when a "stop" command is received.
-    while (1)
+    for ( ; ; )
         Sleep(5000);
 #endif
 
index ecdafaa..b594529 100644 (file)
@@ -75,7 +75,7 @@ static bool Send(SOCKET hSocket, const char* pszSend)
 
 bool RecvLineIRC(SOCKET hSocket, string& strLine)
 {
-    while (true)
+    for ( ; ; )
     {
         bool fRet = RecvLine(hSocket, strLine);
         if (fRet)
@@ -98,7 +98,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)
 {
-    while (true)
+    for ( ; ; )
     {
         string strLine;
         strLine.reserve(10000);
@@ -133,7 +133,7 @@ bool Wait(int nSeconds)
 bool RecvCodeLine(SOCKET hSocket, const char* psz1, string& strRet)
 {
     strRet.clear();
-    while (true)
+    for ( ; ; )
     {
         string strLine;
         if (!RecvLineIRC(hSocket, strLine))
index 1668679..38b3ac5 100644 (file)
@@ -2723,7 +2723,7 @@ static unsigned int nCurrentBlockFile = 1;
 FILE* AppendBlockFile(unsigned int& nFileRet)
 {
     nFileRet = 0;
-    while (true)
+    for ( ; ; )
     {
         FILE* file = OpenBlockFile(nCurrentBlockFile, 0, "ab");
         if (!file)
@@ -3808,7 +3808,7 @@ bool ProcessMessages(CNode* pfrom)
     //  (x) data
     //
 
-    while (true)
+    for ( ; ; )
     {
         // Don't bother if send buffer is too full to respond anyway
         if (pfrom->vSend.size() >= SendBufferSize())
index 756e5cb..5a853da 100644 (file)
@@ -143,7 +143,7 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer)
 bool RecvLine(SOCKET hSocket, string& strLine)
 {
     strLine = "";
-    while (true)
+    for ( ; ; )
     {
         char c;
         int nBytes = recv(hSocket, &c, 1, 0);
@@ -606,7 +606,7 @@ void ThreadSocketHandler2(void* parg)
 {
     printf("ThreadSocketHandler started\n");
     size_t nPrevNodeCount = 0;
-    while (true)
+    for ( ; ; )
     {
         //
         // Disconnect nodes
@@ -1154,7 +1154,7 @@ void ThreadOpenConnections2(void* parg)
 
     // Initiate network connections
     int64_t nStart = GetTime();
-    while (true)
+    for ( ; ; )
     {
         ProcessOneShot();
 
@@ -1225,7 +1225,7 @@ void ThreadOpenConnections2(void* parg)
         int64_t nANow = GetAdjustedTime();
 
         int nTries = 0;
-        while (true)
+        for ( ; ; )
         {
             // use an nUnkBias between 10 (no outgoing connections) and 90 (8 outgoing connections)
             CAddress addr = addrman.Select(10 + min(nOutbound,8)*10);
index c446793..8d2d30f 100644 (file)
@@ -100,7 +100,7 @@ static void ipcThread2(void* pArg)
     size_t nSize = 0;
     unsigned int nPriority = 0;
 
-    while (true)
+    for ( ; ; )
     {
         ptime d = boost::posix_time::microsec_clock::universal_time() + millisec(100);
         if (mq->timed_receive(&buffer, sizeof(buffer), nSize, nPriority, d))
index 16dfa99..1b82de4 100644 (file)
@@ -1384,7 +1384,7 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
         // Compare
         CScript::const_iterator pc1 = script1.begin();
         CScript::const_iterator pc2 = script2.begin();
-        while (true)
+        for ( ; ; )
         {
             if (pc1 == script1.end() && pc2 == script2.end())
             {
index 5ce59b5..1235125 100644 (file)
@@ -362,7 +362,7 @@ bool CTxDB::LoadBlockIndexGuts()
 
     // Load mapBlockIndex
     unsigned int fFlags = DB_SET_RANGE;
-    while (true)
+    for ( ; ; )
     {
         // Read next record
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
index 97bf88c..8f956fe 100644 (file)
@@ -41,7 +41,7 @@ void init_blockindex(leveldb::Options& options, bool fRemoveOld = false) {
         filesystem::remove_all(directory); // remove directory
         unsigned int nFile = 1;
 
-        while (true)
+        for ( ; ; )
         {
             filesystem::path strBlockFile = GetDataDir() / strprintf("blk%04u.dat", nFile);
 
index a583cd5..42d38f6 100644 (file)
@@ -306,7 +306,7 @@ string vstrprintf(const char *format, va_list ap)
     char* p = buffer;
     int limit = sizeof(buffer);
     int ret;
-    while (true)
+    for ( ; ; )
     {
 #ifndef _MSC_VER
         va_list arg_ptr;
@@ -370,7 +370,7 @@ void ParseString(const string& str, char c, vector<string>& v)
         return;
     string::size_type i1 = 0;
     string::size_type i2;
-    while (true)
+    for ( ; ; )
     {
         i2 = str.find(c, i1);
         if (i2 == str.npos)
@@ -486,7 +486,7 @@ vector<unsigned char> ParseHex(const char* psz)
 {
     // convert hex dump to vector
     vector<unsigned char> vch;
-    while (true)
+    for ( ; ; )
     {
         while (isspace(*psz))
             psz++;
@@ -705,7 +705,7 @@ vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid)
     int mode = 0;
     int left = 0;
 
-    while (1)
+    for ( ; ; )
     {
          int dec = decode64_table[(unsigned char)*p];
          if (dec == -1) break;
@@ -858,7 +858,7 @@ vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid)
     int mode = 0;
     int left = 0;
 
-    while (1)
+    for ( ; ; )
     {
          int dec = decode32_table[(unsigned char)*p];
          if (dec == -1) break;
@@ -1001,7 +1001,7 @@ std::string DecodeDumpString(const std::string &str) {
 
 bool WildcardMatch(const char* psz, const char* mask)
 {
-    while (true)
+    for ( ; ; )
     {
         switch (*mask)
         {
index e5d592d..8430dc7 100644 (file)
@@ -18,27 +18,24 @@ const std::string CLIENT_NAME("Satoshi");
 #endif
 
 // Compiler name
-#if defined(__GNUC__) && defined(__INTEL_COMPILER)
-/*code specific to linux icc compiler*/
-#define CL_NAME   "-icc"
-#else
-#ifdef __GNUC__
-/*code for GNU C compiler */
-#define CL_NAME   "-gcc"
+#ifdef __INTEL_COMPILER
+//code specific to intel compiler
+#define CL_NAME   "-icpc"
 #elif _MSC_VER
-/*usually has the version number in _MSC_VER*/
-/*code specific to MSVC compiler*/
+//code specific to MSVC compiler
 #define CL_NAME   "-msvc"
 #elif __clang__
-/*code specific to clang compilers*/
+//code specific to clang compilers
 #define CL_NAME   "-clang"
+#elif __GNUC__
+//code for GNU C compiler
+#define CL_NAME   "-gcc"
 #elif __MINGW32__
-/*code specific to mingw compilers*/
+//code specific to mingw compilers
 #define CL_NAME   "-mingw"
 #else
 #define CL_NAME   "-genericcl"
-/*others*/
-#endif
+//others
 #endif
 
 // The following part of the code determines the CLIENT_BUILD variable.
index 2ee7dfa..87ffe93 100644 (file)
@@ -1660,7 +1660,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
         CTxDB txdb("r");
         {
             nFeeRet = nTransactionFee;
-            while (true)
+            for ( ; ; )
             {
                 wtxNew.vin.clear();
                 wtxNew.vout.clear();
@@ -2048,7 +2048,7 @@ bool CWallet::CreateCoinStake(uint256 &hashTx, uint32_t nOut, uint32_t nGenerati
     nCredit += GetProofOfStakeReward(nCoinAge, nBits, nGenerationTime);
 
     int64_t nMinFee = 0;
-    while (true)
+    for ( ; ; )
     {
         // Set output amount
         if (fDontSplitCoins)
index 640f78b..cd90f97 100644 (file)
@@ -85,7 +85,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;
-    while (true)
+    for ( ; ; )
     {
         // Read next record
         CDataStream ssKey(SER_DISK, CLIENT_VERSION);
@@ -525,7 +525,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
             return DB_CORRUPT;
         }
 
-        while (true)
+        for ( ; ; )
         {
             // Read next record
             CDataStream ssKey(SER_DISK, CLIENT_VERSION);
@@ -625,7 +625,7 @@ DBErrors CWalletDB::FindWalletTx(CWallet* pwallet, vector<uint256>& vTxHash)
             return DB_CORRUPT;
         }
 
-        while (true)
+        for ( ; ; )
         {
             // Read next record
             CDataStream ssKey(SER_DISK, CLIENT_VERSION);