diff --git a/ethash.h b/ethash.h index 22fe85e89..99a83fc3a 100644 --- a/ethash.h +++ b/ethash.h @@ -87,11 +87,11 @@ typedef struct ethash_return_value { ethash_h256_t mix_hash; } ethash_return_value; -uint64_t ethash_get_datasize(const uint32_t block_number); -uint64_t ethash_get_cachesize(const uint32_t block_number); +uint64_t ethash_get_datasize(uint32_t const block_number); +uint64_t ethash_get_cachesize(uint32_t const block_number); // initialize the parameters -static inline void ethash_params_init(ethash_params* params, const uint32_t block_number) +static inline void ethash_params_init(ethash_params* params, uint32_t const block_number) { params->full_size = ethash_get_datasize(block_number); params->cache_size = ethash_get_cachesize(block_number); @@ -99,7 +99,7 @@ static inline void ethash_params_init(ethash_params* params, const uint32_t bloc // LTODO: for consistency's sake maybe use ethash_cache_t? typedef struct ethash_cache { - void *mem; + void* mem; } ethash_cache; /** @@ -151,7 +151,7 @@ bool ethash_light_compute( ethash_light_t light, ethash_params const* params, const ethash_h256_t* header_hash, - const uint64_t nonce + uint64_t const nonce ); /** * Get a pointer to the cache object held by the light client @@ -216,8 +216,8 @@ bool ethash_full_compute( ethash_return_value* ret, ethash_full_t full, ethash_params const* params, - const ethash_h256_t* header_hash, - const uint64_t nonce + ethash_h256_t const* header_hash, + uint64_t const nonce ); /** * Get a pointer to the cache object held by the full client @@ -256,7 +256,7 @@ static inline int ethash_check_difficulty( int ethash_quick_check_difficulty( ethash_h256_t const* header_hash, - const uint64_t nonce, + uint64_t const nonce, ethash_h256_t const* mix_hash, ethash_h256_t const* difficulty ); @@ -276,14 +276,14 @@ void ethash_full( void const* full_mem, ethash_params const* params, ethash_h256_t const* header_hash, - const uint64_t nonce + uint64_t const nonce ); void ethash_light( ethash_return_value* ret, ethash_cache const* cache, ethash_params const* params, ethash_h256_t const* header_hash, - const uint64_t nonce + uint64_t const nonce ); /** * Compute the memory data for a full node's memory diff --git a/internal.c b/internal.c index 3c110ec66..4e4f2c6d2 100644 --- a/internal.c +++ b/internal.c @@ -41,13 +41,13 @@ #include "sha3.h" #endif // WITH_CRYPTOPP -uint64_t ethash_get_datasize(const uint32_t block_number) +uint64_t ethash_get_datasize(uint32_t const block_number) { assert(block_number / EPOCH_LENGTH < 2048); return dag_sizes[block_number / EPOCH_LENGTH]; } -uint64_t ethash_get_cachesize(const uint32_t block_number) +uint64_t ethash_get_cachesize(uint32_t const block_number) { assert(block_number / EPOCH_LENGTH < 2048); return cache_sizes[block_number / EPOCH_LENGTH]; @@ -198,7 +198,7 @@ static bool ethash_hash( ethash_cache const* cache, ethash_params const* params, ethash_h256_t const* header_hash, - const uint64_t nonce, + uint64_t const nonce, ethash_callback_t callback ) { @@ -286,7 +286,7 @@ static bool ethash_hash( void ethash_quick_hash( ethash_h256_t* return_hash, ethash_h256_t const* header_hash, - const uint64_t nonce, + uint64_t const nonce, ethash_h256_t const* mix_hash ) { @@ -309,7 +309,7 @@ void ethash_get_seedhash(ethash_h256_t* seedhash, const uint32_t block_number) int ethash_quick_check_difficulty( ethash_h256_t const* header_hash, - const uint64_t nonce, + uint64_t const nonce, ethash_h256_t const* mix_hash, ethash_h256_t const* difficulty ) @@ -351,7 +351,7 @@ bool ethash_light_compute( ethash_light_t light, ethash_params const* params, const ethash_h256_t* header_hash, - const uint64_t nonce + uint64_t const nonce ) { return ethash_hash(ret, NULL, light->cache, params, header_hash, nonce, NULL); @@ -449,8 +449,8 @@ bool ethash_full_compute( ethash_return_value* ret, ethash_full_t full, ethash_params const* params, - const ethash_h256_t* header_hash, - const uint64_t nonce + ethash_h256_t const* header_hash, + uint64_t const nonce ) { return ethash_hash(ret, @@ -496,7 +496,7 @@ void ethash_full( void const* full_mem, ethash_params const* params, ethash_h256_t const* header_hash, - const uint64_t nonce + uint64_t const nonce ) { ethash_hash(ret, (node const *) full_mem, NULL, params, header_hash, nonce, NULL); @@ -506,7 +506,7 @@ void ethash_light( ethash_cache const* cache, ethash_params const* params, ethash_h256_t const* header_hash, - const uint64_t nonce + uint64_t const nonce ) { ethash_hash(ret, NULL, cache, params, header_hash, nonce, NULL); diff --git a/io.h b/io.h index 5c42d18b8..609c2769e 100644 --- a/io.h +++ b/io.h @@ -90,7 +90,7 @@ enum ethash_io_rc ethash_io_prepare( * @param mode Opening mode. Check fopen() * @return The FILE* or NULL in failure */ -FILE* ethash_fopen(const char* file_name, const char* mode); +FILE* ethash_fopen(char const* file_name, char const* mode); /** * An strncat wrapper for no-warnings crossplatform strncat. @@ -108,7 +108,7 @@ FILE* ethash_fopen(const char* file_name, const char* mode); * @return If all is well returns the dest buffer. If there is an * error returns NULL */ -char* ethash_strncat(char* dest, size_t dest_size, const char* src, size_t count); +char* ethash_strncat(char* dest, size_t dest_size, char const* src, size_t count); /** * A cross-platform mkdir wrapper to create a directory or assert it's there diff --git a/io_posix.c b/io_posix.c index 10a5c3f59..5783ec272 100644 --- a/io_posix.c +++ b/io_posix.c @@ -27,12 +27,12 @@ #include #include -FILE* ethash_fopen(const char* file_name, const char* mode) +FILE* ethash_fopen(char const* file_name, char const* mode) { return fopen(file_name, mode); } -char* ethash_strncat(char* dest, size_t dest_size, const char* src, size_t count) +char* ethash_strncat(char* dest, size_t dest_size, char const* src, size_t count) { return strlen(dest) + count + 1 <= dest_size ? strncat(dest, src, count) : NULL; } diff --git a/io_win32.c b/io_win32.c index 6181538aa..505f11e2b 100644 --- a/io_win32.c +++ b/io_win32.c @@ -26,13 +26,13 @@ #include #include -FILE* ethash_fopen(const char* file_name, const char* mode) +FILE* ethash_fopen(char const* file_name, char const* mode) { FILE* f; return fopen_s(&f, file_name, mode) == 0 ? f : NULL; } -char* ethash_strncat(char* dest, size_t dest_size, const char* src, size_t count) +char* ethash_strncat(char* dest, size_t dest_size, char const* src, size_t count) { return strncat_s(dest, dest_size, src, count) == 0 ? dest : NULL; }