Change in libosmocore[master]: socket, select: Fix -Wsign-compare warnings
laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... socket, select: Fix -Wsign-compare warnings Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 --- M src/select.c M src/socket.c 2 files changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/26814/1 diff --git a/src/select.c b/src/select.c index ddff132..735ea3e 100644 --- a/src/select.c +++ b/src/select.c @@ -316,7 +316,7 @@ } /* 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; unsigned int i; diff --git a/src/socket.c b/src/socket.c index 1251061..b33116c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -114,7 +114,7 @@ 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) { - int i, j; + unsigned int i, j; for (i = 0; i < host_cnt; i++) { addrinfo[i] = addrinfo_helper(family, type, proto, hosts[i], port, passive); @@ -210,7 +210,8 @@ 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 ret, i; + unsigned int i; + int ret; char *after; if (buf_len < 3) @@ -665,7 +666,7 @@ /* Build array of addresses taking first addrinfo result of the requested family * for each host in addrs_buf. */ 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) { size_t host_idx, offset = 0; const struct addrinfo *rp; @@ -721,7 +722,7 @@ { struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS]; int sfd = -1, rc, on = 1; - int i; + unsigned int i; bool loc_has_v4addr, rem_has_v4addr; bool loc_has_v6addr, rem_has_v6addr; struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS]; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-MessageType: newchange
tnt has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-Comment-Date: Sun, 09 Jan 2022 11:16:50 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... Patch Set 1: (2 comments) https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/select.c File src/select.c: https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/select.c@319 PS1, Line 319: static int poll_disp_fds(unsigned int n_fd) it's a bit strange using an unsigned for an fd, it's usually an int right? https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/socket.c File src/socket.c: https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/socket.c@213 PS1, Line 213: unsigned int i; this one should actually be a size_t afaiu. -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-Comment-Date: Mon, 10 Jan 2022 09:42:36 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... Patch Set 1: (2 comments) https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/select.c File src/select.c: https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/select.c@319 PS1, Line 319: static int poll_disp_fds(unsigned int n_fd)
it's a bit strange using an unsigned for an fd, it's usually an int right? n_fd == number of FDs. Cannot be negative.
https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/socket.c File src/socket.c: https://gerrit.osmocom.org/c/libosmocore/+/26814/1/src/socket.c@213 PS1, Line 213: unsigned int i;
this one should actually be a size_t afaiu. Ack
-- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-Comment-Date: Mon, 10 Jan 2022 09:51:52 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin <pespin@sysmocom.de> Gerrit-MessageType: comment
Hello Jenkins Builder, tnt, pespin, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmocore/+/26814 to look at the new patch set (#2). Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... socket, select: Fix -Wsign-compare warnings Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 --- M src/select.c M src/socket.c 2 files changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/26814/2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-MessageType: newpatchset
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-Comment-Date: Mon, 10 Jan 2022 10:07:51 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26814 ) Change subject: socket, select: Fix -Wsign-compare warnings ...................................................................... socket, select: Fix -Wsign-compare warnings Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 --- M src/select.c M src/socket.c 2 files changed, 6 insertions(+), 5 deletions(-) Approvals: Jenkins Builder: Verified pespin: Looks good to me, approved diff --git a/src/select.c b/src/select.c index ddff132..735ea3e 100644 --- a/src/select.c +++ b/src/select.c @@ -316,7 +316,7 @@ } /* 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; unsigned int i; diff --git a/src/socket.c b/src/socket.c index 1251061..449c825 100644 --- a/src/socket.c +++ b/src/socket.c @@ -114,7 +114,7 @@ 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) { - int i, j; + unsigned int i, j; for (i = 0; i < host_cnt; i++) { addrinfo[i] = addrinfo_helper(family, type, proto, hosts[i], port, passive); @@ -210,7 +210,8 @@ 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 ret, i; + size_t i; + int ret; char *after; if (buf_len < 3) @@ -665,7 +666,7 @@ /* Build array of addresses taking first addrinfo result of the requested family * for each host in addrs_buf. */ 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) { size_t host_idx, offset = 0; const struct addrinfo *rp; @@ -721,7 +722,7 @@ { struct addrinfo *res_loc[OSMO_SOCK_MAX_ADDRS], *res_rem[OSMO_SOCK_MAX_ADDRS]; int sfd = -1, rc, on = 1; - int i; + unsigned int i; bool loc_has_v4addr, rem_has_v4addr; bool loc_has_v6addr, rem_has_v6addr; struct sockaddr_in6 addrs_buf[OSMO_SOCK_MAX_ADDRS]; -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26814 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Idf6213e66e9bf609e930c6134292458a7d521871 Gerrit-Change-Number: 26814 Gerrit-PatchSet: 2 Gerrit-Owner: laforge <laforge@osmocom.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-Reviewer: tnt <tnt@246tNt.com> Gerrit-MessageType: merged
participants (3)
-
laforge -
pespin -
tnt