diff --git a/dap_chain.c b/dap_chain.c index d3fa2cfc5b7069e51f0ba7803aab4f9d767dd7fc..d0956e3c4c689510ec679ea929572e16c46d2716 100644 --- a/dap_chain.c +++ b/dap_chain.c @@ -139,24 +139,21 @@ void dap_chain_save(dap_chain_t * a_chain) void dap_chain_file_write(dap_chain_block_cache_t *l_block_cache){ if (dap_chain_hash_kind_check(&l_block_cache->block_hash, l_block_cache->block->header.difficulty)==HASH_GOLD){ - fwrite(l_block_cache->block->header.size, 64, 1, my_file_to_wite_gold); - fwrite(l_block_cache->block, l_block_cache->block->header.size, 1, my_file_to_wite_gold); + fwrite(l_block_cache->block, l_block_cache->block->header.size+sizeof(l_block_cache->block->header), 1, my_file_to_wite_gold); blocks_mined_gold += 1; /*gold_mem=mmap(0, l_block_cache->block->header.size, PROT_WRITE, MAP_SHARED, my_file_to_wite_gold, 0); memcpy(gold_mem, l_block_cache, l_block_cache->block->header.size); munmap(gold_mem, l_block_cache->block->header.size);*/ } - else if (dap_chain_hash_kind_check(l_block_cache, l_block_cache->block->header.difficulty)==HASH_SILVER){ - fwrite(l_block_cache->block->header.size, 64, 1, my_file_to_wite_silver); - fwrite(l_block_cache->block, l_block_cache->block->header.size, 1, my_file_to_wite_silver); + else if (dap_chain_hash_kind_check(&l_block_cache->block_hash, l_block_cache->block->header.difficulty)==HASH_SILVER){ + fwrite(l_block_cache->block, l_block_cache->block->header.size+sizeof(l_block_cache->block->header), 1, my_file_to_wite_silver); blocks_mined_silver += 1; /*silver_mem=mmap(0, l_block_cache->block->header.size, PROT_WRITE, MAP_SHARED, my_file_to_wite_silver, 0); memcpy(silver_mem, l_block_cache, l_block_cache->block->header.size); munmap(silver_mem, l_block_cache->block->header.size);*/ } else { - fwrite(l_block_cache->block->header.size, 64, 1, my_file_to_wite_copper); - fwrite(l_block_cache->block, l_block_cache->block->header.size, 1, my_file_to_wite_copper); + fwrite(l_block_cache->block, l_block_cache->block->header.size+sizeof(l_block_cache->block->header), 1, my_file_to_wite_copper); blocks_mined_copper += 1; /*copper_mem=mmap(0, l_block_cache->block->header.size, PROT_WRITE, MAP_SHARED, my_file_to_wite_copper, 0); memcpy(copper_mem, l_block_cache, l_block_cache->block->header.size); @@ -187,17 +184,15 @@ void dap_chain_file_open(dap_chain_block_cache_t* last_g, dap_chain_block_cache_ } else { - - result =fread(size_of_gold, 64, 1, my_file_to_wite_gold); - result = fread(l_block_gold, size_of_gold, 1, my_file_to_wite_gold); +/* result = fread(l_block_gold, size_of_gold, 1, my_file_to_wite_gold); while ((l_block_gold->block!=0)&&result!=0){ - result = fread(size_of_gold, 64, 1, my_file_to_wite_gold); + result = fread(my_file_to_wite_gold,size_of_gold, 64, 1, my_file_to_wite_gold); if (result!=0){ - result = fread(l_block_gold, size_of_gold, 1, my_file_to_wite_gold); + result = fread(my_file_to_wite_gold,l_block_gold, size_of_gold, 1, my_file_to_wite_gold); } } last_g =l_block_gold; - //l_block_gold = + //l_block_gold =*/ } diff --git a/monero_crypto/chacha8.c b/monero_crypto/chacha8.c index df135af5947bbfa33c6c8b8153d921464d7695fc..082c107e23073963a8033dca1437a3b146a8c827 100644 --- a/monero_crypto/chacha8.c +++ b/monero_crypto/chacha8.c @@ -38,7 +38,7 @@ Public domain. static const char sigma[] = "expand 32-byte k"; -DISABLE_GCC_AND_CLANG_WARNING(strict-aliasing) +//DISABLE_GCC_AND_CLANG_WARNING(strict-aliasing) void chacha8(const void* data, size_t length, const uint8_t* key, const uint8_t* iv, char* cipher) { uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; diff --git a/monero_crypto/warnings.h b/monero_crypto/warnings.h index 196434db1385cee7e1844f4eb1c270f507c19263..cc59b6b25e707b5cc129b57e64ca755a2aed6fca 100644 --- a/monero_crypto/warnings.h +++ b/monero_crypto/warnings.h @@ -12,7 +12,7 @@ #else -#include <boost/preprocessor/stringize.hpp> +//#include <boost/preprocessor/stringize.hpp> #define PUSH_WARNINGS _Pragma("GCC diagnostic push") #define POP_WARNINGS _Pragma("GCC diagnostic pop") @@ -26,7 +26,7 @@ #define DISABLE_CLANG_WARNING(w) #endif -#define DISABLE_GCC_AND_CLANG_WARNING(w) _Pragma(BOOST_PP_STRINGIZE(GCC diagnostic ignored BOOST_PP_STRINGIZE(-W##w))) +//#define DISABLE_GCC_AND_CLANG_WARNING(w) _Pragma(BOOST_PP_STRINGIZE(GCC diagnostic ignored BOOST_PP_STRINGIZE(-W##w))) #endif