Bluetooth: Use ssize_t for the return value of read_cb

Most places used an int so that should have handled most cases but
keys_set was using an unsigned int, which meant that checking len > 0
is an expression that is always false, and the error handling is not
working.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-04-02 16:08:46 +02:00 committed by Johan Hedberg
commit f8017adf5c
4 changed files with 12 additions and 7 deletions

View file

@ -46,7 +46,8 @@ bool ll_settings_smi_tx(void)
static int ctlr_set(const char *name, size_t len_rd,
settings_read_cb read_cb, void *store)
{
int len, nlen;
ssize_t len;
int nlen;
const char *next;
nlen = settings_name_next(name, &next);

View file

@ -3826,7 +3826,8 @@ static int ccc_set(const char *name, size_t len_rd, settings_read_cb read_cb,
struct ccc_store ccc_store[CCC_STORE_MAX];
struct ccc_load load;
bt_addr_le_t addr;
int len, err;
ssize_t len;
int err;
const char *next;
settings_name_next(name, &next);
@ -4200,7 +4201,8 @@ static int sc_set(const char *name, size_t len_rd, settings_read_cb read_cb,
struct gatt_sc_cfg *cfg;
u8_t id;
bt_addr_le_t addr;
int len, err;
ssize_t len;
int err;
const char *next;
if (!name) {
@ -4276,7 +4278,8 @@ static int cf_set(const char *name, size_t len_rd, settings_read_cb read_cb,
struct gatt_cf_cfg *cfg;
bt_addr_le_t addr;
const char *next;
int len, err;
ssize_t len;
int err;
u8_t id;
if (!name) {
@ -4331,7 +4334,7 @@ static u8_t stored_hash[16];
static int db_hash_set(const char *name, size_t len_rd,
settings_read_cb read_cb, void *cb_arg)
{
int len;
ssize_t len;
len = read_cb(cb_arg, stored_hash, sizeof(stored_hash));
if (len < 0) {

View file

@ -297,7 +297,7 @@ static int keys_set(const char *name, size_t len_rd, settings_read_cb read_cb,
struct bt_keys *keys;
bt_addr_le_t addr;
u8_t id;
size_t len;
ssize_t len;
int err;
char val[BT_KEYS_STORAGE_LEN];
const char *next;

View file

@ -145,7 +145,8 @@ BT_GATT_SERVICE_DEFINE(dis_svc,
static int dis_set(const char *name, size_t len_rd,
settings_read_cb read_cb, void *store)
{
int len, nlen;
ssize_t len;
int nlen;
const char *next;
nlen = settings_name_next(name, &next);