From 4cafc1402997b570a66ed17400e8be4da6de4224 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 8 Jul 2015 12:36:35 +0200 Subject: [PATCH] Fix -Wsign-conversion warnings. --- src/daemon/common.c | 12 ++++++------ src/libcollectdclient/network.c | 4 ++-- src/liboconfig/oconfig.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/daemon/common.c b/src/daemon/common.c index 92950ded..068b9999 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -257,8 +257,8 @@ ssize_t sread (int fd, void *buf, size_t count) assert ((0 > status) || (nleft >= (size_t)status)); - nleft = nleft - status; - ptr = ptr + status; + nleft = nleft - ((size_t) status); + ptr = ptr + ((size_t) status); } return (0); @@ -284,8 +284,8 @@ ssize_t swrite (int fd, const void *buf, size_t count) if (status < 0) return (status); - nleft = nleft - status; - ptr = ptr + status; + nleft = nleft - ((size_t) status); + ptr = ptr + ((size_t) status); } return (0); @@ -665,8 +665,8 @@ int check_create_dir (const char *file_orig) * Join the components together again */ dir[0] = '/'; - if (strjoin (dir + path_is_absolute, dir_len - path_is_absolute, - fields, i + 1, "/") < 0) + if (strjoin (dir + path_is_absolute, (size_t) (dir_len - path_is_absolute), + fields, (size_t) (i + 1), "/") < 0) { ERROR ("strjoin failed: `%s', component #%i", file_orig, i); return (-1); diff --git a/src/libcollectdclient/network.c b/src/libcollectdclient/network.c index c390a1ce..f76be5ba 100644 --- a/src/libcollectdclient/network.c +++ b/src/libcollectdclient/network.c @@ -393,7 +393,7 @@ int lcc_server_set_ttl (lcc_server_t *srv, uint8_t ttl) /* {{{ */ int lcc_server_set_interface (lcc_server_t *srv, char const *interface) /* {{{ */ { - int if_index; + unsigned int if_index; int status; if ((srv == NULL) || (interface == NULL)) @@ -421,7 +421,7 @@ int lcc_server_set_interface (lcc_server_t *srv, char const *interface) /* {{{ * memset (&mreq, 0, sizeof (mreq)); mreq.imr_multiaddr.s_addr = addr->sin_addr.s_addr; mreq.imr_address.s_addr = ntohl (INADDR_ANY); - mreq.imr_ifindex = if_index; + mreq.imr_ifindex = (int) if_index; #else struct ip_mreq mreq; diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index f422f5ad..ba93062c 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -131,8 +131,8 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) { int i; - ci_copy->values = (oconfig_value_t *) calloc (ci_orig->values_num, - sizeof (*ci_copy->values)); + ci_copy->values = (oconfig_value_t *) calloc ((size_t) ci_orig->values_num, + sizeof (*ci_copy->values)); if (ci_copy->values == NULL) { fprintf (stderr, "calloc failed.\n"); @@ -167,8 +167,8 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) { int i; - ci_copy->children = (oconfig_item_t *) calloc (ci_orig->children_num, - sizeof (*ci_copy->children)); + ci_copy->children = (oconfig_item_t *) calloc ((size_t) ci_orig->children_num, + sizeof (*ci_copy->children)); if (ci_copy->children == NULL) { fprintf (stderr, "calloc failed.\n"); -- 2.30.2