diff --git a/c/src/api/usn/usn_api.c b/c/src/api/usn/usn_api.c index c7c54b5da..c2090187c 100644 --- a/c/src/api/usn/usn_api.c +++ b/c/src/api/usn/usn_api.c @@ -349,9 +349,9 @@ static int usn_add_booking(usn_device_t* device, address_t controller, uint64_t return 0; } } - device->bookings = device->bookings - ? _realloc(device->bookings, sizeof(usn_booking_t) * (device->num_bookings + 1), sizeof(usn_booking_t) * device->num_bookings) - : _malloc(sizeof(usn_booking_t) * device->num_bookings + 1); + device->bookings = device->bookings + ? _realloc(device->bookings, sizeof(usn_booking_t) * (device->num_bookings + 1), sizeof(usn_booking_t) * device->num_bookings) + : _malloc(sizeof(usn_booking_t) * device->num_bookings + 1); usn_booking_t* booking = device->bookings + device->num_bookings; booking->rented_from = rented_from; booking->rented_until = rented_until; diff --git a/c/src/core/client/client.h b/c/src/core/client/client.h index ab46e7d7f..a07526576 100644 --- a/c/src/core/client/client.h +++ b/c/src/core/client/client.h @@ -280,10 +280,10 @@ typedef struct in3_storage_handler { void* cptr; /**< custom pointer which will be passed to functions */ } in3_storage_handler_t; -#define IN3_SIGN_ERR_REJECTED -1 /**< return value used by the signer if the the signature-request was rejected. */ +#define IN3_SIGN_ERR_REJECTED -1 /**< return value used by the signer if the the signature-request was rejected. */ #define IN3_SIGN_ERR_ACCOUNT_NOT_FOUND -2 /**< return value used by the signer if the requested account was not found. */ -#define IN3_SIGN_ERR_INVALID_MESSAGE -3 /**< return value used by the signer if the message was invalid. */ -#define IN3_SIGN_ERR_GENERAL_ERROR -4 /**< return value used by the signer for unspecified errors. */ +#define IN3_SIGN_ERR_INVALID_MESSAGE -3 /**< return value used by the signer if the message was invalid. */ +#define IN3_SIGN_ERR_GENERAL_ERROR -4 /**< return value used by the signer for unspecified errors. */ /** type of the requested signature */ typedef enum { diff --git a/c/src/core/client/client_init.c b/c/src/core/client/client_init.c index 39d701012..c9c3c08b6 100644 --- a/c/src/core/client/client_init.c +++ b/c/src/core/client/client_init.c @@ -383,9 +383,9 @@ in3_ret_t in3_client_add_node(in3_t* c, chain_id_t chain_id, char* url, in3_node chain->nodelist = chain->nodelist ? _realloc(chain->nodelist, sizeof(in3_node_t) * (chain->nodelist_length + 1), sizeof(in3_node_t) * chain->nodelist_length) : _calloc(chain->nodelist_length + 1, sizeof(in3_node_t)); - chain->weights = chain->weights - ? _realloc(chain->weights, sizeof(in3_node_weight_t) * (chain->nodelist_length + 1), sizeof(in3_node_weight_t) * chain->nodelist_length) - : _calloc(chain->nodelist_length + 1, sizeof(in3_node_weight_t)); + chain->weights = chain->weights + ? _realloc(chain->weights, sizeof(in3_node_weight_t) * (chain->nodelist_length + 1), sizeof(in3_node_weight_t) * chain->nodelist_length) + : _calloc(chain->nodelist_length + 1, sizeof(in3_node_weight_t)); if (!chain->nodelist || !chain->weights) return IN3_ENOMEM; node = chain->nodelist + chain->nodelist_length; node->address = b_new(address, 20); diff --git a/c/src/core/client/execute.c b/c/src/core/client/execute.c index 0e4c1354b..74ce1a624 100644 --- a/c/src/core/client/execute.c +++ b/c/src/core/client/execute.c @@ -107,7 +107,8 @@ NONULL static in3_ret_t pick_signers(in3_ctx_t* ctx, d_token_t* request) { return IN3_OK; // For nodeList request, we always ask for proof & atleast one signature - uint8_t total_sig_cnt = c->signature_count ? c->signature_count : auto_ask_sig(ctx) ? 1 : 0; + uint8_t total_sig_cnt = c->signature_count ? c->signature_count : auto_ask_sig(ctx) ? 1 + : 0; if (total_sig_cnt) { node_match_t* signer_nodes = NULL; diff --git a/c/src/core/client/nodelist.c b/c/src/core/client/nodelist.c index 05c642c53..ef8140f04 100644 --- a/c/src/core/client/nodelist.c +++ b/c/src/core/client/nodelist.c @@ -362,9 +362,9 @@ IN3_EXPORT_TEST bool in3_node_props_match(const in3_node_props_t np_config, cons } uint32_t in3_node_calculate_weight(in3_node_weight_t* n, uint32_t capa, uint64_t now) { - const uint32_t avg = (n->response_count > 4 && n->total_response_time) - ? (n->total_response_time / n->response_count) - : (10000 / (max(capa, 100) + 100)); + const uint32_t avg = (n->response_count > 4 && n->total_response_time) + ? (n->total_response_time / n->response_count) + : (10000 / (max(capa, 100) + 100)); const uint32_t blacklist_factor = ((now - n->blacklisted_until) < BLACKLISTWEIGHT) ? ((now - n->blacklisted_until) * 100 / (BLACKLISTWEIGHT)) : 100; diff --git a/c/src/core/util/data.c b/c/src/core/util/data.c index 67da844ad..c0016972f 100644 --- a/c/src/core/util/data.c +++ b/c/src/core/util/data.c @@ -96,7 +96,7 @@ d_key_t keyn(const char* c, const size_t len) { return kn->key; kn = kn->next; } - val = __keynames_len; + val = __keynames_len; #endif return val; } diff --git a/c/src/core/util/utils.c b/c/src/core/util/utils.c index cdb543277..bcfcc686d 100644 --- a/c/src/core/util/utils.c +++ b/c/src/core/util/utils.c @@ -61,7 +61,7 @@ static void srand_zephyr(unsigned int s) { static time_func in3_time_fn = time_zephyr; static rand_func in3_rand_fn = rand_zephyr; static srand_func in3_srand_fn = srand_zephyr; -#else /* __ZEPHYR__ */ +#else /* __ZEPHYR__ */ static uint64_t time_libc(void* t) { UNUSED_VAR(t); return time(t); diff --git a/c/src/verifier/eth1/evm/evm.h b/c/src/verifier/eth1/evm/evm.h index fade2d40f..ecbe27eba 100644 --- a/c/src/verifier/eth1/evm/evm.h +++ b/c/src/verifier/eth1/evm/evm.h @@ -62,19 +62,19 @@ typedef enum evm_state { #define gas_options #endif -#define EVM_ERROR_EMPTY_STACK -20 /**< the no more elements on the stack */ -#define EVM_ERROR_INVALID_OPCODE -21 /**< the opcode is not supported */ -#define EVM_ERROR_BUFFER_TOO_SMALL -22 /**< reading data from a position, which is not initialized */ -#define EVM_ERROR_ILLEGAL_MEMORY_ACCESS -23 /**< the memory-offset does not exist */ -#define EVM_ERROR_INVALID_JUMPDEST -24 /**< the jump destination is not marked as valid destination */ -#define EVM_ERROR_INVALID_PUSH -25 /**< the push data is empy */ +#define EVM_ERROR_EMPTY_STACK -20 /**< the no more elements on the stack */ +#define EVM_ERROR_INVALID_OPCODE -21 /**< the opcode is not supported */ +#define EVM_ERROR_BUFFER_TOO_SMALL -22 /**< reading data from a position, which is not initialized */ +#define EVM_ERROR_ILLEGAL_MEMORY_ACCESS -23 /**< the memory-offset does not exist */ +#define EVM_ERROR_INVALID_JUMPDEST -24 /**< the jump destination is not marked as valid destination */ +#define EVM_ERROR_INVALID_PUSH -25 /**< the push data is empy */ #define EVM_ERROR_UNSUPPORTED_CALL_OPCODE -26 /**< error handling the call, usually because static-calls are not allowed to change state */ -#define EVM_ERROR_TIMEOUT -27 /**< the evm ran into a loop */ -#define EVM_ERROR_INVALID_ENV -28 /**< the enviroment could not deliver the data */ -#define EVM_ERROR_OUT_OF_GAS -29 /**< not enough gas to exewcute the opcode */ -#define EVM_ERROR_BALANCE_TOO_LOW -30 /**< not enough funds to transfer the requested value. */ -#define EVM_ERROR_STACK_LIMIT -31 /**< stack limit reached */ -#define EVM_ERROR_SUCCESS_CONSUME_GAS -32 /**< write success but consume all gas */ +#define EVM_ERROR_TIMEOUT -27 /**< the evm ran into a loop */ +#define EVM_ERROR_INVALID_ENV -28 /**< the enviroment could not deliver the data */ +#define EVM_ERROR_OUT_OF_GAS -29 /**< not enough gas to exewcute the opcode */ +#define EVM_ERROR_BALANCE_TOO_LOW -30 /**< not enough funds to transfer the requested value. */ +#define EVM_ERROR_STACK_LIMIT -31 /**< stack limit reached */ +#define EVM_ERROR_SUCCESS_CONSUME_GAS -32 /**< write success but consume all gas */ #define EVM_PROP_FRONTIER 1 #define EVM_PROP_EIP150 2