Browse Source

various fixes in the code for the msvc build to work

cl-refactor
Lefteris Karapetsas 10 years ago
parent
commit
90fe9cdc62
  1. 6
      io.c
  2. 4
      io.h

6
io.c

@ -57,17 +57,17 @@ bool ethash_io_write(char const *dirname,
ethash_blockhash_t seedhash, ethash_blockhash_t seedhash,
void const* cache, void const* cache,
uint8_t **data, uint8_t **data,
size_t *data_size) uint64_t *data_size)
{ {
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;
} }

4
io.h

@ -73,7 +73,7 @@ enum ethash_io_rc ethash_io_prepare(char const *dirname, ethash_blockhash_t seed
* data calculated by @see ethash_prep_full(). Memory * data calculated by @see ethash_prep_full(). Memory
* ownership is transfered to the callee. Remember that * ownership is transfered to the callee. Remember that
* you eventually need to free this with a call to free(). * you eventually need to free this with a call to free().
* @param[out] data_size Pass a size_t by value. If the function is succesfull * @param[out] data_size Pass a uint64_t by value. If the function is succesfull
* then this will contain the number of bytes allocated * then this will contain the number of bytes allocated
* for @a data. * for @a data.
* @return True for success and false in case of failure. * @return True for success and false in case of failure.
@ -83,7 +83,7 @@ bool ethash_io_write(char const *dirname,
ethash_blockhash_t seedhash, ethash_blockhash_t seedhash,
void const* cache, void const* cache,
uint8_t **data, uint8_t **data,
size_t *data_size); uint64_t *data_size);
static inline void ethash_io_serialize_info(uint32_t revision, static inline void ethash_io_serialize_info(uint32_t revision,
ethash_blockhash_t seed_hash, ethash_blockhash_t seed_hash,

Loading…
Cancel
Save