Skip to content

Commit 4ae867b

Browse files
ceolinfabiobaltieri
authored andcommitted
bt: audio: Use proper flexible array
0 length array is a GNU extension. Use proper C99 flexible array. Signed-off-by: Flavio Ceolin <[email protected]>
1 parent 39cf9bd commit 4ae867b

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

subsys/bluetooth/audio/ascs_internal.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@
3636
struct bt_ascs_ase_status {
3737
uint8_t id;
3838
uint8_t state;
39-
uint8_t params[0];
39+
uint8_t params[];
4040
} __packed;
4141

4242
struct bt_ascs_codec_config {
4343
uint8_t len;
4444
uint8_t type;
45-
uint8_t data[0];
45+
uint8_t data[];
4646
} __packed;
4747

4848
struct bt_ascs_codec {
@@ -66,7 +66,7 @@ struct bt_ascs_ase_status_config {
6666
struct bt_ascs_codec codec;
6767
uint8_t cc_len;
6868
/* LTV-formatted Codec-Specific Configuration */
69-
struct bt_ascs_codec_config cc[0];
69+
struct bt_ascs_codec_config cc[];
7070
} __packed;
7171

7272
/* ASE_State = 0x02 (QoS Configured), defined in Table 4.4. */
@@ -88,7 +88,7 @@ struct bt_ascs_ase_status_enable {
8888
uint8_t cig_id;
8989
uint8_t cis_id;
9090
uint8_t metadata_len;
91-
uint8_t metadata[0];
91+
uint8_t metadata[];
9292
} __packed;
9393

9494
/* ASE_Status = 0x04 (Streaming) defined in Table 4.5.
@@ -97,7 +97,7 @@ struct bt_ascs_ase_status_stream {
9797
uint8_t cig_id;
9898
uint8_t cis_id;
9999
uint8_t metadata_len;
100-
uint8_t metadata[0];
100+
uint8_t metadata[];
101101
} __packed;
102102

103103
/* ASE_Status = 0x05 (Disabling) as defined in Table 4.5.
@@ -106,14 +106,14 @@ struct bt_ascs_ase_status_disable {
106106
uint8_t cig_id;
107107
uint8_t cis_id;
108108
uint8_t metadata_len;
109-
uint8_t metadata[0];
109+
uint8_t metadata[];
110110
} __packed;
111111

112112
/* ASE Control Point Protocol */
113113
struct bt_ascs_ase_cp {
114114
/* Request/Notification opcode */
115115
uint8_t op;
116-
uint8_t pdu[0];
116+
uint8_t pdu[];
117117
} __packed;
118118

119119
/* Opcodes */
@@ -139,14 +139,14 @@ struct bt_ascs_config {
139139
/* Codec Specific Config Length */
140140
uint8_t cc_len;
141141
/* LTV-formatted Codec-Specific Configuration */
142-
struct bt_ascs_codec_config cc[0];
142+
struct bt_ascs_codec_config cc[];
143143
} __packed;
144144

145145
struct bt_ascs_config_op {
146146
/* Number of ASEs */
147147
uint8_t num_ases;
148148
/* Config Parameters */
149-
struct bt_ascs_config cfg[0];
149+
struct bt_ascs_config cfg[];
150150
} __packed;
151151

152152
#define BT_ASCS_QOS_OP 0x02
@@ -177,7 +177,7 @@ struct bt_ascs_qos_op {
177177
/* Number of ASEs */
178178
uint8_t num_ases;
179179
/* QoS Parameters */
180-
struct bt_ascs_qos qos[0];
180+
struct bt_ascs_qos qos[];
181181
} __packed;
182182

183183
#define BT_ASCS_ENABLE_OP 0x03
@@ -187,54 +187,54 @@ struct bt_ascs_metadata {
187187
/* Metadata length */
188188
uint8_t len;
189189
/* LTV-formatted Metadata */
190-
uint8_t data[0];
190+
uint8_t data[];
191191
} __packed;
192192

193193
struct bt_ascs_enable_op {
194194
/* Number of ASEs */
195195
uint8_t num_ases;
196196
/* Metadata */
197-
struct bt_ascs_metadata metadata[0];
197+
struct bt_ascs_metadata metadata[];
198198
} __packed;
199199

200200
#define BT_ASCS_START_OP 0x04
201201
struct bt_ascs_start_op {
202202
/* Number of ASEs */
203203
uint8_t num_ases;
204204
/* ASE IDs */
205-
uint8_t ase[0];
205+
uint8_t ase[];
206206
} __packed;
207207

208208
#define BT_ASCS_DISABLE_OP 0x05
209209
struct bt_ascs_disable_op {
210210
/* Number of ASEs */
211211
uint8_t num_ases;
212212
/* ASE IDs */
213-
uint8_t ase[0];
213+
uint8_t ase[];
214214
} __packed;
215215

216216
#define BT_ASCS_STOP_OP 0x06
217217
struct bt_ascs_stop_op {
218218
/* Number of ASEs */
219219
uint8_t num_ases;
220220
/* ASE IDs */
221-
uint8_t ase[0];
221+
uint8_t ase[];
222222
} __packed;
223223

224224
#define BT_ASCS_METADATA_OP 0x07
225225
struct bt_ascs_metadata_op {
226226
/* Number of ASEs */
227227
uint8_t num_ases;
228228
/* Metadata */
229-
struct bt_ascs_metadata metadata[0];
229+
struct bt_ascs_metadata metadata[];
230230
} __packed;
231231

232232
#define BT_ASCS_RELEASE_OP 0x08
233233
struct bt_ascs_release_op {
234234
/* Number of ASEs */
235235
uint8_t num_ases;
236236
/* Ase IDs */
237-
uint8_t ase[0];
237+
uint8_t ase[];
238238
} __packed;
239239

240240
struct bt_ascs_cp_ase_rsp {
@@ -252,7 +252,7 @@ struct bt_ascs_cp_rsp {
252252
/* Number of ASEs */
253253
uint8_t num_ase;
254254
/* ASE response */
255-
struct bt_ascs_cp_ase_rsp ase_rsp[0];
255+
struct bt_ascs_cp_ase_rsp ase_rsp[];
256256
} __packed;
257257

258258
static inline const char *bt_ascs_op_str(uint8_t op)

subsys/bluetooth/audio/bap_internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct bt_bap_bass_cp_scan_start {
5252
struct bt_bap_bass_cp_subgroup {
5353
uint32_t bis_sync;
5454
uint8_t metadata_len;
55-
uint8_t metadata[0];
55+
uint8_t metadata[];
5656
} __packed;
5757

5858
struct bt_bap_bass_cp_add_src {
@@ -63,7 +63,7 @@ struct bt_bap_bass_cp_add_src {
6363
uint8_t pa_sync;
6464
uint16_t pa_interval;
6565
uint8_t num_subgroups;
66-
struct bt_bap_bass_cp_subgroup subgroups[0];
66+
struct bt_bap_bass_cp_subgroup subgroups[];
6767
} __packed;
6868

6969
struct bt_bap_bass_cp_mod_src {
@@ -72,7 +72,7 @@ struct bt_bap_bass_cp_mod_src {
7272
uint8_t pa_sync;
7373
uint16_t pa_interval;
7474
uint8_t num_subgroups;
75-
struct bt_bap_bass_cp_subgroup subgroups[0];
75+
struct bt_bap_bass_cp_subgroup subgroups[];
7676
} __packed;
7777

7878
struct bt_bap_bass_cp_broadcase_code {

0 commit comments

Comments
 (0)