From 65683fd400f116a60b52865c837db2f915ea059a Mon Sep 17 00:00:00 2001 From: "Dmitriy A. Gerasimov" <dmitriy.gerasimov@demlabs.net> Date: Sat, 8 Sep 2018 15:46:34 +0700 Subject: [PATCH] [-] Removed boost macros [-] Particly cleaned up shit from Krasilnikov --- dap_chain.c | 21 ++++++++------------- monero_crypto/chacha8.c | 2 +- monero_crypto/warnings.h | 4 ++-- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/dap_chain.c b/dap_chain.c index d3fa2cf..d0956e3 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 df135af..082c107 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 196434d..cc59b6b 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 -- GitLab