From a6eb97b7072d7c15251d0157379136f62921590b Mon Sep 17 00:00:00 2001 From: svost Date: Fri, 18 Mar 2016 11:18:29 +0300 Subject: [PATCH] Fix set of msvc C4127 warning --- src/addrman.cpp | 4 ++-- src/net.cpp | 4 ++-- src/qt/intro.cpp | 2 +- src/rpcwallet.cpp | 4 ++-- src/serialize.h | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/addrman.cpp b/src/addrman.cpp index ed17c39..f24e7e7 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -398,7 +398,7 @@ CAddress CAddrMan::Select_(int nUnkBias) { // use a tried node double fChanceFactor = 1.0; - while(1) + for ( ; ; ) { int nKBucket = GetRandInt(vvTried.size()); std::vector &vTried = vvTried[nKBucket]; @@ -413,7 +413,7 @@ CAddress CAddrMan::Select_(int nUnkBias) } else { // use a new node double fChanceFactor = 1.0; - while(1) + for ( ; ; ) { int nUBucket = GetRandInt(vvNew.size()); std::set &vNew = vvNew[nUBucket]; diff --git a/src/net.cpp b/src/net.cpp index 5a853da..9d3b998 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1760,7 +1760,7 @@ bool StopNode() if (semOutbound) for (int i=0; ipost(); - do + for ( ; ; ) { int nThreadsRunning = 0; for (int n = 0; n < THREAD_MAX; n++) @@ -1770,7 +1770,7 @@ bool StopNode() if (GetTime() - nStart > 20) break; Sleep(20); - } while(true); + }; if (vnThreadsRunning[THREAD_SOCKETHANDLER] > 0) printf("ThreadSocketHandler still running\n"); if (vnThreadsRunning[THREAD_OPENCONNECTIONS] > 0) printf("ThreadOpenConnections still running\n"); if (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0) printf("ThreadMessageHandler still running\n"); diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp index fe31dd0..75c1c82 100644 --- a/src/qt/intro.cpp +++ b/src/qt/intro.cpp @@ -169,7 +169,7 @@ void Intro::pickDataDirectory() intro.setDataDirectory(dataDir); intro.setWindowIcon(QIcon(":icons/bitcoin")); - while(true) + for ( ; ; ) { if(!intro.exec()) { diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index 8c36836..aa8f876 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -1511,7 +1511,7 @@ void ThreadCleanWalletPassphrase(void* parg) { nWalletUnlockTime = nMyWakeTime; - do + for ( ; ; ) { if (nWalletUnlockTime==0) break; @@ -1523,7 +1523,7 @@ void ThreadCleanWalletPassphrase(void* parg) Sleep(nToSleep); ENTER_CRITICAL_SECTION(cs_nWalletUnlockTime); - } while(1); + }; if (nWalletUnlockTime) { diff --git a/src/serialize.h b/src/serialize.h index 8305dd0..bdcd830 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -270,7 +270,7 @@ template inline unsigned int GetSizeOfVarInt(I n) { int nRet = 0; - while(true) { + for ( ; ; ) { nRet++; if (n <= 0x7F) break; @@ -284,7 +284,7 @@ void WriteVarInt(Stream& os, I n) { unsigned char tmp[(sizeof(n)*8+6)/7]; int len=0; - while(true) { + for ( ; ; ) { tmp[len] = (n & 0x7F) | (len ? 0x80 : 0x00); if (n <= 0x7F) break; @@ -300,7 +300,7 @@ template I ReadVarInt(Stream& is) { I n = 0; - while(true) { + for ( ; ; ) { unsigned char chData; READDATA(is, chData); n = (n << 7) | (chData & 0x7F); -- 1.7.1