blobmsg: make length variables unsigned

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
Felix Fietkau 2014-04-27 16:32:09 +02:00
parent aa01be8ed0
commit d07b174de8
2 changed files with 11 additions and 11 deletions

View file

@ -91,7 +91,7 @@ bool blobmsg_check_attr_list(const struct blob_attr *attr, int type)
} }
int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len, int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len,
struct blob_attr **tb, void *data, int len) struct blob_attr **tb, void *data, unsigned int len)
{ {
struct blob_attr *attr; struct blob_attr *attr;
int i = 0; int i = 0;
@ -118,7 +118,7 @@ int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len,
int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len,
struct blob_attr **tb, void *data, int len) struct blob_attr **tb, void *data, unsigned int len)
{ {
struct blobmsg_hdr *hdr; struct blobmsg_hdr *hdr;
struct blob_attr *attr; struct blob_attr *attr;
@ -243,7 +243,7 @@ blobmsg_printf(struct blob_buf *buf, const char *name, const char *format, ...)
} }
void * void *
blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen) blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, unsigned int maxlen)
{ {
struct blob_attr *attr; struct blob_attr *attr;
void *data_dest; void *data_dest;
@ -260,7 +260,7 @@ blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen)
} }
void * void *
blobmsg_realloc_string_buffer(struct blob_buf *buf, int maxlen) blobmsg_realloc_string_buffer(struct blob_buf *buf, unsigned int maxlen)
{ {
struct blob_attr *attr = blob_next(buf->head); struct blob_attr *attr = blob_next(buf->head);
int offset = attr_to_offset(buf, blob_next(buf->head)) + blob_pad_len(attr) - BLOB_COOKIE; int offset = attr_to_offset(buf, blob_next(buf->head)) + blob_pad_len(attr) - BLOB_COOKIE;
@ -294,7 +294,7 @@ blobmsg_add_string_buffer(struct blob_buf *buf)
int int
blobmsg_add_field(struct blob_buf *buf, int type, const char *name, blobmsg_add_field(struct blob_buf *buf, int type, const char *name,
const void *data, int len) const void *data, unsigned int len)
{ {
struct blob_attr *attr; struct blob_attr *attr;
void *data_dest; void *data_dest;

View file

@ -46,7 +46,7 @@ struct blobmsg_policy {
enum blobmsg_type type; enum blobmsg_type type;
}; };
static inline int blobmsg_hdrlen(int namelen) static inline int blobmsg_hdrlen(unsigned int namelen)
{ {
return BLOBMSG_PADDING(sizeof(struct blobmsg_hdr) + namelen + 1); return BLOBMSG_PADDING(sizeof(struct blobmsg_hdr) + namelen + 1);
} }
@ -91,12 +91,12 @@ static inline int blobmsg_len(const struct blob_attr *attr)
bool blobmsg_check_attr(const struct blob_attr *attr, bool name); bool blobmsg_check_attr(const struct blob_attr *attr, bool name);
bool blobmsg_check_attr_list(const struct blob_attr *attr, int type); bool blobmsg_check_attr_list(const struct blob_attr *attr, int type);
int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len, int blobmsg_parse(const struct blobmsg_policy *policy, int policy_len,
struct blob_attr **tb, void *data, int len); struct blob_attr **tb, void *data, unsigned int len);
int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len, int blobmsg_parse_array(const struct blobmsg_policy *policy, int policy_len,
struct blob_attr **tb, void *data, int len); struct blob_attr **tb, void *data, unsigned int len);
int blobmsg_add_field(struct blob_buf *buf, int type, const char *name, int blobmsg_add_field(struct blob_buf *buf, int type, const char *name,
const void *data, int len); const void *data, unsigned int len);
static inline int static inline int
blobmsg_add_u8(struct blob_buf *buf, const char *name, uint8_t val) blobmsg_add_u8(struct blob_buf *buf, const char *name, uint8_t val)
@ -202,8 +202,8 @@ static inline char *blobmsg_get_string(struct blob_attr *attr)
return blobmsg_data(attr); return blobmsg_data(attr);
} }
void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen); void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, unsigned int maxlen);
void *blobmsg_realloc_string_buffer(struct blob_buf *buf, int maxlen); void *blobmsg_realloc_string_buffer(struct blob_buf *buf, unsigned int maxlen);
void blobmsg_add_string_buffer(struct blob_buf *buf); void blobmsg_add_string_buffer(struct blob_buf *buf);
void blobmsg_vprintf(struct blob_buf *buf, const char *name, const char *format, va_list arg); void blobmsg_vprintf(struct blob_buf *buf, const char *name, const char *format, va_list arg);