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); toBigEndian(_val, ret);
return ret; return ret;
} }
inline bytes toCompactBigEndian(byte _val, unsigned _min = 0)
{
return (_min || _val) ? bytes{ _val } : bytes{};
}
/// Convenience function for toBigEndian. /// Convenience function for toBigEndian.
/// @returns a string just big enough to represent @a _val. /// @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;
using namespace dev::eth; using namespace dev::eth;
#if ALL_COMPILERS_ARE_CPP11_COMPLIANT #if _MSC_VER
#define ETH_RETURN_STRING(S) thread_local static string s_what; s_what = S; return s_what.c_str(); #define thread_local __declspec( thread )
#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();
#endif #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* 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* 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())); } 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()) if (m_jumpDests.empty())
for (unsigned i = 0; i < _ext.code.size(); ++i) for (unsigned i = 0; i < _ext.code.size(); ++i)
{
if (_ext.code[i] == (byte)Instruction::JUMPDEST) if (_ext.code[i] == (byte)Instruction::JUMPDEST)
m_jumpDests.insert(i); m_jumpDests.insert(i);
else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32) else if (_ext.code[i] >= (byte)Instruction::PUSH1 && _ext.code[i] <= (byte)Instruction::PUSH32)
i += _ext.code[i] - (unsigned)Instruction::PUSH1 + 1; i += _ext.code[i] - (unsigned)Instruction::PUSH1 + 1;
}
u256 nextPC = m_curPC + 1; u256 nextPC = m_curPC + 1;
auto osteps = _steps; auto osteps = _steps;
for (bool stopped = false; !stopped && _steps--; m_curPC = nextPC, nextPC = m_curPC + 1) for (bool stopped = false; !stopped && _steps--; m_curPC = nextPC, nextPC = m_curPC + 1)

Loading…
Cancel
Save