From: svost Date: Fri, 15 May 2015 17:12:17 +0000 (+0300) Subject: Fix MSVC C4800: 'type' forcing value to bool 'true' or 'false' X-Git-Tag: nvc-v0.5.3~7^2 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=3c3a7223dfbcc00eaa778f93276374aeb400c828 Fix MSVC C4800: 'type' forcing value to bool 'true' or 'false' --- diff --git a/src/crypter.cpp b/src/crypter.cpp index d6c3bc3..2a6f36d 100644 --- a/src/crypter.cpp +++ b/src/crypter.cpp @@ -64,9 +64,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 110a3f0..88d9cfd 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -254,7 +254,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) : return; fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); - 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/script.cpp b/src/script.cpp index 88587a0..8057bdb 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -334,7 +334,7 @@ bool IsCanonicalSignature(const valtype &vchSig, unsigned int flags) { if (!(flags & SCRIPT_VERIFY_STRICTENC)) return true; - return IsDERSignature(vchSig, true, flags & SCRIPT_VERIFY_LOW_S); + return IsDERSignature(vchSig, true, (flags & SCRIPT_VERIFY_LOW_S) != 0); } bool EvalScript(vector >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, unsigned int flags, int nHashType) diff --git a/src/util.cpp b/src/util.cpp index f4d229e..43c8038 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1235,7 +1235,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 deb5376..1f7e1a4 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -664,7 +664,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl uint256 hash = tx.GetHash(); { LOCK(cs_wallet); - bool fExisted = mapWallet.count(hash); + bool fExisted = mapWallet.count(hash) != 0; if (fExisted && !fUpdate) return false; if (fExisted || IsMine(tx) || IsFromMe(tx)) { @@ -2161,7 +2161,7 @@ bool CWallet::SetAddressBookName(const CTxDestination& address, const string& st { std::map::iterator mi = mapAddressBook.find(address); mapAddressBook[address] = strName; - NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address), (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); + NotifyAddressBookChanged(this, address, strName, ::IsMine(*this, address) != MINE_NO, (mi == mapAddressBook.end()) ? CT_NEW : CT_UPDATED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).WriteName(CBitcoinAddress(address).ToString(), strName); @@ -2170,7 +2170,7 @@ bool CWallet::SetAddressBookName(const CTxDestination& address, const string& st bool CWallet::DelAddressBookName(const CTxDestination& address) { mapAddressBook.erase(address); - NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address), CT_DELETED); + NotifyAddressBookChanged(this, address, "", ::IsMine(*this, address) != MINE_NO, CT_DELETED); if (!fFileBacked) return false; return CWalletDB(strWalletFile).EraseName(CBitcoinAddress(address).ToString());