Browse Source

Warnings fixes.

cl-refactor
Gav Wood 10 years ago
parent
commit
c572b713df
  1. 4
      libdevcore/CommonData.h
  2. 12
      libethcore/Exceptions.cpp
  3. 2
      libevm/VM.cpp

4
libdevcore/CommonData.h

@ -124,6 +124,10 @@ inline bytes toCompactBigEndian(_T _val, unsigned _min = 0)
toBigEndian(_val, ret);
return ret;
}
inline bytes toCompactBigEndian(byte _val, unsigned _min = 0)
{
return (_min || _val) ? bytes{ _val } : bytes{};
}
/// Convenience function for toBigEndian.
/// @returns a string just big enough to represent @a _val.

12
libethcore/Exceptions.cpp

@ -27,16 +27,12 @@ using namespace std;
using namespace dev;
using namespace dev::eth;
#if ALL_COMPILERS_ARE_CPP11_COMPLIANT
#define ETH_RETURN_STRING(S) thread_local static string s_what; s_what = S; return s_what.c_str();
#else
#define ETH_RETURN_STRING(S) \
static boost::thread_specific_ptr<string> s_what; \
if (!s_what.get()) \
s_what.reset(new string); \
*s_what = S; return s_what->c_str();
#if _MSC_VER
#define thread_local __declspec( thread )
#endif
#define ETH_RETURN_STRING(S) thread_local static string s_what; s_what = S; return s_what.c_str();
const char* InvalidBlockFormat::what() const noexcept { ETH_RETURN_STRING("Invalid block format: Bad field " + toString(m_f) + " (" + toHex(m_d) + ")"); }
const char* UncleInChain::what() const noexcept { ETH_RETURN_STRING("Uncle in block already mentioned: Uncles " + toString(m_uncles) + " (" + m_block.abridged() + ")"); }
const char* InvalidTransactionsHash::what() const noexcept { ETH_RETURN_STRING("Invalid transactions hash: header says: " + toHex(m_head.ref()) + " block is:" + toHex(m_real.ref())); }

2
libevm/VM.cpp

@ -38,10 +38,12 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps)
if (m_jumpDests.empty())
for (unsigned i = 0; i < _ext.code.size(); ++i)
{
if (_ext.code[i] == (byte)Instruction::JUMPDEST)
m_jumpDests.insert(i);
else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32)
i += _ext.code[i] - (unsigned)Instruction::PUSH1 + 1;
}
u256 nextPC = m_curPC + 1;
auto osteps = _steps;
for (bool stopped = false; !stopped && _steps--; m_curPC = nextPC, nextPC = m_curPC + 1)

Loading…
Cancel
Save