Remove FixedHash(unsigned) constructor

This commit is contained in:
Alex Beregszaszi 2019-12-14 13:38:44 +00:00
parent 3d4a2219a6
commit 3c88d295b3
3 changed files with 2 additions and 5 deletions

View File

@ -63,9 +63,6 @@ public:
/// Convert from the corresponding arithmetic type.
FixedHash(Arith const& _arith) { toBigEndian(_arith, m_data); }
/// Convert from unsigned
explicit FixedHash(unsigned _u) { toBigEndian(_u, m_data); }
/// Explicitly construct, copying from a byte array.
explicit FixedHash(bytes const& _b, ConstructFromHashType _t = FailIfDifferent) { if (_b.size() == N) memcpy(m_data.data(), _b.data(), std::min<unsigned>(_b.size(), N)); else { m_data.fill(0); if (_t != FailIfDifferent) { auto c = std::min<unsigned>(_b.size(), N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _b[_t == AlignRight ? _b.size() - 1 - i : i]; } } }

View File

@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(reserve)
BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee + 1, encodeDyn(name[1])) == encodeArgs());
BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[1])) == encodeArgs(h256(account(0), h256::AlignRight)));
BOOST_REQUIRE(callContractFunctionWithValue("reserve(string)", m_fee - 1, encodeDyn(name[2])) == encodeArgs());
BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[2])) == encodeArgs(h256(0)));
BOOST_CHECK(callContractFunction("owner(string)", encodeDyn(name[2])) == encodeArgs(h256{}));
}
BOOST_AUTO_TEST_CASE(double_reserve)

View File

@ -60,7 +60,7 @@ void InterpreterState::dumpTraceAndState(ostream& _out) const
_out << " " << std::uppercase << std::hex << std::setw(4) << offset << ": " << h256(value).hex() << endl;
_out << "Storage dump:" << endl;
for (auto const& slot: storage)
if (slot.second != h256(0))
if (slot.second != h256{})
_out << " " << slot.first.hex() << ": " << slot.second.hex() << endl;
}