net: buf: Use size_t instead of u16_t for lengths in public API

Even though the net_buf implementation may (and does currently)
internally use u16_t for lengths, keep the public facing API
consistent by using size_t.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-09-11 12:55:21 +03:00 committed by Johan Hedberg
parent c90549c474
commit b088a09235
2 changed files with 12 additions and 12 deletions

View file

@ -1314,7 +1314,7 @@ struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag);
* @return -ENOMEM on error
*/
int net_buf_linearize(void *dst, size_t dst_len,
struct net_buf *src, u16_t offset, u16_t len);
struct net_buf *src, size_t offset, size_t len);
/**
* @typedef net_buf_allocator_cb
@ -1352,7 +1352,7 @@ typedef struct net_buf *(*net_buf_allocator_cb)(s32_t timeout, void *user_data);
* length if other timeout than K_FOREVER was used, and there
* were no free fragments in a pool to accommodate all data.
*/
u16_t net_buf_append_bytes(struct net_buf *buf, u16_t len,
size_t net_buf_append_bytes(struct net_buf *buf, size_t len,
const void *value, s32_t timeout,
net_buf_allocator_cb allocate_cb, void *user_data);
@ -1371,7 +1371,7 @@ u16_t net_buf_append_bytes(struct net_buf *buf, u16_t len,
* NULL and pos is 0 after successful skip,
* NULL and pos is 0xffff otherwise.
*/
static inline struct net_buf *net_buf_skip(struct net_buf *buf, u16_t len)
static inline struct net_buf *net_buf_skip(struct net_buf *buf, size_t len)
{
while (buf && len--) {
net_buf_pull_u8(buf);

View file

@ -673,11 +673,11 @@ struct net_buf *net_buf_frag_del(struct net_buf *parent, struct net_buf *frag)
}
int net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src,
u16_t offset, u16_t len)
size_t offset, size_t len)
{
struct net_buf *frag;
u16_t to_copy;
u16_t copied;
size_t to_copy;
size_t copied;
if (dst_len < (size_t)len) {
return -ENOMEM;
@ -721,12 +721,12 @@ int net_buf_linearize(void *dst, size_t dst_len, struct net_buf *src,
* the data in current fragment then create new fragment and add it to
* the buffer. It assumes that the buffer has at least one fragment.
*/
u16_t net_buf_append_bytes(struct net_buf *buf, u16_t len,
size_t net_buf_append_bytes(struct net_buf *buf, size_t len,
const void *value, s32_t timeout,
net_buf_allocator_cb allocate_cb, void *user_data)
{
struct net_buf *frag = net_buf_frag_last(buf);
u16_t added_len = 0;
size_t added_len = 0;
do {
u16_t count = min(len, net_buf_tailroom(frag));