diff options
author | Petr Štetiar <ynezz@true.cz> | 2019-12-11 10:36:36 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-12-16 23:39:16 +0100 |
commit | d2e026a33df81f116ceb2567056346f38d139706 (patch) | |
tree | 8f4631fb72aed09dad0d2f5be15b61d8dbf64e99 /ubusd.c | |
parent | 5d7ca8309d0a1614d829df9ecd72553bcd6b5ec6 (diff) | |
download | ubus-d2e026a33df81f116ceb2567056346f38d139706.tar.gz |
iron out all extra compiler warnings
clang-9 on x86/64 has reported following warnings/errors:
libubus-acl.c:123:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
libubus-io.c:108:18: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
libubus-io.c:395:56: error: comparison of integers of different signs: 'ssize_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
libubus-req.c:441:4: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:119:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd_acl.c:152:5: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:348:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:352:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:357:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:362:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:367:3: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
ubusd_acl.c:447:16: error: comparison of integers of different signs: 'int' and '__size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
ubusd_acl.c:502:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd.c:123:13: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd.c:170:15: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd.c:262:43: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd.c:287:30: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd_event.c:170:18: error: comparison of integers of different signs: 'int' and 'unsigned long' [-Werror,-Wsign-compare]
ubusd_obj.c:71:2: error: comparison of integers of different signs: 'size_t' (aka 'unsigned long') and 'int' [-Werror,-Wsign-compare]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'ubusd.c')
-rw-r--r-- | ubusd.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -92,7 +92,7 @@ void ubus_msg_free(struct ubus_msg_buf *ub) } } -static int ubus_msg_writev(int fd, struct ubus_msg_buf *ub, int offset) +static ssize_t ubus_msg_writev(int fd, struct ubus_msg_buf *ub, size_t offset) { static struct iovec iov[2]; static struct { @@ -112,7 +112,7 @@ static int ubus_msg_writev(int fd, struct ubus_msg_buf *ub, int offset) .msg_controllen = sizeof(fd_buf), }; struct ubus_msghdr hdr; - int ret; + ssize_t ret; fd_buf.fd = ub->fd; if (ub->fd < 0 || offset) { @@ -156,7 +156,7 @@ static void ubus_msg_enqueue(struct ubus_client *cl, struct ubus_msg_buf *ub) /* takes the msgbuf reference */ void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub) { - int written; + ssize_t written; if (ub->hdr.type != UBUS_MSG_MONITOR) ubusd_monitor_message(cl, ub, true); @@ -167,7 +167,7 @@ void ubus_msg_send(struct ubus_client *cl, struct ubus_msg_buf *ub) if (written < 0) written = 0; - if (written >= ub->len + sizeof(ub->hdr)) + if (written >= (ssize_t) (ub->len + sizeof(ub->hdr))) return; cl->txq_ofs = written; @@ -232,7 +232,7 @@ static void client_cb(struct uloop_fd *sock, unsigned int events) /* first try to tx more pending data */ while ((ub = ubus_msg_head(cl))) { - int written; + ssize_t written; written = ubus_msg_writev(sock->fd, ub, cl->txq_ofs); if (written < 0) { @@ -259,7 +259,7 @@ static void client_cb(struct uloop_fd *sock, unsigned int events) uloop_fd_add(sock, ULOOP_READ | ULOOP_EDGE_TRIGGER); retry: - if (!sock->eof && cl->pending_msg_offset < sizeof(cl->hdrbuf)) { + if (!sock->eof && cl->pending_msg_offset < (int) sizeof(cl->hdrbuf)) { int offset = cl->pending_msg_offset; int bytes; @@ -284,7 +284,7 @@ retry: cl->pending_msg_fd = fd_buf.fd; cl->pending_msg_offset += bytes; - if (cl->pending_msg_offset < sizeof(cl->hdrbuf)) + if (cl->pending_msg_offset < (int) sizeof(cl->hdrbuf)) goto out; if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN) |