bluetooth: fix signed and unsigend comparison warnings

Fix instances of:
warning: comparison between signed and unsigned integer expressions
[-Wsign-compare]

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-04-03 18:55:04 +02:00 committed by Anas Nashif
commit 7b2f9d929f
6 changed files with 15 additions and 14 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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);
}

View file

@ -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 ||

View file

@ -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);

View file

@ -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) {