Bluetooth: Use 'void *' also for bt_buf_pull/push return value
To make the bt_buf APIs consistent with the recent bt_but_add changes and more user friendly, change the pull() and push() return values also to 'void *'. Change-Id: I25242635c87882db99152735c22316d4de00d363 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
90b27c478d
commit
19707e8257
4 changed files with 8 additions and 8 deletions
|
@ -101,10 +101,10 @@ struct bt_buf *bt_buf_hold(struct bt_buf *buf);
|
||||||
void *bt_buf_add(struct bt_buf *buf, size_t len);
|
void *bt_buf_add(struct bt_buf *buf, size_t len);
|
||||||
|
|
||||||
/* Push data to the beginning of the buffer */
|
/* Push data to the beginning of the buffer */
|
||||||
uint8_t *bt_buf_push(struct bt_buf *buf, size_t len);
|
void *bt_buf_push(struct bt_buf *buf, size_t len);
|
||||||
|
|
||||||
/* Remove data from the beginning of the buffer */
|
/* Remove data from the beginning of the buffer */
|
||||||
uint8_t *bt_buf_pull(struct bt_buf *buf, size_t len);
|
void *bt_buf_pull(struct bt_buf *buf, size_t len);
|
||||||
|
|
||||||
/* Remove and convert 16 bits from the beginning of the buffer */
|
/* Remove and convert 16 bits from the beginning of the buffer */
|
||||||
uint16_t bt_buf_pull_le16(struct bt_buf *buf);
|
uint16_t bt_buf_pull_le16(struct bt_buf *buf);
|
||||||
|
|
|
@ -160,7 +160,7 @@ void *bt_buf_add(struct bt_buf *buf, size_t len)
|
||||||
return tail;
|
return tail;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *bt_buf_push(struct bt_buf *buf, size_t len)
|
void *bt_buf_push(struct bt_buf *buf, size_t len)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_BLUETOOTH_DEBUG_BUF)
|
#if defined(CONFIG_BLUETOOTH_DEBUG_BUF)
|
||||||
if (bt_buf_headroom(buf) < len) {
|
if (bt_buf_headroom(buf) < len) {
|
||||||
|
@ -173,7 +173,7 @@ uint8_t *bt_buf_push(struct bt_buf *buf, size_t len)
|
||||||
return buf->data;
|
return buf->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *bt_buf_pull(struct bt_buf *buf, size_t len)
|
void *bt_buf_pull(struct bt_buf *buf, size_t len)
|
||||||
{
|
{
|
||||||
#if defined(CONFIG_BLUETOOTH_DEBUG_BUF)
|
#if defined(CONFIG_BLUETOOTH_DEBUG_BUF)
|
||||||
if (buf->len < len) {
|
if (buf->len < len) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ void bt_conn_send(struct bt_conn *conn, struct bt_buf *buf)
|
||||||
|
|
||||||
len = min(remaining, dev->le_mtu);
|
len = min(remaining, dev->le_mtu);
|
||||||
|
|
||||||
hdr = (void *)bt_buf_push(buf, sizeof(*hdr));
|
hdr = bt_buf_push(buf, sizeof(*hdr));
|
||||||
hdr->handle = sys_cpu_to_le16(conn->handle);
|
hdr->handle = sys_cpu_to_le16(conn->handle);
|
||||||
hdr->len = sys_cpu_to_le16(len);
|
hdr->len = sys_cpu_to_le16(len);
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void bt_conn_send(struct bt_conn *conn, struct bt_buf *buf)
|
||||||
memcpy(bt_buf_add(buf, len), ptr, len);
|
memcpy(bt_buf_add(buf, len), ptr, len);
|
||||||
ptr += len;
|
ptr += len;
|
||||||
|
|
||||||
hdr = (void *)bt_buf_push(buf, sizeof(*hdr));
|
hdr = bt_buf_push(buf, sizeof(*hdr));
|
||||||
hdr->handle = sys_cpu_to_le16(conn->handle | (1 << 12));
|
hdr->handle = sys_cpu_to_le16(conn->handle | (1 << 12));
|
||||||
hdr->len = sys_cpu_to_le16(len);
|
hdr->len = sys_cpu_to_le16(len);
|
||||||
|
|
||||||
|
|
|
@ -375,8 +375,8 @@ static void le_adv_report(struct bt_buf *buf)
|
||||||
/* Get next report iteration by moving pointer to right offset
|
/* Get next report iteration by moving pointer to right offset
|
||||||
* in buf according to spec 4.2, Vol 2, Part E, 7.7.65.2.
|
* in buf according to spec 4.2, Vol 2, Part E, 7.7.65.2.
|
||||||
*/
|
*/
|
||||||
info = (void *)bt_buf_pull(buf, sizeof(*info) + info->length +
|
info = bt_buf_pull(buf, sizeof(*info) + info->length +
|
||||||
sizeof(rssi));
|
sizeof(rssi));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue