Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions avl-cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "avl-cmp.h"
#include "blob.h"

static inline int _min(int v1, int v2)
static inline size_t _min(size_t v1, size_t v2)
{
return v1 < v2 ? v1 : v2;
}
Expand All @@ -31,7 +31,7 @@ avl_strcmp(const void *k1, const void *k2, void *ptr)
int
avl_blobcmp(const void *k1, const void *k2, void *ptr)
{
int len = _min(blob_raw_len(k1), blob_raw_len(k2));
size_t len = _min(blob_raw_len(k1), blob_raw_len(k2));

return memcmp(k1, k2, len);
}
4 changes: 2 additions & 2 deletions blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ void
blob_fill_pad(struct blob_attr *attr)
{
char *buf = (char *) attr;
int len = blob_pad_len(attr);
int delta = len - blob_raw_len(attr);
size_t len = blob_pad_len(attr);
size_t delta = len - blob_raw_len(attr);

if (delta > 0)
memset(buf + len - delta, 0, delta);
Expand Down
14 changes: 7 additions & 7 deletions blob.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ blob_data(const struct blob_attr *attr)
static inline unsigned int
blob_id(const struct blob_attr *attr)
{
int id = (be32_to_cpu(attr->id_len) & BLOB_ATTR_ID_MASK) >> BLOB_ATTR_ID_SHIFT;
unsigned int id = (be32_to_cpu(attr->id_len) & BLOB_ATTR_ID_MASK) >> BLOB_ATTR_ID_SHIFT;
return id;
}

Expand Down Expand Up @@ -117,8 +117,8 @@ blob_raw_len(const struct blob_attr *attr)
static inline size_t
blob_pad_len(const struct blob_attr *attr)
{
unsigned int len = blob_raw_len(attr);
len = (len + BLOB_ATTR_ALIGN - 1) & ~(BLOB_ATTR_ALIGN - 1);
size_t len = blob_raw_len(attr);
len = (len + BLOB_ATTR_ALIGN - 1) & ~(size_t)(BLOB_ATTR_ALIGN - 1);
return len;
}

Expand Down Expand Up @@ -154,25 +154,25 @@ blob_get_u64(const struct blob_attr *attr)
static inline int8_t
blob_get_int8(const struct blob_attr *attr)
{
return blob_get_u8(attr);
return (int8_t)blob_get_u8(attr);
}

static inline int16_t
blob_get_int16(const struct blob_attr *attr)
{
return blob_get_u16(attr);
return (int16_t)blob_get_u16(attr);
}

static inline int32_t
blob_get_int32(const struct blob_attr *attr)
{
return blob_get_u32(attr);
return (int32_t)blob_get_u32(attr);
}

static inline int64_t
blob_get_int64(const struct blob_attr *attr)
{
return blob_get_u64(attr);
return (int64_t)blob_get_u64(attr);
}

static inline const char *
Expand Down
8 changes: 4 additions & 4 deletions blobmsg_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool blobmsg_add_object(struct blob_buf *b, json_object *obj)

static bool blobmsg_add_array(struct blob_buf *b, struct array_list *a)
{
int i, len;
size_t i, len;

for (i = 0, len = array_list_length(a); i < len; i++) {
if (!blobmsg_add_json_element(b, NULL, array_list_get_idx(a, i)))
Expand Down Expand Up @@ -228,14 +228,14 @@ static void blobmsg_format_string(struct strbuf *s, const char *str)
blobmsg_puts(s, "\"", 1);
}

static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr *attr, int len, bool array);
static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr *attr, size_t len, bool array);

static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, bool without_name, bool head)
{
const char *data_str;
char buf[317];
void *data;
int len;
size_t len;

if (!blobmsg_check_attr(attr, false))
return;
Expand Down Expand Up @@ -289,7 +289,7 @@ static void blobmsg_format_element(struct strbuf *s, struct blob_attr *attr, boo
blobmsg_puts(s, data_str, strlen(data_str));
}

static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr *attr, int len, bool array)
static void blobmsg_format_json_list(struct strbuf *s, struct blob_attr *attr, size_t len, bool array)
{
struct blob_attr *pos;
bool first = true;
Expand Down
6 changes: 3 additions & 3 deletions jshn.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ static int add_json_object(json_object *obj)

static int add_json_array(struct array_list *a)
{
char seq[12];
int i, len;
char seq[21];
size_t i, len;
int ret;

for (i = 0, len = array_list_length(a); i < len; i++) {
snprintf(seq, sizeof(seq), "%d", i);
snprintf(seq, sizeof(seq), "%zu", i);
ret = add_json_element(seq, array_list_get_idx(a, i));
if (ret)
return ret;
Expand Down
2 changes: 1 addition & 1 deletion json_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ json_script_file_from_blobmsg(const char *name, void *data, int len)
{
struct json_script_file *f;
char *new_name;
int name_len = 0;
size_t name_len = 0;

if (name)
name_len = strlen(name) + 1;
Expand Down
6 changes: 3 additions & 3 deletions udebug-remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int udebug_remote_buf_map(struct udebug *ctx, struct udebug_remote_buf *rb, uint
return -1;
}

rb->pcap_iface = ~0;
rb->pcap_iface = ~0U;
rb->node.key = key;
avl_insert(&ctx->remote_rings, &rb->node);

Expand All @@ -82,7 +82,7 @@ void udebug_remote_buf_unmap(struct udebug *ctx, struct udebug_remote_buf *rb)
udebug_buf_free(&rb->buf);
rb->poll = 0;
rb->node.key = NULL;
rb->pcap_iface = ~0;
rb->pcap_iface = ~0U;
}

int udebug_remote_buf_set_poll(struct udebug *ctx, struct udebug_remote_buf *rb, bool val)
Expand Down Expand Up @@ -237,7 +237,7 @@ udebug_remote_buf_snapshot(struct udebug_remote_buf *rb)

s = calloc_a(sizeof(*s),
&ptr_buf, ptr_size * sizeof(*ptr_buf),
&data_buf, data_size);
&data_buf, (size_t)data_size);

s->data = memcpy(data_buf, udebug_buf_ptr(&rb->buf, data_start), data_size);
s->data_size = data_size;
Expand Down
2 changes: 1 addition & 1 deletion udebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ void udebug_entry_set_length(struct udebug_buf *buf, uint16_t len)
int udebug_entry_printf(struct udebug_buf *buf, const char *fmt, ...)
{
va_list ap;
size_t ret;
int ret;

va_start(ap, fmt);
ret = udebug_entry_vprintf(buf, fmt, ap);
Expand Down
Loading