Browse Source

even more

cl-refactor
CJentzsch 10 years ago
parent
commit
beb352549c
  1. 20
      ethminer/MinerAux.h
  2. 4
      libethcore/BlockInfo.cpp
  3. 16
      libethcore/ICAP.cpp

20
ethminer/MinerAux.h

@ -107,7 +107,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION(BadArgument());
} }
else if (arg == "--opencl-platform" && i + 1 < argc) else if (arg == "--opencl-platform" && i + 1 < argc)
try { try {
@ -116,7 +116,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION(BadArgument());
} }
else if (arg == "--opencl-device" && i + 1 < argc) else if (arg == "--opencl-device" && i + 1 < argc)
try { try {
@ -126,7 +126,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION(BadArgument());
} }
else if (arg == "--list-devices") else if (arg == "--list-devices")
m_shouldListDevices = true; m_shouldListDevices = true;
@ -144,7 +144,7 @@ public:
else else
{ {
cerr << "Bad " << arg << " option: " << m << endl; cerr << "Bad " << arg << " option: " << m << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION(BadArgument());
} }
} }
else if (arg == "--benchmark-warmup" && i + 1 < argc) else if (arg == "--benchmark-warmup" && i + 1 < argc)
@ -154,7 +154,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION(BadArgument());
} }
else if (arg == "--benchmark-trial" && i + 1 < argc) else if (arg == "--benchmark-trial" && i + 1 < argc)
try { try {
@ -163,7 +163,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION( BadArgument());
} }
else if (arg == "--benchmark-trials" && i + 1 < argc) else if (arg == "--benchmark-trials" && i + 1 < argc)
try { try {
@ -172,7 +172,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION( BadArgument());
} }
else if (arg == "-C" || arg == "--cpu") else if (arg == "-C" || arg == "--cpu")
m_minerType = MinerType::CPU; m_minerType = MinerType::CPU;
@ -195,7 +195,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << m << endl; cerr << "Bad " << arg << " option: " << m << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION( BadArgument());
} }
} }
else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc) else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc)
@ -232,7 +232,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << m << endl; cerr << "Bad " << arg << " option: " << m << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION( BadArgument());
} }
} }
else if (arg == "-M" || arg == "--benchmark") else if (arg == "-M" || arg == "--benchmark")
@ -245,7 +245,7 @@ public:
catch (...) catch (...)
{ {
cerr << "Bad " << arg << " option: " << argv[i] << endl; cerr << "Bad " << arg << " option: " << argv[i] << endl;
throw BadArgument(); BOOST_THROW_EXCEPTION( BadArgument());
} }
} }
else else

4
libethcore/BlockInfo.cpp

@ -122,7 +122,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const
try try
{ {
if (_header.itemCount() != 15) if (_header.itemCount() != 15)
throw InvalidBlockHeaderItemCount(); BOOST_THROW_EXCEPTION(InvalidBlockHeaderItemCount());
parentHash = _header[field = 0].toHash<h256>(RLP::VeryStrict); parentHash = _header[field = 0].toHash<h256>(RLP::VeryStrict);
sha3Uncles = _header[field = 1].toHash<h256>(RLP::VeryStrict); sha3Uncles = _header[field = 1].toHash<h256>(RLP::VeryStrict);
coinbaseAddress = _header[field = 2].toHash<Address>(RLP::VeryStrict); coinbaseAddress = _header[field = 2].toHash<Address>(RLP::VeryStrict);
@ -146,7 +146,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const
} }
if (number > ~(unsigned)0) if (number > ~(unsigned)0)
throw InvalidNumber(); BOOST_THROW_EXCEPTION(InvalidNumber());
// check it hashes according to proof of work or that it's the genesis block. // check it hashes according to proof of work or that it's the genesis block.
if (_s == CheckEverything && parentHash && !ProofOfWork::verify(*this)) if (_s == CheckEverything && parentHash && !ProofOfWork::verify(*this))

16
libethcore/ICAP.cpp

@ -71,7 +71,7 @@ ICAP ICAP::decoded(std::string const& _encoded)
std::string data; std::string data;
std::tie(country, data) = fromIBAN(_encoded); std::tie(country, data) = fromIBAN(_encoded);
if (country != "XE") if (country != "XE")
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
if (data.size() == 30) if (data.size() == 30)
{ {
ret.m_type = Direct; ret.m_type = Direct;
@ -88,10 +88,10 @@ ICAP ICAP::decoded(std::string const& _encoded)
ret.m_client = data.substr(7); ret.m_client = data.substr(7);
} }
else else
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
} }
else else
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
return ret; return ret;
} }
@ -101,7 +101,7 @@ std::string ICAP::encoded() const
if (m_type == Direct) if (m_type == Direct)
{ {
if (!!m_direct[0]) if (!!m_direct[0])
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
std::string d = toBase36<Address::size>(m_direct); std::string d = toBase36<Address::size>(m_direct);
while (d.size() < 30) while (d.size() < 30)
d = "0" + d; d = "0" + d;
@ -118,11 +118,11 @@ std::string ICAP::encoded() const
m_institution.size() != 4 || m_institution.size() != 4 ||
m_client.size() != 9 m_client.size() != 9
) )
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
return iban("XE", m_asset + m_institution + m_client); return iban("XE", m_asset + m_institution + m_client);
} }
else else
throw InvalidICAP(); BOOST_THROW_EXCEPTION(InvalidICAP());
} }
pair<Address, bytes> ICAP::lookup(std::function<bytes(Address, bytes)> const& _call, Address const& _reg) const pair<Address, bytes> ICAP::lookup(std::function<bytes(Address, bytes)> const& _call, Address const& _reg) const
@ -149,9 +149,9 @@ pair<Address, bytes> ICAP::lookup(std::function<bytes(Address, bytes)> const& _c
else if (m_institution[0] != 'X') else if (m_institution[0] != 'X')
return make_pair(resolve(m_institution + "/" + m_client), bytes()); return make_pair(resolve(m_institution + "/" + m_client), bytes());
else else
throw InterfaceNotSupported("ICAP::lookup(), bad institution"); BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad institution"));
} }
throw InterfaceNotSupported("ICAP::lookup(), bad asset"); BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad asset"));
} }
} }

Loading…
Cancel
Save