socket, select: Fix -Wsign-compare warnings

Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871
This commit is contained in:
Harald Welte 2022-01-09 12:03:12 +01:00
parent cd58e1e8e7
commit 0b08d518f2
2 changed files with 6 additions and 5 deletions

View File

@ -316,7 +316,7 @@ static unsigned int poll_fill_fds(void)
} }
/* iterate over first n_fd entries of g_poll.poll + dispatch */ /* iterate over first n_fd entries of g_poll.poll + dispatch */
static int poll_disp_fds(int n_fd) static int poll_disp_fds(unsigned int n_fd)
{ {
struct osmo_fd *ufd; struct osmo_fd *ufd;
unsigned int i; unsigned int i;

View File

@ -114,7 +114,7 @@ static struct addrinfo *addrinfo_helper(uint16_t family, uint16_t type, uint8_t
static int addrinfo_helper_multi(struct addrinfo **addrinfo, uint16_t family, uint16_t type, uint8_t proto, static int addrinfo_helper_multi(struct addrinfo **addrinfo, uint16_t family, uint16_t type, uint8_t proto,
const char **hosts, size_t host_cnt, uint16_t port, bool passive) const char **hosts, size_t host_cnt, uint16_t port, bool passive)
{ {
int i, j; unsigned int i, j;
for (i = 0; i < host_cnt; i++) { for (i = 0; i < host_cnt; i++) {
addrinfo[i] = addrinfo_helper(family, type, proto, hosts[i], port, passive); addrinfo[i] = addrinfo_helper(family, type, proto, hosts[i], port, passive);
@ -210,7 +210,8 @@ static int socket_helper_osa(const struct osmo_sockaddr *addr, uint16_t type, ui
static int multiaddr_snprintf(char* buf, size_t buf_len, const char **hosts, size_t host_cnt) static int multiaddr_snprintf(char* buf, size_t buf_len, const char **hosts, size_t host_cnt)
{ {
int len = 0, offset = 0, rem = buf_len; int len = 0, offset = 0, rem = buf_len;
int ret, i; size_t i;
int ret;
char *after; char *after;
if (buf_len < 3) if (buf_len < 3)
@ -665,7 +666,7 @@ static int socket_helper_multiaddr(uint16_t family, uint16_t type, uint8_t proto
/* Build array of addresses taking first addrinfo result of the requested family /* Build array of addresses taking first addrinfo result of the requested family
* for each host in addrs_buf. */ * for each host in addrs_buf. */
static int addrinfo_to_sockaddr(uint16_t family, const struct addrinfo **result, static int addrinfo_to_sockaddr(uint16_t family, const struct addrinfo **result,
const char **hosts, int host_cont, const char **hosts, unsigned int host_cont,
uint8_t *addrs_buf, size_t addrs_buf_len) { uint8_t *addrs_buf, size_t addrs_buf_len) {
size_t host_idx, offset = 0; size_t host_idx, offset = 0;
const struct addrinfo *rp; const struct addrinfo *rp;
@ -721,7 +722,7 @@ int osmo_sock_init2_multiaddr(uint16_t family, uint16_t type, uint8_t proto,
{ {
struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS]; struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS];
int sfd = -1, rc, on = 1; int sfd = -1, rc, on = 1;
int i; unsigned int i;
bool loc_has_v4addr, rem_has_v4addr; bool loc_has_v4addr, rem_has_v4addr;
bool loc_has_v6addr, rem_has_v6addr; bool loc_has_v6addr, rem_has_v6addr;
struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS]; struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS];