Browse Source

Windows warning fixes.

Mac build fixes.
cl-refactor
Gav Wood 10 years ago
parent
commit
609d650182
  1. 2
      eth/main.cpp
  2. 4
      libdevcore/CommonData.h
  3. 4
      libethash/ethash.h
  4. 6
      libethash/io.c
  5. 4
      libethcore/Ethash.cpp
  6. 2
      mix/ContractCallDataEncoder.cpp

2
eth/main.cpp

@ -364,7 +364,7 @@ int main(int argc, char** argv)
{ {
coinbase = h160(fromHex(argv[++i], WhenError::Throw)); coinbase = h160(fromHex(argv[++i], WhenError::Throw));
} }
catch (BadHexCharacter& _e) catch (BadHexCharacter&)
{ {
cerr << "Bad hex in " << arg << " option: " << argv[i] << endl; cerr << "Bad hex in " << arg << " option: " << argv[i] << endl;
return -1; return -1;

4
libdevcore/CommonData.h

@ -116,9 +116,9 @@ inline void toBigEndian(_T _val, _Out& o_out)
template <class _T, class _In> template <class _T, class _In>
inline _T fromBigEndian(_In const& _bytes) inline _T fromBigEndian(_In const& _bytes)
{ {
_T ret = 0; _T ret = (_T)0;
for (auto i: _bytes) for (auto i: _bytes)
ret = (ret << 8) | (byte)(typename std::make_unsigned<typename _In::value_type>::type)i; ret = (_T)((ret << 8) | (byte)(typename std::make_unsigned<typename _In::value_type>::type)i);
return ret; return ret;
} }

4
libethash/ethash.h

@ -85,7 +85,7 @@ typedef uint8_t const ethash_seedhash_t[32];
typedef void const* ethash_light_t; typedef void const* ethash_light_t;
static inline ethash_light_t ethash_new_light(ethash_params const* params, ethash_seedhash_t seed) { static inline ethash_light_t ethash_new_light(ethash_params const* params, ethash_seedhash_t seed) {
void* ret = malloc(params->cache_size); void* ret = malloc((size_t)params->cache_size);
ethash_mkcache(ret, params, seed); ethash_mkcache(ret, params, seed);
return ret; return ret;
} }
@ -98,7 +98,7 @@ static inline void ethash_delete_light(ethash_light_t light) {
typedef void const* ethash_full_t; typedef void const* ethash_full_t;
static inline ethash_full_t ethash_new_full(ethash_params const* params, ethash_light_t light) { static inline ethash_full_t ethash_new_full(ethash_params const* params, ethash_light_t light) {
void* ret = malloc(params->full_size); void* ret = malloc((size_t)params->full_size);
ethash_compute_full_data(ret, params, light); ethash_compute_full_data(ret, params, light);
return ret; return ret;
} }

6
libethash/io.c

@ -61,13 +61,13 @@ bool ethash_io_write(char const *dirname,
{ {
char info_buffer[DAG_MEMO_BYTESIZE]; char info_buffer[DAG_MEMO_BYTESIZE];
// allocate the bytes // allocate the bytes
uint8_t *temp_data_ptr = malloc(params->full_size); uint8_t *temp_data_ptr = malloc((size_t)params->full_size);
if (!temp_data_ptr) { if (!temp_data_ptr) {
goto end; goto end;
} }
ethash_compute_full_data(temp_data_ptr, params, cache); ethash_compute_full_data(temp_data_ptr, params, cache);
if (!ethash_io_write_file(dirname, PASS_ARR(DAG_FILE_NAME), temp_data_ptr, params->full_size)) { if (!ethash_io_write_file(dirname, PASS_ARR(DAG_FILE_NAME), temp_data_ptr, (size_t)params->full_size)) {
goto fail_free; goto fail_free;
} }
@ -77,7 +77,7 @@ bool ethash_io_write(char const *dirname,
} }
*data = temp_data_ptr; *data = temp_data_ptr;
*data_size = params->full_size; *data_size = (size_t)params->full_size;
return true; return true;
fail_free: fail_free:

4
libethcore/Ethash.cpp

@ -48,7 +48,7 @@ namespace dev
namespace eth namespace eth
{ {
const Ethash::WorkPackage Ethash::NullWorkPackage; const Ethash::WorkPackage Ethash::NullWorkPackage = Ethash::WorkPackage();
std::string Ethash::name() std::string Ethash::name()
{ {
@ -81,7 +81,7 @@ bool Ethash::preVerify(BlockInfo const& _header)
h256 boundary = u256((bigint(1) << 256) / _header.difficulty); h256 boundary = u256((bigint(1) << 256) / _header.difficulty);
return ethash_quick_check_difficulty( return !!ethash_quick_check_difficulty(
_header.headerHash(WithoutNonce).data(), _header.headerHash(WithoutNonce).data(),
(uint64_t)(u64)_header.nonce, (uint64_t)(u64)_header.nonce,
_header.mixHash.data(), _header.mixHash.data(),

2
mix/ContractCallDataEncoder.cpp

@ -118,7 +118,7 @@ unsigned ContractCallDataEncoder::encodeSingleItem(QString const& _data, Solidit
result = bytes(alignSize); result = bytes(alignSize);
toBigEndian((u256)i, result); toBigEndian((u256)i, result);
} }
catch (std::exception const& ex) catch (std::exception const&)
{ {
// manage input as a string. // manage input as a string.
QByteArray bytesAr = src.toLocal8Bit(); QByteArray bytesAr = src.toLocal8Bit();

Loading…
Cancel
Save