Skip to content

Commit

Permalink
Merge pull request monero-project#18 from stoffu/aeon-gcc8
Browse files Browse the repository at this point in the history
Build fix for GCC 8
  • Loading branch information
aeonix authored May 31, 2018
2 parents e3a5694 + 38304c9 commit 9179811
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions external/rapidjson/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,12 @@ class GenericValue {
if (count) {
GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
SetElementsPointer(e);
RAPIDJSON_DIAG_PUSH
#if defined(__GNUC__) && __GNUC__ >= 8
RAPIDJSON_DIAG_OFF(class-memaccess) // ignore complains from gcc that no trivial copy constructor exists.
#endif
std::memcpy(e, values, count * sizeof(GenericValue));
RAPIDJSON_DIAG_POP
}
else
SetElementsPointer(0);
Expand All @@ -1949,7 +1954,12 @@ class GenericValue {
if (count) {
Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
SetMembersPointer(m);
RAPIDJSON_DIAG_PUSH
#if defined(__GNUC__) && __GNUC__ >= 8
RAPIDJSON_DIAG_OFF(class-memaccess) // ignore complains from gcc that no trivial copy constructor exists.
#endif
std::memcpy(m, members, count * sizeof(Member));
RAPIDJSON_DIAG_POP
}
else
SetMembersPointer(0);
Expand Down
4 changes: 2 additions & 2 deletions src/crypto/chacha.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ namespace crypto {
static_assert(sizeof(chacha_key) <= sizeof(hash), "Size of hash must be at least that of chacha_key");
tools::scrubbed_arr<char, HASH_SIZE> pwd_hash;
crypto::cn_slow_hash(data, size, pwd_hash.data(), 0/*light*/, 0/*variant*/, 0/*prehashed*/);
memcpy(&key, pwd_hash.data(), sizeof(key));
memcpy(&unwrap(key), pwd_hash.data(), sizeof(key));
}

inline void generate_chacha_key_prehashed(const void *data, size_t size, chacha_key& key) {
static_assert(sizeof(chacha_key) <= sizeof(hash), "Size of hash must be at least that of chacha_key");
tools::scrubbed_arr<char, HASH_SIZE> pwd_hash;
crypto::cn_slow_hash(data, size, pwd_hash.data(), 0/*light*/, 0/*variant*/, 1/*prehashed*/);
memcpy(&key, pwd_hash.data(), sizeof(key));
memcpy(&unwrap(key), pwd_hash.data(), sizeof(key));
}

inline void generate_chacha_key(std::string password, chacha_key& key) {
Expand Down
2 changes: 1 addition & 1 deletion src/cryptonote_basic/account.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ DISABLE_VS_WARNINGS(4244 4345)
void account_base::create_from_viewkey(const cryptonote::account_public_address& address, const crypto::secret_key& viewkey)
{
crypto::secret_key fake;
memset(&fake, 0, sizeof(fake));
memset(&unwrap(fake), 0, sizeof(fake));
create_from_keys(address, fake, viewkey);
}
//-----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/daemon/rpc_command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ bool t_rpc_command_executor::print_transaction_pool_stats() {
}
else
{
memset(&res.pool_stats, 0, sizeof(res.pool_stats));
res.pool_stats = {};
if (!m_rpc_server->on_get_transaction_pool_stats(req, res, false) || res.status != CORE_RPC_STATUS_OK)
{
tools::fail_msg_writer() << make_error(fail_message, res.status);
Expand Down
2 changes: 2 additions & 0 deletions src/rpc/core_rpc_server_commands_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1554,6 +1554,8 @@ namespace cryptonote
std::vector<txpool_histo> histo;
uint32_t num_double_spends;

txpool_stats(): bytes_total(0), bytes_min(0), bytes_max(0), bytes_med(0), fee_total(0), oldest(0), txs_total(0), num_failing(0), num_10m(0), num_not_relayed(0), histo_98pc(0), num_double_spends(0) {}

BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(bytes_total)
KV_SERIALIZE(bytes_min)
Expand Down

0 comments on commit 9179811

Please sign in to comment.