Bluetooth: Audio: Use size_t for audio.h array len arguments

Use size_t instead of uint8_t to describe array lengths.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
Emil Gydesen 2022-02-22 14:47:00 +01:00 committed by Anas Nashif
commit a01cc054c9
11 changed files with 54 additions and 54 deletions

View file

@ -206,11 +206,11 @@ struct bt_codec {
/** Codec Company Vendor ID */
uint16_t vid;
/** Codec Specific Data count */
uint8_t data_count;
size_t data_count;
/** Codec Specific Data */
struct bt_codec_data data[CONFIG_BT_CODEC_MAX_DATA_COUNT];
/** Codec Specific Metadata count */
uint8_t meta_count;
size_t meta_count;
/** Codec Specific Metadata */
struct bt_codec_data meta[CONFIG_BT_CODEC_MAX_METADATA_COUNT];
};
@ -222,7 +222,7 @@ struct bt_audio_base_bis_data {
*
* Only valid if the data_count of struct bt_codec in the subgroup is 0
*/
uint8_t data_count;
size_t data_count;
/** Codec Specific Data
*
* Only valid if the data_count of struct bt_codec in the subgroup is 0
@ -232,7 +232,7 @@ struct bt_audio_base_bis_data {
struct bt_audio_base_subgroup {
/* Number of BIS in the subgroup */
uint8_t bis_count;
size_t bis_count;
/** Codec information for the subgroup
*
* If the data_count of the codec is 0, then codec specific data may be
@ -245,7 +245,7 @@ struct bt_audio_base_subgroup {
struct bt_audio_base {
/* Number of subgroups in the BASE */
uint8_t subgroup_count;
size_t subgroup_count;
/* Array of subgroups in the BASE */
struct bt_audio_base_subgroup subgroups[BROADCAST_SUBGROUP_CNT];
};
@ -987,7 +987,7 @@ struct bt_audio_unicast_server_cb {
*
* @return 0 in case of success or negative value in case of error.
*/
int (*enable)(struct bt_audio_stream *stream, uint8_t meta_count,
int (*enable)(struct bt_audio_stream *stream, size_t meta_count,
const struct bt_codec_data *meta);
/** @brief Stream Start request callback
@ -1012,7 +1012,7 @@ struct bt_audio_unicast_server_cb {
*
* @return 0 in case of success or negative value in case of error.
*/
int (*metadata)(struct bt_audio_stream *stream, uint8_t meta_count,
int (*metadata)(struct bt_audio_stream *stream, size_t meta_count,
const struct bt_codec_data *meta);
/** @brief Stream Disable request callback
@ -1399,7 +1399,7 @@ int bt_audio_stream_qos(struct bt_conn *conn,
* @return 0 in case of success or negative value in case of error.
*/
int bt_audio_stream_enable(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta);
size_t meta_count, struct bt_codec_data *meta);
/** @brief Change Audio Stream Metadata
*
@ -1412,7 +1412,7 @@ int bt_audio_stream_enable(struct bt_audio_stream *stream,
* @return 0 in case of success or negative value in case of error.
*/
int bt_audio_stream_metadata(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta);
size_t meta_count, struct bt_codec_data *meta);
/** @brief Disable Audio Stream
*
@ -1500,7 +1500,7 @@ int bt_audio_stream_send(struct bt_audio_stream *stream, struct net_buf *buf);
* @return Zero on success or (negative) error code otherwise.
*/
int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
uint8_t num_stream,
size_t num_stream,
struct bt_audio_unicast_group **unicast_group);
/** @brief Add streams to a unicast group as a unicast client
@ -1521,7 +1521,7 @@ int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
*/
int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group,
struct bt_audio_stream *streams,
uint8_t num_stream);
size_t num_stream);
/** @brief Remove streams from a unicast group as a unicast client
*
@ -1540,7 +1540,7 @@ int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_gr
*/
int bt_audio_unicast_group_remove_streams(struct bt_audio_unicast_group *unicast_group,
struct bt_audio_stream *streams,
uint8_t num_stream);
size_t num_stream);
/** @brief Delete audio unicast group.
*
@ -1575,7 +1575,7 @@ int bt_audio_unicast_group_delete(struct bt_audio_unicast_group *unicast_group);
* @return Zero on success or (negative) error code otherwise.
*/
int bt_audio_broadcast_source_create(struct bt_audio_stream *streams,
uint8_t num_stream,
size_t num_stream,
struct bt_codec *codec,
struct bt_codec_qos *qos,
struct bt_audio_broadcast_source **source);

