From fbf92cb78be8a023fec284e0e41117a96ff0def0 Mon Sep 17 00:00:00 2001 From: Aleksandr Vodianov <aleksandr.vodianov@demlabs.net> Date: Wed, 13 Oct 2021 17:16:57 +0000 Subject: [PATCH] Support 4917 --- cmake/OS_Detection.cmake | 7 +++++-- dap-sdk/crypto/src/dap_enc_ringct20.c | 3 +-- modules/chain/dap_chain_ledger.c | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/cmake/OS_Detection.cmake b/cmake/OS_Detection.cmake index 161a5b8fa6..610ea72b0a 100644 --- a/cmake/OS_Detection.cmake +++ b/cmake/OS_Detection.cmake @@ -45,6 +45,7 @@ message(STATUS "[*] Building for a ${ARCH_WIDTH}-bit system") if(UNIX) add_definitions ("-DDAP_OS_UNIX") if (APPLE) + EXECUTE_PROCESS( COMMAND whoami COMMAND tr -d '\n' OUTPUT_VARIABLE L_USER) EXECUTE_PROCESS( COMMAND echo -n /Users/${L_USER} OUTPUT_VARIABLE L_USERDIR_PATH) set (USERDIR_PATH "${L_USERDIR_PATH}") @@ -61,10 +62,12 @@ if(UNIX) OUTPUT_STRIP_TRAILING_WHITESPACE ) add_definitions("-DDAP_OS_MAC -DDAP_OS_MAC_ARCH=${MACOS_ARCH}") - endif() - if (${_CMAKE_OSX_SYSROOT_PATH} MATCHES "iOS") + elseif (${_CMAKE_OSX_SYSROOT_PATH} MATCHES "iOS") set(IOS ON) add_definitions("-DDAP_OS_IOS") + else() + set(MACOS ON) + add_definitions("-DDAP_OS_MAC -DDAP_OS_MAC_ARCH=${MACOS_ARCH}") endif() endif() diff --git a/dap-sdk/crypto/src/dap_enc_ringct20.c b/dap-sdk/crypto/src/dap_enc_ringct20.c index 047b7c9679..a0815efcd3 100644 --- a/dap-sdk/crypto/src/dap_enc_ringct20.c +++ b/dap-sdk/crypto/src/dap_enc_ringct20.c @@ -347,8 +347,7 @@ int ringct20_crypto_sign_open_with_pbkList(const unsigned char * msg, const unsi if(sig->sig_len < sizeof(DAP_RINGCT20_SIGN_SECURITY) + sizeof(wLenSig)) return -1; DAP_RINGCT20_SIGN_SECURITY sec_kind = *(DAP_RINGCT20_SIGN_SECURITY*)sig->sig_data; - wLenSig = *(typeof (&wLenSig))(sig->sig_data + sizeof(DAP_RINGCT20_SIGN_SECURITY)); - + wLenSig = *(int *)(sig->sig_data + sizeof(DAP_RINGCT20_SIGN_SECURITY)); if(wpbkList != 0 && wLenSig != wpbkList) { return -1; diff --git a/modules/chain/dap_chain_ledger.c b/modules/chain/dap_chain_ledger.c index 3db15516cf..94208cc05f 100644 --- a/modules/chain/dap_chain_ledger.c +++ b/modules/chain/dap_chain_ledger.c @@ -493,7 +493,7 @@ static int s_token_tsd_parse(dap_ledger_t * a_ledger, dap_chain_ledger_token_ite //Allowed tx receiver addres list add, remove or clear case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_ALLOWED_ADD:{ if( l_tsd->size == sizeof (dap_chain_addr_t) ){ - dap_chain_addr_t * l_addrs = a_token_item->tx_recv_allow? DAP_NEW_Z_SIZE( typeof (*a_token_item->tx_recv_allow), + dap_chain_addr_t * l_addrs = a_token_item->tx_recv_allow? DAP_NEW_Z_SIZE( dap_chain_addr_t, sizeof(*a_token_item->tx_recv_allow) ) : DAP_REALLOC(a_token_item->tx_recv_allow,(a_token_item->tx_recv_allow_size+1)*sizeof (*a_token_item->tx_recv_allow) ); @@ -585,7 +585,7 @@ static int s_token_tsd_parse(dap_ledger_t * a_ledger, dap_chain_ledger_token_ite //Blocked tx receiver addres list add, remove or clear case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_RECEIVER_BLOCKED_ADD:{ if( l_tsd->size == sizeof (dap_chain_addr_t) ){ - dap_chain_addr_t * l_addrs = a_token_item->tx_recv_block? DAP_NEW_Z_SIZE( typeof (*a_token_item->tx_recv_block), + dap_chain_addr_t * l_addrs = a_token_item->tx_recv_block? DAP_NEW_Z_SIZE( dap_chain_addr_t, sizeof(*a_token_item->tx_recv_block) ) : DAP_REALLOC(a_token_item->tx_recv_block,(a_token_item->tx_recv_block_size+1)*sizeof (*a_token_item->tx_recv_block) ); // Check if its correct @@ -674,7 +674,7 @@ static int s_token_tsd_parse(dap_ledger_t * a_ledger, dap_chain_ledger_token_ite //Allowed tx sender addres list add, remove or clear case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_ALLOWED_ADD:{ if( l_tsd->size == sizeof (dap_chain_addr_t) ){ - dap_chain_addr_t * l_addrs = a_token_item->tx_send_allow? DAP_NEW_Z_SIZE( typeof (*a_token_item->tx_send_allow), + dap_chain_addr_t * l_addrs = a_token_item->tx_send_allow ? DAP_NEW_Z_SIZE( dap_chain_addr_t, sizeof(*a_token_item->tx_send_allow) ) : DAP_REALLOC(a_token_item->tx_send_allow,(a_token_item->tx_send_allow_size+1)*sizeof (*a_token_item->tx_send_allow) ); // Check if its correct @@ -761,7 +761,7 @@ static int s_token_tsd_parse(dap_ledger_t * a_ledger, dap_chain_ledger_token_ite //Blocked tx sender addres list add, remove or clear case DAP_CHAIN_DATUM_TOKEN_TSD_TYPE_TX_SENDER_BLOCKED_ADD:{ if( l_tsd->size == sizeof (dap_chain_addr_t) ){ - dap_chain_addr_t * l_addrs = a_token_item->tx_send_block? DAP_NEW_Z_SIZE( typeof (*a_token_item->tx_send_block), + dap_chain_addr_t * l_addrs = a_token_item->tx_send_block ? DAP_NEW_Z_SIZE( dap_chain_addr_t, sizeof(*a_token_item->tx_send_block) ) : DAP_REALLOC(a_token_item->tx_send_block,(a_token_item->tx_send_block_size+1)*sizeof (*a_token_item->tx_send_block) ); // Check if its correct -- GitLab