diff --git a/subsys/bluetooth/common/log.c b/subsys/bluetooth/common/log.c index 2ca11b2b68f..b6e6526191f 100644 --- a/subsys/bluetooth/common/log.c +++ b/subsys/bluetooth/common/log.c @@ -25,7 +25,7 @@ const char *bt_hex_real(const void *buf, size_t len) static const char hex[] = "0123456789abcdef"; static char str[129]; const u8_t *b = buf; - int i; + size_t i; len = MIN(len, (sizeof(str) - 1) / 2); diff --git a/subsys/bluetooth/host/crypto.c b/subsys/bluetooth/host/crypto.c index d1ad31474d0..94e3e95dd1a 100644 --- a/subsys/bluetooth/host/crypto.c +++ b/subsys/bluetooth/host/crypto.c @@ -33,7 +33,8 @@ static int prng_reseed(struct tc_hmac_prng_struct *h) { u8_t seed[32]; s64_t extra; - int ret, i; + size_t i; + int ret; for (i = 0; i < (sizeof(seed) / 8); i++) { struct bt_hci_rp_le_rand *rp; diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 5c3cac0d4c2..4d2b1ff2156 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -1162,7 +1162,7 @@ static u16_t find_static_attr(const struct bt_gatt_attr *attr) u16_t handle = 1; Z_STRUCT_SECTION_FOREACH(bt_gatt_service_static, static_svc) { - for (int i = 0; i < static_svc->attr_count; i++, handle++) { + for (size_t i = 0; i < static_svc->attr_count; i++, handle++) { if (attr == &static_svc->attrs[i]) { return handle; } @@ -1305,7 +1305,7 @@ static void foreach_attr_type_dyndb(u16_t start_handle, u16_t end_handle, bt_gatt_attr_func_t func, void *user_data) { #if defined(CONFIG_BT_GATT_DYNAMIC_DB) - int i; + size_t i; struct bt_gatt_service *svc; SYS_SLIST_FOR_EACH_CONTAINER(&db, svc, node) { @@ -1341,7 +1341,7 @@ void bt_gatt_foreach_attr_type(u16_t start_handle, u16_t end_handle, const void *attr_data, uint16_t num_matches, bt_gatt_attr_func_t func, void *user_data) { - int i; + size_t i; if (!num_matches) { num_matches = UINT16_MAX; @@ -3860,7 +3860,7 @@ static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb, load.entry = ccc_store; load.count = len / sizeof(*ccc_store); - for (int i = 0; i < load.count; i++) { + for (size_t i = 0; i < load.count; i++) { BT_DBG("Read CCC: handle 0x%04x value 0x%04x", ccc_store[i].handle, ccc_store[i].value); } @@ -4183,7 +4183,7 @@ int bt_gatt_store_ccc(u8_t id, const bt_addr_le_t *addr) BT_DBG("Stored CCCs for %s (%s)", bt_addr_le_str(addr), log_strdup(key)); if (len) { - for (int i = 0; i < save.count; i++) { + for (size_t i = 0; i < save.count; i++) { BT_DBG(" CCC: handle 0x%04x value 0x%04x", save.store[i].handle, save.store[i].value); } diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index dba0c6a8c57..c18cd82ef4e 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -2192,7 +2192,7 @@ bool bt_le_conn_params_valid(const struct bt_le_conn_param *param) if (param->timeout < 10 || param->timeout > 3200 || ((param->timeout * 4U) <= - ((1 + param->latency) * param->interval_max))) { + ((1U + param->latency) * param->interval_max))) { return false; } @@ -6965,7 +6965,7 @@ static bool valid_adv_param(const struct bt_le_adv_param *param, bool dir_adv) static inline bool ad_has_name(const struct bt_data *ad, size_t ad_len) { - int i; + size_t i; for (i = 0; i < ad_len; i++) { if (ad[i].type == BT_DATA_NAME_COMPLETE || diff --git a/subsys/bluetooth/shell/bt.c b/subsys/bluetooth/shell/bt.c index 0e94bd0480e..6c86d42770e 100644 --- a/subsys/bluetooth/shell/bt.c +++ b/subsys/bluetooth/shell/bt.c @@ -434,7 +434,7 @@ static int cmd_hci_cmd(const struct shell *shell, size_t argc, char *argv[]) ocf = strtoul(argv[2], NULL, 16); if (argc > 3) { - int i; + size_t i; buf = bt_hci_cmd_create(BT_OP(ogf, ocf), argc - 3); diff --git a/subsys/bluetooth/shell/gatt.c b/subsys/bluetooth/shell/gatt.c index 6bbead3505c..872e64e2c66 100644 --- a/subsys/bluetooth/shell/gatt.c +++ b/subsys/bluetooth/shell/gatt.c @@ -266,7 +266,8 @@ static int cmd_read(const struct shell *shell, size_t argc, char *argv[]) static int cmd_mread(const struct shell *shell, size_t argc, char *argv[]) { u16_t h[8]; - int i, err; + size_t i; + int err; if (!default_conn) { shell_error(shell, "Not connected"); @@ -382,8 +383,7 @@ static int cmd_write(const struct shell *shell, size_t argc, char *argv[]) write_params.func = write_func; if (argc == 5) { - size_t len; - int i; + size_t len, i; len = MIN(strtoul(argv[4], NULL, 16), sizeof(gatt_write_buf)); @@ -977,7 +977,7 @@ static u8_t set_cb(const struct bt_gatt_attr *attr, void *user_data) { struct set_data *data = user_data; u8_t buf[256]; - int i; + size_t i; ssize_t ret; if (!attr->write) {