From 8d657a651735426388c5f7462e2dbf24225a26cb Mon Sep 17 00:00:00 2001 From: ENikS Date: Sat, 6 Sep 2014 15:59:59 -0400 Subject: [PATCH] Fixing compiler warning C4800: 'type' forcing value to bool 'true' or 'false' --- src/allocators.cpp | 4 ++-- src/coins.h | 4 ++-- src/crypter.cpp | 12 ++++++------ src/db.cpp | 2 +- src/init.cpp | 4 ++-- src/key.cpp | 8 ++++---- src/rpcwallet.cpp | 2 +- src/util.cpp | 2 +- src/wallet.cpp | 8 ++++---- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/allocators.cpp b/src/allocators.cpp index 15f34aa2c8..8ecd7206cd 100644 --- a/src/allocators.cpp +++ b/src/allocators.cpp @@ -46,7 +46,7 @@ static inline size_t GetSystemPageSize() bool MemoryPageLocker::Lock(const void *addr, size_t len) { #ifdef WIN32 - return VirtualLock(const_cast(addr), len); + return VirtualLock(const_cast(addr), len) != 0; #else return mlock(addr, len) == 0; #endif @@ -55,7 +55,7 @@ bool MemoryPageLocker::Lock(const void *addr, size_t len) bool MemoryPageLocker::Unlock(const void *addr, size_t len) { #ifdef WIN32 - return VirtualUnlock(const_cast(addr), len); + return VirtualUnlock(const_cast(addr), len) != 0; #else return munlock(addr, len) == 0; #endif diff --git a/src/coins.h b/src/coins.h index d338e3172e..e70b19ff8f 100644 --- a/src/coins.h +++ b/src/coins.h @@ -195,8 +195,8 @@ public: ::Unserialize(s, VARINT(nCode), nType, nVersion); fCoinBase = nCode & 1; std::vector vAvail(2, false); - vAvail[0] = nCode & 2; - vAvail[1] = nCode & 4; + vAvail[0] = (nCode & 2) != 0; + vAvail[1] = (nCode & 4) != 0; unsigned int nMaskCode = (nCode / 8) + ((nCode & 6) != 0 ? 0 : 1); // spentness bitmask while (nMaskCode > 0) { diff --git a/src/crypter.cpp b/src/crypter.cpp index 8aa2bb0517..8f5822dfc5 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -62,9 +62,9 @@ bool CCrypter::Encrypt(const CKeyingMaterial& vchPlaintext, std::vector& vchCiphertext, CKeyingM bool fOk = true; EVP_CIPHER_CTX_init(&ctx); - if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV); - if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen); - if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0])+nPLen, &nFLen); + if (fOk) fOk = EVP_DecryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, chKey, chIV) != 0; + if (fOk) fOk = EVP_DecryptUpdate(&ctx, &vchPlaintext[0], &nPLen, &vchCiphertext[0], nLen) != 0; + if (fOk) fOk = EVP_DecryptFinal_ex(&ctx, (&vchPlaintext[0]) + nPLen, &nFLen) != 0; EVP_CIPHER_CTX_cleanup(&ctx); if (!fOk) return false; diff --git a/src/db.cpp b/src/db.cpp index 23d2cc988d..4ffbd61edd 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -231,7 +231,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) : if (pszFile == NULL) return; - bool fCreate = strchr(pszMode, 'c'); + bool fCreate = strchr(pszMode, 'c') != NULL; unsigned int nFlags = DB_THREAD; if (fCreate) nFlags |= DB_CREATE; diff --git a/src/init.cpp b/src/init.cpp index b8988f8b75..1450e3481f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -198,7 +198,7 @@ bool static Bind(const CService &addr, unsigned int flags) { if (!(flags & BF_EXPLICIT) && IsLimited(addr)) return false; std::string strError; - if (!BindListenPort(addr, strError, flags & BF_WHITELIST)) { + if (!BindListenPort(addr, strError, (flags & BF_WHITELIST) != 0)) { if (flags & BF_REPORT_ERROR) return InitError(strError); return false; @@ -692,7 +692,7 @@ bool AppInit2(boost::thread_group& threadGroup) std::string strWalletFile = GetArg("-wallet", "wallet.dat"); #endif // ENABLE_WALLET - fIsBareMultisigStd = GetArg("-permitbaremultisig", true); + fIsBareMultisigStd = GetArg("-permitbaremultisig", true) != 0; // ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log // Sanity check diff --git a/src/key.cpp b/src/key.cpp index a058ef05e5..8ed787654a 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -172,9 +172,9 @@ public: bool ret; BIGNUM bn; BN_init(&bn); - ret = BN_bin2bn(vch, 32, &bn); + ret = BN_bin2bn(vch, 32, &bn) != NULL; assert(ret); - ret = EC_KEY_regenerate_key(pkey, &bn); + ret = EC_KEY_regenerate_key(pkey, &bn) != 0; assert(ret); BN_clear_free(&bn); } @@ -217,7 +217,7 @@ public: bool SetPubKey(const CPubKey &pubkey) { const unsigned char* pbegin = pubkey.begin(); - return o2i_ECPublicKey(&pkey, &pbegin, pubkey.size()); + return o2i_ECPublicKey(&pkey, &pbegin, pubkey.size()) != NULL; } bool Sign(const uint256 &hash, std::vector& vchSig) { @@ -553,7 +553,7 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vectormapWallet[hash]; - int64_t nCredit = wtx.GetCredit(filter); + int64_t nCredit = wtx.GetCredit(filter != 0); int64_t nDebit = wtx.GetDebit(filter); int64_t nNet = nCredit - nDebit; int64_t nFee = (wtx.IsFromMe(filter) ? wtx.GetValueOut() - nDebit : 0); diff --git a/src/util.cpp b/src/util.cpp index 5a4e187f9e..1a11d038ca 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -494,7 +494,7 @@ bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest) { #ifdef WIN32 return MoveFileExA(src.string().c_str(), dest.string().c_str(), - MOVEFILE_REPLACE_EXISTING); + MOVEFILE_REPLACE_EXISTING) != 0; #else int rc = std::rename(src.string().c_str(), dest.string().c_str()); return (rc == 0); diff --git a/src/wallet.cpp b/src/wallet.cpp index 18a5b3971c..20ee0bbe84 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -637,7 +637,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl { { AssertLockHeld(cs_wallet); - bool fExisted = mapWallet.count(tx.GetHash()); + bool fExisted = mapWallet.count(tx.GetHash()) != 0; if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) { @@ -1129,7 +1129,7 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const if (!(IsSpent(wtxid, i)) && mine != ISMINE_NO && !IsLockedCoin((*it).first, i) && pcoin->vout[i].nValue > 0 && (!coinControl || !coinControl->HasSelected() || coinControl->IsSelected((*it).first, i))) - vCoins.push_back(COutput(pcoin, i, nDepth, mine & ISMINE_SPENDABLE)); + vCoins.push_back(COutput(pcoin, i, nDepth, (mine & ISMINE_SPENDABLE) != ISMINE_NO)); } } } @@ -1655,7 +1655,7 @@ bool CWallet::SetAddressBook(const CTxDestination& address, const string& strNam if (!strPurpose.empty()) /* update purpose only if requested */ mapAddressBook[address].purpose = strPurpose; } - NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), + NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address) != ISMINE_NO, strPurpose, (fUpdated ? CT_UPDATED : CT_NEW) ); if (!fFileBacked) return false; @@ -1681,7 +1681,7 @@ bool CWallet::DelAddressBook(const CTxDestination& address) mapAddressBook.erase(address); } - NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), "", CT_DELETED); + NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address) != ISMINE_NO, "", CT_DELETED); if (!fFileBacked) return false;