View file

@ -155,7 +155,7 @@ struct bt_audio_capability_ops {
*
* @return 0 in case of success or negative value in case of error.
*/
int (*enable)(struct bt_audio_stream *stream, uint8_t meta_count,
int (*enable)(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta);
/** @brief Capability Start callback
@ -180,7 +180,7 @@ struct bt_audio_capability_ops {
*
* @return 0 in case of success or negative value in case of error.
*/
int (*metadata)(struct bt_audio_stream *stream, uint8_t meta_count,
int (*metadata)(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta);
/** @brief Capability Disable callback

View file

@ -143,7 +143,7 @@ static int lc3_qos(struct bt_audio_stream *stream, struct bt_codec_qos *qos)
return 0;
}
static int lc3_enable(struct bt_audio_stream *stream, uint8_t meta_count,
static int lc3_enable(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta)
{
printk("Enable: stream %p meta_count %u\n", stream, meta_count);
@ -158,7 +158,7 @@ static int lc3_start(struct bt_audio_stream *stream)
return 0;
}
static int lc3_metadata(struct bt_audio_stream *stream, uint8_t meta_count,
static int lc3_metadata(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta)
{
printk("Metadata: stream %p meta_count %u\n", stream, meta_count);

View file

@ -369,7 +369,7 @@ static void broadcast_source_cleanup(struct bt_audio_broadcast_source *source)
}
int bt_audio_broadcast_source_create(struct bt_audio_stream *streams,
uint8_t num_stream,
size_t num_stream,
struct bt_codec *codec,
struct bt_codec_qos *qos,
struct bt_audio_broadcast_source **out_source)

View file

@ -156,7 +156,7 @@ static int unicast_server_qos_cb(struct bt_audio_stream *stream,
}
static int unicast_server_enable_cb(struct bt_audio_stream *stream,
uint8_t meta_count,
size_t meta_count,
const struct bt_codec_data *meta)
{
struct bt_audio_capability *cap = stream->user_data;
@ -181,7 +181,7 @@ static int unicast_server_start_cb(struct bt_audio_stream *stream)
}
static int unicast_server_metadata_cb(struct bt_audio_stream *stream,
uint8_t meta_count,
size_t meta_count,
const struct bt_codec_data *meta)
{
struct bt_audio_capability *cap = stream->user_data;

View file

@ -636,7 +636,7 @@ static bool bt_audio_stream_enabling(struct bt_audio_stream *stream)
}
int bt_audio_stream_enable(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta)
size_t meta_count, struct bt_codec_data *meta)
{
uint8_t role;
int err;
@ -691,7 +691,7 @@ int bt_audio_stream_enable(struct bt_audio_stream *stream,
}
int bt_audio_stream_metadata(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta)
size_t meta_count, struct bt_codec_data *meta)
{
uint8_t role;
int err;
@ -1008,7 +1008,7 @@ int bt_audio_stream_connect(struct bt_audio_stream *stream)
}
int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
uint8_t num_stream,
size_t num_stream,
struct bt_audio_unicast_group **out_unicast_group)
{
@ -1047,7 +1047,7 @@ int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
return -ENOMEM;
}
for (uint8_t i = 0; i < num_stream; i++) {
for (size_t i = 0; i < num_stream; i++) {
sys_slist_t *group_streams = &unicast_group->streams;
struct bt_audio_stream *stream;
@ -1058,7 +1058,7 @@ int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
i, stream, stream->group);
/* Cleanup */
for (uint8_t j = 0; j < i; j++) {
for (size_t j = 0; j < i; j++) {
stream = &streams[j];
(void)sys_slist_find_and_remove(group_streams,
@ -1079,10 +1079,10 @@ int bt_audio_unicast_group_create(struct bt_audio_stream *streams,
int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_group,
struct bt_audio_stream *streams,
uint8_t num_stream)
size_t num_stream)
{
struct bt_audio_stream *tmp_stream;
uint8_t total_stream_cnt;
size_t total_stream_cnt;
struct bt_iso_cig *cig;
CHECKIF(unicast_group == NULL) {
@ -1113,9 +1113,9 @@ int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_gr
}
/* Validate input */
for (uint8_t i = 0; i < num_stream; i++) {
for (size_t i = 0; i < num_stream; i++) {
if (streams[i].group != NULL) {
BT_DBG("stream[%u] is already part of group %p",
BT_DBG("stream[%zu] is already part of group %p",
i, streams[i].group);
return -EINVAL;
}
@ -1130,7 +1130,7 @@ int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_gr
return -EBADMSG;
}
for (uint8_t i = 0; i < num_stream; i++) {
for (size_t i = 0; i < num_stream; i++) {
sys_slist_t *group_streams = &unicast_group->streams;
struct bt_audio_stream *stream = &streams[i];
@ -1143,7 +1143,7 @@ int bt_audio_unicast_group_add_streams(struct bt_audio_unicast_group *unicast_gr
int bt_audio_unicast_group_remove_streams(struct bt_audio_unicast_group *unicast_group,
struct bt_audio_stream *streams,
uint8_t num_stream)
size_t num_stream)
{
struct bt_iso_cig *cig;
@ -1163,9 +1163,9 @@ int bt_audio_unicast_group_remove_streams(struct bt_audio_unicast_group *unicast
}
/* Validate input */
for (uint8_t i = 0; i < num_stream; i++) {
for (size_t i = 0; i < num_stream; i++) {
if (streams[i].group != unicast_group) {
BT_DBG("stream[%u] group %p is not group %p",
BT_DBG("stream[%zu] group %p is not group %p",
i, streams[i].group, unicast_group);
return -EINVAL;
}
@ -1180,7 +1180,7 @@ int bt_audio_unicast_group_remove_streams(struct bt_audio_unicast_group *unicast
return -EBADMSG;
}
for (uint8_t i = 0; i < num_stream; i++) {
for (size_t i = 0; i < num_stream; i++) {
sys_slist_t *group_streams = &unicast_group->streams;
struct bt_audio_stream *stream = &streams[i];

View file

@ -620,10 +620,10 @@ static void unicast_client_ep_set_status(struct bt_audio_ep *ep,
static void unicast_client_codec_data_add(struct net_buf_simple *buf,
const char *prefix,
uint8_t num,
size_t num,
struct bt_codec_data *data)
{
for (uint8_t i = 0; i < num; i++) {
for (size_t i = 0; i < num; i++) {
struct bt_data *d = &data[i].data;
struct bt_ascs_codec_config *cc;
@ -1078,12 +1078,12 @@ int bt_unicast_client_ep_qos(struct bt_audio_ep *ep, struct net_buf_simple *buf,
static int unicast_client_ep_enable(struct bt_audio_ep *ep,
struct net_buf_simple *buf,
uint8_t meta_count,
size_t meta_count,
struct bt_codec_data *meta)
{
struct bt_ascs_metadata *req;
BT_DBG("ep %p buf %p metadata count %u", ep, buf, meta_count);
BT_DBG("ep %p buf %p metadata count %zu", ep, buf, meta_count);
if (!ep) {
return -EINVAL;
@ -1109,12 +1109,12 @@ static int unicast_client_ep_enable(struct bt_audio_ep *ep,
static int unicast_client_ep_metadata(struct bt_audio_ep *ep,
struct net_buf_simple *buf,
uint8_t meta_count,
size_t meta_count,
struct bt_codec_data *meta)
{
struct bt_ascs_metadata *req;
BT_DBG("ep %p buf %p metadata count %u", ep, buf, meta_count);
BT_DBG("ep %p buf %p metadata count %zu", ep, buf, meta_count);
if (!ep) {
return -EINVAL;
@ -1357,7 +1357,7 @@ int bt_unicast_client_config(struct bt_audio_stream *stream,
return 0;
}
int bt_unicast_client_enable(struct bt_audio_stream *stream, uint8_t meta_count,
int bt_unicast_client_enable(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta)
{
struct bt_audio_ep *ep = stream->ep;
@ -1381,7 +1381,7 @@ int bt_unicast_client_enable(struct bt_audio_stream *stream, uint8_t meta_count,
}
int bt_unicast_client_metadata(struct bt_audio_stream *stream,
uint8_t meta_count,
size_t meta_count,
struct bt_codec_data *meta)
{
struct bt_audio_ep *ep = stream->ep;

View file

@ -9,11 +9,11 @@
int bt_unicast_client_config(struct bt_audio_stream *stream,
struct bt_codec *codec);
int bt_unicast_client_enable(struct bt_audio_stream *stream, uint8_t meta_count,
int bt_unicast_client_enable(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta);
int bt_unicast_client_metadata(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta);
size_t meta_count, struct bt_codec_data *meta);
int bt_unicast_client_disable(struct bt_audio_stream *stream);

View file

@ -362,9 +362,9 @@ static int lc3_qos(struct bt_audio_stream *stream, struct bt_codec_qos *qos)
}
static int lc3_enable(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta)
size_t meta_count, struct bt_codec_data *meta)
{
shell_print(ctx_shell, "Enable: stream %p meta_count %u", stream,
shell_print(ctx_shell, "Enable: stream %p meta_count %zu", stream,
meta_count);
return 0;
@ -378,9 +378,9 @@ static int lc3_start(struct bt_audio_stream *stream)
}
static int lc3_metadata(struct bt_audio_stream *stream,
uint8_t meta_count, struct bt_codec_data *meta)
size_t meta_count, struct bt_codec_data *meta)
{
shell_print(ctx_shell, "Metadata: stream %p meta_count %u", stream,
shell_print(ctx_shell, "Metadata: stream %p meta_count %zu", stream,
meta_count);
return 0;

View file

@ -272,7 +272,7 @@ static int configure_stream(struct bt_audio_stream *stream,
static void test_main(void)
{
struct bt_audio_unicast_group *unicast_group;
uint8_t stream_cnt;
size_t stream_cnt;
int err;
init();
@ -292,7 +292,7 @@ static void test_main(void)
err = configure_stream(&g_streams[stream_cnt],
g_sinks[stream_cnt]);
if (err != 0) {
FAIL("Unable to configure stream[%u]: %d",
FAIL("Unable to configure stream[%zu]: %d",
stream_cnt, err);
return;
}

View file

@ -77,10 +77,10 @@ static int lc3_qos(struct bt_audio_stream *stream, struct bt_codec_qos *qos)
return 0;
}
static int lc3_enable(struct bt_audio_stream *stream, uint8_t meta_count,
static int lc3_enable(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta)
{
printk("Enable: stream %p meta_count %u\n", stream, meta_count);
printk("Enable: stream %p meta_count %zu\n", stream, meta_count);
return 0;
}
@ -92,10 +92,10 @@ static int lc3_start(struct bt_audio_stream *stream)
return 0;
}
static int lc3_metadata(struct bt_audio_stream *stream, uint8_t meta_count,
static int lc3_metadata(struct bt_audio_stream *stream, size_t meta_count,
struct bt_codec_data *meta)
{
printk("Metadata: stream %p meta_count %u\n", stream, meta_count);
printk("Metadata: stream %p meta_count %zu\n", stream, meta_count);
return 0;
}