From 48bffb63b71d83a82a1967cbf4d50b27c4ddd382 Mon Sep 17 00:00:00 2001 From: "alexey.stratulat" <alexey.stratulat@demlabs.net> Date: Tue, 16 Aug 2022 18:32:07 +0700 Subject: [PATCH] [*] Transferred changes from the master. --- modules/common/dap_chain_common.c | 8 +++++--- modules/common/dap_chain_datum_token.c | 4 ++-- modules/common/dap_chain_datum_tx.c | 2 +- modules/common/include/dap_chain_common.h | 2 ++ modules/common/include/dap_chain_datum_tx.h | 5 +---- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/common/dap_chain_common.c b/modules/common/dap_chain_common.c index ff8056793e..e1ce522736 100644 --- a/modules/common/dap_chain_common.c +++ b/modules/common/dap_chain_common.c @@ -37,6 +37,8 @@ #define LOG_TAG "dap_chain_common" +const dap_chain_net_srv_uid_t c_dap_chain_net_srv_uid_null = {0}; + /* * Forward declarations */ @@ -572,8 +574,8 @@ uint256_t dap_chain_coins_to_balance256(const char *a_coins) l_len, DATOSHI_POW256 + 2), l_nul; /* Find , check and remove 'precision' dot symbol */ - memcpy (l_buf, a_coins, l_len); /* Make local coy */ - if ( !(l_point = memchr(l_buf, '.', l_len)) ) /* Is there 'dot' ? */ + memcpy (l_buf, a_coins, l_len); /* Make local copy */ + if ( !(l_point = memchr(l_buf, '.', l_len)) ) /* Is there 'dot' ? */ return log_it(L_WARNING, "Incorrect balance format of '%s' - no precision mark", a_coins), l_nul; @@ -604,8 +606,8 @@ uint256_t dap_chain_coins_to_balance256(const char *a_coins) char *dap_cvt_uint256_to_str(uint256_t a_uint256) { char *l_buf = DAP_NEW_Z_SIZE(char, DATOSHI_POW256 + 3); - int l_pos = 0; #ifdef DAP_GLOBAL_IS_INT128 + int l_pos = 0; uint256_t l_value = a_uint256; uint256_t uint256_ten = {.hi = 0, .lo = 10}; uint256_t rem; diff --git a/modules/common/dap_chain_datum_token.c b/modules/common/dap_chain_datum_token.c index 289d35901b..2a04de6c2a 100644 --- a/modules/common/dap_chain_datum_token.c +++ b/modules/common/dap_chain_datum_token.c @@ -189,8 +189,8 @@ dap_sign_t ** dap_chain_datum_token_signs_parse(dap_chain_datum_token_t * a_datu size_t l_signs_offset = a_datum_token->type == DAP_CHAIN_DATUM_TOKEN_TYPE_OLD_SIMPLE ? sizeof(dap_chain_datum_token_old_t) : sizeof(dap_chain_datum_token_t); - if ((a_datum_token->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL) || - (a_datum_token->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL)) { + if ((a_datum_token->type == DAP_CHAIN_DATUM_TOKEN_TYPE_NATIVE_DECL) + || (a_datum_token->type == DAP_CHAIN_DATUM_TOKEN_TYPE_PRIVATE_DECL)) { l_signs_offset += a_datum_token->header_native_decl.tsd_total_size; } while( l_offset < (a_datum_token_size - l_signs_offset) && n < a_datum_token->signs_total ) { diff --git a/modules/common/dap_chain_datum_tx.c b/modules/common/dap_chain_datum_tx.c index c85b498521..927f078cfb 100644 --- a/modules/common/dap_chain_datum_tx.c +++ b/modules/common/dap_chain_datum_tx.c @@ -69,7 +69,7 @@ size_t dap_chain_datum_tx_get_size(dap_chain_datum_tx_t *a_tx) * * return 1 Ok, -1 Error */ -int dap_chain_datum_tx_add_item(dap_chain_datum_tx_t **a_tx, const uint8_t *a_item) +int dap_chain_datum_tx_add_item(dap_chain_datum_tx_t **a_tx, const void *a_item) { size_t size = dap_chain_datum_item_tx_get_size(a_item); if(!size) diff --git a/modules/common/include/dap_chain_common.h b/modules/common/include/dap_chain_common.h index 059f116487..6362a96e69 100644 --- a/modules/common/include/dap_chain_common.h +++ b/modules/common/include/dap_chain_common.h @@ -158,6 +158,8 @@ typedef union { #endif } dap_chain_net_srv_uid_t; +extern const dap_chain_net_srv_uid_t c_dap_chain_net_srv_uid_null; + typedef enum { SERV_UNIT_UNDEFINED = 0 , SERV_UNIT_MB = 0x00000001, // megabytes diff --git a/modules/common/include/dap_chain_datum_tx.h b/modules/common/include/dap_chain_datum_tx.h index c4b29bba1a..0b903b6761 100644 --- a/modules/common/include/dap_chain_datum_tx.h +++ b/modules/common/include/dap_chain_datum_tx.h @@ -33,7 +33,6 @@ typedef enum dap_chain_tx_cond_type { COND_SERVICE_BILL = 0x30, // } dap_chain_tx_cond_type_t; - /** * @struct dap_chain_datum_tx * @brief Transaction section, consists from lot of tx_items @@ -45,8 +44,6 @@ typedef struct dap_chain_datum_tx{ } DAP_ALIGN_PACKED header; uint8_t tx_items[]; } DAP_ALIGN_PACKED dap_chain_datum_tx_t; - - /** * Create empty transaction * @@ -71,7 +68,7 @@ size_t dap_chain_datum_tx_get_size(dap_chain_datum_tx_t *a_tx); * * return 1 Ok, -1 Error */ -int dap_chain_datum_tx_add_item(dap_chain_datum_tx_t **a_tx, const uint8_t *a_item); +int dap_chain_datum_tx_add_item(dap_chain_datum_tx_t **a_tx, const void *a_item); /** * Create 'in' items from list and insert to transaction -- GitLab