[BLOBMSG_TYPE_TABLE] = "\"Table\"",
};
const char *type = NULL;
- int typeid;
+ size_t typeid;
if (blob_id(attr) != BLOBMSG_TYPE_INT32)
return NULL;
{
struct blob_attr *cur;
char *s;
- int rem;
+ size_t rem;
if (simple_output || !verbose) {
printf("%s\n", obj->path);
static int add_monitor_type(const char *type)
{
- int i;
+ size_t i;
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;
- char *cmd;
int ret = 0;
- int i, ch;
+ char *cmd;
+ size_t i;
+ int ch;
progname = argv[0];
{
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));
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;
- 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);
{
struct blob_attr *tb[__ACL_POLICY_MAX];
struct blob_attr *cur;
- int rem;
+ size_t rem;
if (acl_blob) {
struct acl_object *p, *q;
int len = 0;
do {
- int cur_len;
+ ssize_t cur_len;
if (sock_fd < 0) {
msghdr.msg_control = NULL;
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++;
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;
struct ubus_notify_request *nreq;
struct blob_attr **tb;
struct blob_attr *cur;
- int rem, idx = 1;
+ size_t rem;
+ int idx = 1;
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_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)
{
int rv;
int idx = 1;
- int rem = len;
+ size_t rem = len;
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 {
.msg_controllen = sizeof(fd_buf),
};
struct ubus_msghdr hdr;
- int ret;
+ ssize_t ret;
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)
{
- int written;
+ ssize_t written;
if (ub->hdr.type != UBUS_MSG_MONITOR)
ubusd_monitor_message(cl, ub, true);
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;
/* 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) {
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;
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)
if (!acl->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
continue;
}
case UBUS_ACL_ACCESS:
if (acl->methods) {
struct blob_attr *cur;
- int rem;
+ size_t rem;
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;
- int rem;
+ size_t rem;
blobmsg_parse(acl_policy, __ACL_MAX, tb, blob_data(file->blob),
blob_len(file->blob));
{
struct stat st;
glob_t gl;
- int j;
+ size_t j;
const char *suffix = "/*.json";
char *path = alloca(strlen(ubusd_acl_dir) + strlen(suffix) + 1);
if (!acl->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
continue;
}
if (!ev->partial)
continue;
- if (match_len != strlen(key))
+ if (match_len != (int) strlen(key))
continue;
}
{
struct ubus_object_type *type;
struct blob_attr *pos;
- int rem;
+ size_t rem;
type = calloc(1, sizeof(*type));
if (!type)