@@ -184,13 +184,17 @@ struct getcap_resp {
} __attribute__ ((packed));
struct start_req {
- struct seid first_seid;
- struct seid other_seids[0];
+ union {
+ struct seid required[1];
+ struct seid seids[0];
+ };
} __attribute__ ((packed));
struct suspend_req {
- struct seid first_seid;
- struct seid other_seids[0];
+ union {
+ struct seid required[1];
+ struct seid seids[0];
+ };
} __attribute__ ((packed));
struct seid_rej {
@@ -1672,12 +1676,12 @@ static void check_seid_collision(struct pending_req *req, uint8_t id)
static void check_start_collision(struct pending_req *req, uint8_t id)
{
struct start_req *start = req->data;
- struct seid *seid = &start->first_seid;
int count = 1 + req->data_size - sizeof(struct start_req);
int i;
- for (i = 0; i < count; i++, seid++) {
- if (seid->seid == id) {
+ for (i = 0; i < count; i++) {
+ struct seid seid = start->seids[i];
+ if (seid.seid == id) {
req->collided = TRUE;
return;
}
@@ -1687,12 +1691,12 @@ static void check_start_collision(struct pending_req *req, uint8_t id)
static void check_suspend_collision(struct pending_req *req, uint8_t id)
{
struct suspend_req *suspend = req->data;
- struct seid *seid = &suspend->first_seid;
int count = 1 + req->data_size - sizeof(struct suspend_req);
int i;
- for (i = 0; i < count; i++, seid++) {
- if (seid->seid == id) {
+ for (i = 0; i < count; i++) {
+ struct seid seid = suspend->seids[i];
+ if (seid.seid == id) {
req->collided = TRUE;
return;
}
@@ -1785,7 +1789,6 @@ static gboolean avdtp_start_cmd(struct avdtp *session, uint8_t transaction,
struct avdtp_local_sep *sep;
struct avdtp_stream *stream;
struct stream_rej rej;
- struct seid *seid;
uint8_t err, failed_seid;
int seid_count, i;
@@ -1796,12 +1799,12 @@ static gboolean avdtp_start_cmd(struct avdtp *session, uint8_t transaction,
seid_count = 1 + size - sizeof(struct start_req);
- seid = &req->first_seid;
+ for (i = 0; i < seid_count; i++) {
+ struct seid seid = req->seids[i];
- for (i = 0; i < seid_count; i++, seid++) {
- failed_seid = seid->seid;
+ failed_seid = seid.seid;
- sep = find_local_sep_by_seid(session, seid->seid);
+ sep = find_local_sep_by_seid(session, seid.seid);
if (!sep || !sep->stream) {
err = AVDTP_BAD_ACP_SEID;
goto failed;
@@ -1898,7 +1901,6 @@ static gboolean avdtp_suspend_cmd(struct avdtp *session, uint8_t transaction,
struct avdtp_local_sep *sep;
struct avdtp_stream *stream;
struct stream_rej rej;
- struct seid *seid;
uint8_t err, failed_seid;
int seid_count, i;
@@ -1909,12 +1911,11 @@ static gboolean avdtp_suspend_cmd(struct avdtp *session, uint8_t transaction,
seid_count = 1 + size - sizeof(struct suspend_req);
- seid = &req->first_seid;
+ for (i = 0; i < seid_count; i++) {
+ struct seid seid = req->seids[i];
+ failed_seid = seid.seid;
- for (i = 0; i < seid_count; i++, seid++) {
- failed_seid = seid->seid;
-
- sep = find_local_sep_by_seid(session, seid->seid);
+ sep = find_local_sep_by_seid(session, seid.seid);
if (!sep || !sep->stream) {
err = AVDTP_BAD_ACP_SEID;
goto failed;
@@ -3663,7 +3664,7 @@ int avdtp_start(struct avdtp *session, struct avdtp_stream *stream)
}
memset(&req, 0, sizeof(req));
- req.first_seid.seid = stream->rseid;
+ req.required->seid = stream->rseid;
ret = send_request(session, FALSE, stream, AVDTP_START,
&req, sizeof(req));