diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 39bc0ad43..9ee3f36e3 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1629,7 +1629,7 @@ void Main::on_net_triggered() { web3()->setIdealPeerCount(ui->idealPeers->value()); web3()->setNetworkPreferences(netPrefs()); - ethereum()->setNetworkId(m_privateChain.size() ? sha3(m_privateChain.toStdString()) : 0); + ethereum()->setNetworkId(m_privateChain.size() ? sha3(m_privateChain.toStdString()) : h256()); // TODO: p2p // if (m_networkConfig.size()/* && ui->usePast->isChecked()*/) // web3()->restoreNetwork(bytesConstRef((byte*)m_networkConfig.data(), m_networkConfig.size())); diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 561f2f405..2b4e6bc08 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -80,7 +80,7 @@ public: operator Arith() const { return fromBigEndian(m_data); } /// @returns true iff this is the empty hash. - operator bool() const { return ((Arith)*this) != 0; } + explicit operator bool() const { return ((Arith)*this) != 0; } // The obvious comparison operators. bool operator==(FixedHash const& _c) const { return m_data == _c.m_data; } diff --git a/libdevcrypto/CryptoPP.cpp b/libdevcrypto/CryptoPP.cpp index 2d0170fb9..43993e0c5 100644 --- a/libdevcrypto/CryptoPP.cpp +++ b/libdevcrypto/CryptoPP.cpp @@ -134,7 +134,7 @@ bool Secp256k1::verify(Signature const& _signature, bytesConstRef _message) bool Secp256k1::verify(Public const& _p, Signature const& _sig, bytesConstRef _message, bool _hashed) { // todo: verify w/o recovery (if faster) - return _p == _hashed ? recover(_sig, _message) : recover(_sig, sha3(_message).ref()); + return (bool)_p == _hashed ? (bool)recover(_sig, _message) : (bool)recover(_sig, sha3(_message).ref()); } Public Secp256k1::recover(Signature _signature, bytesConstRef _message) diff --git a/libethcore/ProofOfWork.h b/libethcore/ProofOfWork.h index 64ce502af..c3c3f192b 100644 --- a/libethcore/ProofOfWork.h +++ b/libethcore/ProofOfWork.h @@ -82,7 +82,7 @@ template std::pair ProofOfWorkEngine::mine(h256 const& _root, u256 const& _difficulty, unsigned _msTimeout, bool _continue, bool _turbo) { std::pair ret; - static std::mt19937_64 s_eng((time(0) + (unsigned)m_last)); + static std::mt19937_64 s_eng((time(0) + *reinterpret_cast(m_last.data()))); u256 s = (m_last = h256::random(s_eng)); bigint d = (bigint(1) << 256) / _difficulty; diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index c732f2dc1..dfa928675 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -94,7 +94,7 @@ private: h256Set neededBlocks(h256Set const& _exclude); /// Check to see if the network peer-state initialisation has happened. - bool isInitialised() const { return m_latestBlockSent; } + bool isInitialised() const { return (bool)m_latestBlockSent; } /// Initialises the network peer-state, doing the stuff that needs to be once-only. @returns true if it really was first. bool ensureInitialised(); diff --git a/libethereum/Transaction.h b/libethereum/Transaction.h index 0f88a4bc0..a9044970f 100644 --- a/libethereum/Transaction.h +++ b/libethereum/Transaction.h @@ -81,7 +81,7 @@ public: Address safeSender() const noexcept; /// @returns true if transaction is non-null. - operator bool() const { return m_type != NullTransaction; } + explicit operator bool() const { return m_type != NullTransaction; } /// @returns true if transaction is contract-creation. bool isCreation() const { return m_type == ContractCreation; } diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index c304e3c03..dbf3b2ec9 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -704,7 +704,7 @@ std::string WebThreeStubServerBase::eth_transact(Json::Value const& _json) if (!t.from) t.from = m_accounts->getDefaultTransactAccount(); if (t.creation) - ret = right160(sha3(rlpList(t.from, client()->countAt(t.from))));; + ret = toJS(right160(sha3(rlpList(t.from, client()->countAt(t.from)))));; if (!t.gasPrice) t.gasPrice = 10 * dev::eth::szabo; if (!t.gas) diff --git a/libwhisper/Common.cpp b/libwhisper/Common.cpp index f17ad638b..c29ac6bf6 100644 --- a/libwhisper/Common.cpp +++ b/libwhisper/Common.cpp @@ -71,7 +71,7 @@ bool TopicFilter::matches(Envelope const& _e) const for (unsigned i = 0; i < t.size(); ++i) { for (auto et: _e.topic()) - if (((t[i].first ^ et) & t[i].second) == 0) + if (((t[i].first ^ et) & t[i].second) == CollapsedTopicPart()) goto NEXT_TOPICPART; // failed to match topicmask against any topics: move on to next mask goto NEXT_TOPICMASK; diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index 45198c114..110bdc141 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -370,7 +370,7 @@ void ClientModel::onNewTransaction() QString function; QString returned; - bool creation = tr.contractAddress != 0; + bool creation = (bool)tr.contractAddress; //TODO: handle value transfer FixedHash<4> functionHash; @@ -403,7 +403,7 @@ void ClientModel::onNewTransaction() if (creation) returned = QString::fromStdString(toJS(tr.contractAddress)); - Address contractAddress = tr.address != 0 ? tr.address : tr.contractAddress; + Address contractAddress = (bool)tr.address ? tr.address : tr.contractAddress; auto contractAddressIter = m_contractNames.find(contractAddress); if (contractAddressIter != m_contractNames.end()) {