diff --git a/src/init.cpp b/src/init.cpp index ee69d2207..66272e842 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -217,16 +217,16 @@ bool AppInit(int argc, char* argv[]) PrintExceptionContinue(NULL, "AppInit()"); } if (!fRet) { - if (detectShutdownThread) - detectShutdownThread->interrupt(); - threadGroup.interrupt_all(); + if (detectShutdownThread) + detectShutdownThread->interrupt(); + threadGroup.interrupt_all(); } if (detectShutdownThread) { detectShutdownThread->join(); delete detectShutdownThread; - detectShutdownThread = NULL; + detectShutdownThread = NULL; } Shutdown(); @@ -376,7 +376,6 @@ struct CImportingNow } }; - void ThreadImport(std::vector vImportFiles) { RenameThread("bitcoin-loadblk"); @@ -633,7 +632,6 @@ bool AppInit2(boost::thread_group& threadGroup) // ********************************************************* Step 6: network initialization int nSocksVersion = GetArg("-socks", 5); - if (nSocksVersion != 4 && nSocksVersion != 5) return InitError(strprintf(_("Unknown -socks proxy version requested: %i"), nSocksVersion)); @@ -733,6 +731,7 @@ bool AppInit2(boost::thread_group& threadGroup) fReindex = GetBoolArg("-reindex"); + // Todo: Check if needed, because in step 5 we do the same if (!bitdb.Open(GetDataDir())) { string msg = strprintf(_("Error initializing database environment %s!" diff --git a/src/main.cpp b/src/main.cpp index fb8f1b3b1..7f408c4d1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2655,12 +2655,12 @@ bool VerifyDB() { CBlockIndex *pindex = pindexState; while (pindex != pindexBest) { boost::this_thread::interruption_point(); - pindex = pindex->pnext; - CBlock block; - if (!block.ReadFromDisk(pindex)) - return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); - if (!block.ConnectBlock(state, pindex, coins)) - return error("VerifyDB() : *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); + pindex = pindex->pnext; + CBlock block; + if (!block.ReadFromDisk(pindex)) + return error("VerifyDB() : *** block.ReadFromDisk failed at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); + if (!block.ConnectBlock(state, pindex, coins)) + return error("VerifyDB() : *** found unconnectable block at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString().c_str()); } } diff --git a/src/net.cpp b/src/net.cpp index 5f8b5ba32..0defa96e4 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -344,13 +344,13 @@ bool GetMyExternalIP(CNetAddr& ipRet) for (int nLookup = 0; nLookup <= 1; nLookup++) for (int nHost = 1; nHost <= 2; nHost++) { - // We should be phasing out our use of sites like these. If we need + // We should be phasing out our use of sites like these. If we need // replacements, we should ask for volunteers to put this simple // php file on their web server that prints the client IP: // if (nHost == 1) { - addrConnect = CService("91.198.22.70",80); // checkip.dyndns.org + addrConnect = CService("91.198.22.70", 80); // checkip.dyndns.org if (nLookup == 1) { @@ -424,12 +424,10 @@ void AddressCurrentlyConnected(const CService& addr) CNode* FindNode(const CNetAddr& ip) { - { - LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodes) - if ((CNetAddr)pnode->addr == ip) - return (pnode); - } + LOCK(cs_vNodes); + BOOST_FOREACH(CNode* pnode, vNodes) + if ((CNetAddr)pnode->addr == ip) + return (pnode); return NULL; } @@ -444,12 +442,10 @@ CNode* FindNode(std::string addrName) CNode* FindNode(const CService& addr) { - { - LOCK(cs_vNodes); - BOOST_FOREACH(CNode* pnode, vNodes) - if ((CService)pnode->addr == addr) - return (pnode); - } + LOCK(cs_vNodes); + BOOST_FOREACH(CNode* pnode, vNodes) + if ((CService)pnode->addr == addr) + return (pnode); return NULL; } diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index aba81cb3b..c59cf3c5e 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -61,6 +61,7 @@ public: void removeAllWallets(); /** Used by WalletView to allow access to needed QActions */ + // Todo: Use Qt signals for these QAction * getOverviewAction() { return overviewAction; } QAction * getHistoryAction() { return historyAction; } QAction * getAddressBookAction() { return addressBookAction; } diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h index cfc48afb3..1f2fdd466 100644 --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -37,6 +37,7 @@ class QLocalServer; class PaymentServer : public QObject { Q_OBJECT + private: bool saveURIs; QLocalServer* uriServer; diff --git a/src/util.cpp b/src/util.cpp index 9f5e08a14..64f8e1298 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1072,7 +1072,7 @@ const boost::filesystem::path &GetDataDir(bool fNetSpecific) fs::create_directory(path); - cachedPath[fNetSpecific]=true; + cachedPath[fNetSpecific] = true; return path; } @@ -1336,14 +1336,14 @@ void seed_insecure_rand(bool fDeterministic) insecure_rand_Rz = insecure_rand_Rw = 11; } else { uint32_t tmp; - do{ - RAND_bytes((unsigned char*)&tmp,4); - }while(tmp==0 || tmp==0x9068ffffU); - insecure_rand_Rz=tmp; - do{ - RAND_bytes((unsigned char*)&tmp,4); - }while(tmp==0 || tmp==0x464fffffU); - insecure_rand_Rw=tmp; + do { + RAND_bytes((unsigned char*)&tmp, 4); + } while(tmp == 0 || tmp == 0x9068ffffU); + insecure_rand_Rz = tmp; + do { + RAND_bytes((unsigned char*)&tmp, 4); + } while(tmp == 0 || tmp == 0x464fffffU); + insecure_rand_Rw = tmp; } } diff --git a/src/util.h b/src/util.h index 4d7c81be0..0641c4be7 100644 --- a/src/util.h +++ b/src/util.h @@ -419,9 +419,9 @@ extern uint32_t insecure_rand_Rz; extern uint32_t insecure_rand_Rw; static inline uint32_t insecure_rand(void) { - insecure_rand_Rz=36969*(insecure_rand_Rz&65535)+(insecure_rand_Rz>>16); - insecure_rand_Rw=18000*(insecure_rand_Rw&65535)+(insecure_rand_Rw>>16); - return (insecure_rand_Rw<<16)+insecure_rand_Rz; + insecure_rand_Rz = 36969 * (insecure_rand_Rz & 65535) + (insecure_rand_Rz >> 16); + insecure_rand_Rw = 18000 * (insecure_rand_Rw & 65535) + (insecure_rand_Rw >> 16); + return (insecure_rand_Rw << 16) + insecure_rand_Rz; } /** diff --git a/src/walletdb.cpp b/src/walletdb.cpp index abaf5a0fd..841553ea6 100644 --- a/src/walletdb.cpp +++ b/src/walletdb.cpp @@ -622,11 +622,11 @@ bool CWalletDB::Recover(CDBEnv& dbenv, std::string filename, bool fOnlyKeys) bool fSuccess = allOK; Db* pdbCopy = new Db(&dbenv.dbenv, 0); - int ret = pdbCopy->open(NULL, // Txn pointer + int ret = pdbCopy->open(NULL, // Txn pointer filename.c_str(), // Filename - "main", // Logical db name - DB_BTREE, // Database type - DB_CREATE, // Flags + "main", // Logical db name + DB_BTREE, // Database type + DB_CREATE, // Flags 0); if (ret > 0) {