summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5d7ca83)
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>
[BLOBMSG_TYPE_TABLE] = "\"Table\"",
};
const char *type = NULL;
[BLOBMSG_TYPE_TABLE] = "\"Table\"",
};
const char *type = NULL;
if (blob_id(attr) != BLOBMSG_TYPE_INT32)
return NULL;
if (blob_id(attr) != BLOBMSG_TYPE_INT32)
return NULL;
{
struct blob_attr *cur;
char *s;
{
struct blob_attr *cur;
char *s;
if (simple_output || !verbose) {
printf("%s\n", obj->path);
if (simple_output || !verbose) {
printf("%s\n", obj->path);
static int add_monitor_type(const char *type)
{
static int add_monitor_type(const char *type)
{
for (i = 0; i < ARRAY_SIZE(monitor_types); i++) {
if (!monitor_types[i] || strcmp(monitor_types[i], type) != 0)
for (i = 0; i < ARRAY_SIZE(monitor_types); i++) {
if (!monitor_types[i] || strcmp(monitor_types[i], type) != 0)
{
const char *progname, *ubus_socket = NULL;
struct ubus_context *ctx;
{
const char *progname, *ubus_socket = NULL;
struct ubus_context *ctx;
+ char *cmd;
+ size_t i;
+ int ch;
{
struct hello_request *hreq;
struct blob_attr *tb[__HELLO_MAX];
{
struct hello_request *hreq;
struct blob_attr *tb[__HELLO_MAX];
- const char *format = "%s received a message: %s";
+ const char format[] = "%s received a message: %s";
const char *msgstr = "(unknown)";
blobmsg_parse(hello_policy, ARRAY_SIZE(hello_policy), tb, blob_data(msg), blob_len(msg));
const char *msgstr = "(unknown)";
blobmsg_parse(hello_policy, ARRAY_SIZE(hello_policy), tb, blob_data(msg), blob_len(msg));
if (tb[HELLO_MSG])
msgstr = blobmsg_data(tb[HELLO_MSG]);
if (tb[HELLO_MSG])
msgstr = blobmsg_data(tb[HELLO_MSG]);
- hreq = calloc(1, sizeof(*hreq) + strlen(format) + strlen(obj->name) + strlen(msgstr) + 1);
+ size_t len = sizeof(*hreq) + sizeof(format) + strlen(obj->name) + strlen(msgstr) + 1;
+ hreq = calloc(1, len);
if (!hreq)
return UBUS_STATUS_UNKNOWN_ERROR;
if (!hreq)
return UBUS_STATUS_UNKNOWN_ERROR;
- sprintf(hreq->data, format, obj->name, msgstr);
+ snprintf(hreq->data, len, format, obj->name, msgstr);
ubus_defer_request(ctx, req, &hreq->req);
hreq->timeout.cb = test_hello_reply;
uloop_timeout_set(&hreq->timeout, 1000);
ubus_defer_request(ctx, req, &hreq->req);
hreq->timeout.cb = test_hello_reply;
uloop_timeout_set(&hreq->timeout, 1000);
{
struct blob_attr *tb[__ACL_POLICY_MAX];
struct blob_attr *cur;
{
struct blob_attr *tb[__ACL_POLICY_MAX];
struct blob_attr *cur;
if (acl_blob) {
struct acl_object *p, *q;
if (acl_blob) {
struct acl_object *p, *q;
if (sock_fd < 0) {
msghdr.msg_control = NULL;
if (sock_fd < 0) {
msghdr.msg_control = NULL;
sock_fd = -1;
len += cur_len;
sock_fd = -1;
len += cur_len;
- while (cur_len >= iov->iov_len) {
+ while (cur_len >= (ssize_t) iov->iov_len) {
cur_len -= iov->iov_len;
iov_len--;
iov++;
cur_len -= iov->iov_len;
iov_len--;
iov++;
goto out_close;
memcpy(buf, &hdr.data, sizeof(hdr.data));
goto out_close;
memcpy(buf, &hdr.data, sizeof(hdr.data));
- if (read(ctx->sock.fd, blob_data(buf), blob_len(buf)) != blob_len(buf))
+ if (read(ctx->sock.fd, blob_data(buf), blob_len(buf)) != (ssize_t) blob_len(buf))
goto out_free;
ctx->local_id = hdr.hdr.peer;
goto out_free;
ctx->local_id = hdr.hdr.peer;
struct ubus_notify_request *nreq;
struct blob_attr **tb;
struct blob_attr *cur;
struct ubus_notify_request *nreq;
struct blob_attr **tb;
struct blob_attr *cur;
+ size_t rem;
+ int idx = 1;
int ret = 0;
nreq = container_of(req, struct ubus_notify_request, req);
int ret = 0;
nreq = container_of(req, struct ubus_notify_request, req);
ubus_lua_parse_blob(lua_State *L, struct blob_attr *attr, bool table);
static int
ubus_lua_parse_blob(lua_State *L, struct blob_attr *attr, bool table);
static int
-ubus_lua_parse_blob_array(lua_State *L, struct blob_attr *attr, int len, bool table)
+ubus_lua_parse_blob_array(lua_State *L, struct blob_attr *attr, size_t len, bool table)
struct blob_attr *pos;
lua_newtable(L);
struct blob_attr *pos;
lua_newtable(L);
-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 {
{
static struct iovec iov[2];
static struct {
.msg_controllen = sizeof(fd_buf),
};
struct ubus_msghdr hdr;
.msg_controllen = sizeof(fd_buf),
};
struct ubus_msghdr hdr;
fd_buf.fd = ub->fd;
if (ub->fd < 0 || offset) {
fd_buf.fd = ub->fd;
if (ub->fd < 0 || offset) {
/* takes the msgbuf reference */
void ubus_msg_send(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)
{
if (ub->hdr.type != UBUS_MSG_MONITOR)
ubusd_monitor_message(cl, ub, true);
if (ub->hdr.type != UBUS_MSG_MONITOR)
ubusd_monitor_message(cl, ub, true);
if (written < 0)
written = 0;
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;
return;
cl->txq_ofs = written;
/* first try to tx more pending data */
while ((ub = ubus_msg_head(cl))) {
/* first try to tx more pending data */
while ((ub = ubus_msg_head(cl))) {
written = ubus_msg_writev(sock->fd, ub, cl->txq_ofs);
if (written < 0) {
written = ubus_msg_writev(sock->fd, ub, cl->txq_ofs);
if (written < 0) {
uloop_fd_add(sock, ULOOP_READ | ULOOP_EDGE_TRIGGER);
retry:
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;
int offset = cl->pending_msg_offset;
int bytes;
cl->pending_msg_fd = fd_buf.fd;
cl->pending_msg_offset += bytes;
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)
goto out;
if (blob_pad_len(&cl->hdrbuf.data) > UBUS_MAX_MSGLEN)
if (!acl->partial)
continue;
if (!acl->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
case UBUS_ACL_ACCESS:
if (acl->methods) {
struct blob_attr *cur;
case UBUS_ACL_ACCESS:
if (acl->methods) {
struct blob_attr *cur;
blobmsg_for_each_attr(cur, acl->methods, rem)
if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING)
blobmsg_for_each_attr(cur, acl->methods, rem)
if (blobmsg_type(cur) == BLOBMSG_TYPE_STRING)
ubusd_acl_file_add(struct ubusd_acl_file *file)
{
struct blob_attr *tb[__ACL_MAX], *cur;
ubusd_acl_file_add(struct ubusd_acl_file *file)
{
struct blob_attr *tb[__ACL_MAX], *cur;
blobmsg_parse(acl_policy, __ACL_MAX, tb, blob_data(file->blob),
blob_len(file->blob));
blobmsg_parse(acl_policy, __ACL_MAX, tb, blob_data(file->blob),
blob_len(file->blob));
{
struct stat st;
glob_t gl;
{
struct stat st;
glob_t gl;
const char *suffix = "/*.json";
char *path = alloca(strlen(ubusd_acl_dir) + strlen(suffix) + 1);
const char *suffix = "/*.json";
char *path = alloca(strlen(ubusd_acl_dir) + strlen(suffix) + 1);
if (!acl->partial)
continue;
if (!acl->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
if (!ev->partial)
continue;
if (!ev->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
{
struct ubus_object_type *type;
struct blob_attr *pos;
{
struct ubus_object_type *type;
struct blob_attr *pos;
type = calloc(1, sizeof(*type));
if (!type)
type = calloc(1, sizeof(*type));
if (!type)