Skip to content

Commit

Permalink
new clang11
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-jentzsch committed Jul 12, 2020
1 parent 7f0d9ca commit da29c4f
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 27 deletions.
6 changes: 3 additions & 3 deletions c/src/api/usn/usn_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions c/src/core/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions c/src/core/client/client_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion c/src/core/client/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions c/src/core/client/nodelist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion c/src/core/util/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion c/src/core/util/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions c/src/verifier/eth1/evm/evm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da29c4f

Please sign in to comment.