mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-05 21:04:49 +00:00
build: fix various compile warnings
mostly comparison signed vs unsigned and possible un-initialized usage
This commit is contained in:
committed by
Szymon Janc
parent
d8dfb16991
commit
333c575bbf
@@ -222,7 +222,7 @@ static struct ble_ll_adv_sm *
|
||||
ble_ll_adv_sm_find_configured(uint8_t instance)
|
||||
{
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
/* in legacy mode we only allow instance 0 */
|
||||
if (!ble_ll_hci_adv_mode_ext()) {
|
||||
@@ -3295,7 +3295,7 @@ static struct ble_ll_adv_sm *
|
||||
ble_ll_adv_sm_get(uint8_t instance)
|
||||
{
|
||||
struct ble_ll_adv_sm *advsm;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
advsm = ble_ll_adv_sm_find_configured(instance);
|
||||
if (advsm) {
|
||||
|
||||
@@ -1473,7 +1473,7 @@ conn_tx_pdu:
|
||||
static int
|
||||
ble_ll_conn_event_start_cb(struct ble_ll_sched_item *sch)
|
||||
{
|
||||
int rc;
|
||||
int rc = 0;
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
|
||||
uint32_t usecs;
|
||||
#endif
|
||||
@@ -3594,7 +3594,7 @@ ble_ll_conn_rx_isr_end(uint8_t *rxbuf, struct ble_mbuf_hdr *rxhdr)
|
||||
uint8_t hdr_nesn;
|
||||
uint8_t conn_sn;
|
||||
uint8_t conn_nesn;
|
||||
uint8_t reply;
|
||||
uint8_t reply = 0;
|
||||
uint16_t rem_bytes;
|
||||
uint8_t opcode = 0;
|
||||
uint8_t rx_pyld_len;
|
||||
|
||||
@@ -140,7 +140,7 @@ ble_ll_conn_comp_event_send(struct ble_ll_conn_sm *connsm, uint8_t status,
|
||||
struct ble_hci_ev_le_subev_enh_conn_complete *enh_ev;
|
||||
struct ble_hci_ev_le_subev_conn_complete *ev;
|
||||
struct ble_hci_ev *hci_ev = (void *) evbuf;
|
||||
uint8_t *rpa;
|
||||
uint8_t *rpa = NULL;
|
||||
|
||||
BLE_LL_ASSERT(evbuf);
|
||||
|
||||
@@ -801,7 +801,7 @@ ble_ll_conn_hci_ext_create(const uint8_t *cmdbuf, uint8_t len)
|
||||
|
||||
cc_params_fb = NULL;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(init_phys); i++) {
|
||||
for (unsigned int i = 0; i < ARRAY_SIZE(init_phys); i++) {
|
||||
init_phy = &init_phys[i];
|
||||
|
||||
if ((cc_scan.init_phy_mask & init_phy->mask) == 0) {
|
||||
|
||||
@@ -1720,7 +1720,7 @@ ble_ll_ctrl_rx_pause_enc_req(struct ble_ll_conn_sm *connsm)
|
||||
static uint8_t
|
||||
ble_ll_ctrl_rx_pause_enc_rsp(struct ble_ll_conn_sm *connsm)
|
||||
{
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
switch (connsm->conn_role) {
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
@@ -1761,7 +1761,7 @@ ble_ll_ctrl_rx_pause_enc_rsp(struct ble_ll_conn_sm *connsm)
|
||||
static uint8_t
|
||||
ble_ll_ctrl_rx_start_enc_rsp(struct ble_ll_conn_sm *connsm)
|
||||
{
|
||||
int rc;
|
||||
int rc = 0;
|
||||
|
||||
/* Not in proper state. Discard */
|
||||
if (connsm->enc_data.enc_state != CONN_ENC_S_START_ENC_RSP_WAIT) {
|
||||
@@ -1907,7 +1907,7 @@ uint8_t
|
||||
ble_ll_ctrl_conn_param_reply(struct ble_ll_conn_sm *connsm, uint8_t *rsp,
|
||||
struct ble_ll_conn_params *req)
|
||||
{
|
||||
uint8_t rsp_opcode;
|
||||
uint8_t rsp_opcode = 0;
|
||||
|
||||
switch (connsm->conn_role) {
|
||||
#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
|
||||
@@ -2451,7 +2451,7 @@ static struct os_mbuf *
|
||||
ble_ll_ctrl_proc_init(struct ble_ll_conn_sm *connsm, int ctrl_proc, void *data)
|
||||
{
|
||||
uint8_t len;
|
||||
uint8_t opcode;
|
||||
uint8_t opcode = 0;
|
||||
uint8_t *dptr;
|
||||
uint8_t *ctrdata;
|
||||
struct os_mbuf *om;
|
||||
@@ -2756,7 +2756,6 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om)
|
||||
uint64_t feature;
|
||||
uint8_t len;
|
||||
uint8_t opcode;
|
||||
uint8_t rsp_opcode;
|
||||
uint8_t *dptr;
|
||||
uint8_t *rspbuf;
|
||||
uint8_t *rspdata;
|
||||
@@ -2764,6 +2763,7 @@ ble_ll_ctrl_rx_pdu(struct ble_ll_conn_sm *connsm, struct os_mbuf *om)
|
||||
int restart_encryption;
|
||||
#endif
|
||||
int rc = 0;
|
||||
uint8_t rsp_opcode = 0;
|
||||
|
||||
/* XXX: where do we validate length received and packet header length?
|
||||
* do this in LL task when received. Someplace!!! What I mean
|
||||
|
||||
@@ -585,7 +585,7 @@ ble_ll_hci_ev_send_vs_assert(const char *file, uint32_t line)
|
||||
* hci_ev->length += len;
|
||||
*/
|
||||
str_len = strlen(file);
|
||||
if (str_len > max_len) {
|
||||
if (str_len > (unsigned int)max_len) {
|
||||
str_len = max_len;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,7 +419,7 @@ ble_ll_sched_conn_central_new(struct ble_ll_conn_sm *connsm,
|
||||
#endif
|
||||
struct ble_ll_sched_item *sch;
|
||||
uint32_t orig_start_time;
|
||||
uint32_t earliest_start;
|
||||
uint32_t earliest_start = 0;
|
||||
uint32_t min_win_offset;
|
||||
uint32_t max_delay;
|
||||
uint32_t adv_rxend;
|
||||
|
||||
@@ -143,7 +143,7 @@ static int ble_ll_sync_event_start_cb(struct ble_ll_sched_item *sch);
|
||||
static int
|
||||
ble_ll_sync_on_list(const uint8_t *addr, uint8_t addr_type, uint8_t sid)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_ble_ll_sync_adv_list); i++) {
|
||||
if ((g_ble_ll_sync_adv_list[i].adv_sid == sid) &&
|
||||
@@ -159,7 +159,7 @@ ble_ll_sync_on_list(const uint8_t *addr, uint8_t addr_type, uint8_t sid)
|
||||
static int
|
||||
ble_ll_sync_list_get_free(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_ble_ll_sync_adv_list); i++) {
|
||||
if (g_ble_ll_sync_adv_list[i].adv_sid == 0xff) {
|
||||
@@ -172,7 +172,7 @@ ble_ll_sync_list_get_free(void)
|
||||
|
||||
static bool
|
||||
ble_ll_sync_list_empty(void) {
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_ble_ll_sync_adv_list); i++) {
|
||||
if (g_ble_ll_sync_adv_list[i].adv_sid != 0xff) {
|
||||
@@ -1716,7 +1716,7 @@ ble_ll_sync_list_remove(const uint8_t *cmdbuf, uint8_t len)
|
||||
int
|
||||
ble_ll_sync_list_clear(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
if (g_ble_ll_sync_create_comp_ev) {
|
||||
return BLE_ERR_CMD_DISALLOWED;
|
||||
@@ -2241,7 +2241,7 @@ ble_ll_sync_enabled(void)
|
||||
void
|
||||
ble_ll_sync_reset(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < BLE_LL_SYNC_CNT; i++) {
|
||||
ble_ll_sync_sm_clear(&g_ble_ll_sync_sm[i]);
|
||||
@@ -2267,7 +2267,7 @@ ble_ll_sync_reset(void)
|
||||
void
|
||||
ble_ll_sync_init(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(g_ble_ll_sync_adv_list); i++) {
|
||||
g_ble_ll_sync_adv_list[i].adv_sid = 0xff;
|
||||
|
||||
@@ -457,6 +457,7 @@ ble_svc_ans_init(void)
|
||||
|
||||
rc = ble_gatts_add_svcs(ble_svc_ans_defs);
|
||||
SYSINIT_PANIC_ASSERT(rc == 0);
|
||||
(void)rc;
|
||||
|
||||
ble_svc_ans_new_alert_cat = MYNEWT_VAL(BLE_SVC_ANS_NEW_ALERT_CAT);
|
||||
ble_svc_ans_unr_alert_cat = MYNEWT_VAL(BLE_SVC_ANS_UNR_ALERT_CAT);
|
||||
|
||||
@@ -137,7 +137,7 @@ static const struct ble_att_rx_dispatch_entry *
|
||||
ble_att_rx_dispatch_entry_find(uint8_t op)
|
||||
{
|
||||
const struct ble_att_rx_dispatch_entry *entry;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < BLE_ATT_RX_DISPATCH_SZ; i++) {
|
||||
entry = ble_att_rx_dispatch + i;
|
||||
|
||||
@@ -143,8 +143,8 @@ ble_hs_hci_rx_cmd_complete(const void *data, int len,
|
||||
const struct ble_hci_ev_command_complete_nop *nop = data;
|
||||
uint16_t opcode;
|
||||
|
||||
if (len < sizeof(*ev)) {
|
||||
if (len < sizeof(*nop)) {
|
||||
if (len < (int)sizeof(*ev)) {
|
||||
if (len < (int)sizeof(*nop)) {
|
||||
return BLE_HS_ECONTROLLER;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ static const struct ble_hs_hci_evt_dispatch_entry *
|
||||
ble_hs_hci_evt_dispatch_find(uint8_t event_code)
|
||||
{
|
||||
const struct ble_hs_hci_evt_dispatch_entry *entry;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < BLE_HS_HCI_EVT_DISPATCH_SZ; i++) {
|
||||
entry = ble_hs_hci_evt_dispatch + i;
|
||||
|
||||
@@ -81,7 +81,7 @@ ble_hs_hci_rand(void *dst, int len)
|
||||
return rc;
|
||||
}
|
||||
|
||||
chunk_sz = min(len, sizeof(rsp));
|
||||
chunk_sz = min(len, (int)sizeof(rsp));
|
||||
memcpy(u8ptr, &rsp.random_number, chunk_sz);
|
||||
|
||||
len -= chunk_sz;
|
||||
|
||||
@@ -103,7 +103,7 @@ ble_l2cap_clear_used_cid(uint32_t *cid_mask, int bit)
|
||||
static inline int
|
||||
ble_l2cap_get_first_available_bit(uint32_t *cid_mask)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
int bit = 0;
|
||||
|
||||
for (i = 0; i < BLE_HS_CONN_L2CAP_COC_CID_MASK_LEN; i++) {
|
||||
|
||||
@@ -394,7 +394,7 @@ ble_store_clear(void)
|
||||
union ble_store_key key;
|
||||
int obj_type;
|
||||
int rc;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
/* A zeroed key will always retrieve the first value. */
|
||||
memset(&key, 0, sizeof key);
|
||||
|
||||
@@ -184,7 +184,7 @@ nrf_timer_set_ocmp(struct nrf52_hal_timer *bsptimer, uint32_t expiry)
|
||||
} else {
|
||||
rtctimer->INTENCLR = RTC_INTENCLR_TICK_Msk;
|
||||
|
||||
if (delta_t < (1UL << 24)) {
|
||||
if (delta_t < (1L << 24)) {
|
||||
rtctimer->CC[NRF_RTC_TIMER_CC_INT] = expiry & 0x00ffffff;
|
||||
} else {
|
||||
/* CC too far ahead. Just make sure we set compare far ahead */
|
||||
|
||||
Reference in New Issue
Block a user