[sr-dev] git:master:d8f595fe: core: fix compilation warnings

Victor Seva linuxmaniac at torreviejawireless.org
Thu Dec 20 00:36:06 CET 2018


Module: kamailio
Branch: master
Commit: d8f595fe4bb4cec6049e86202b95e40ae849b165
URL: https://github.com/kamailio/kamailio/commit/d8f595fe4bb4cec6049e86202b95e40ae849b165

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2018-12-20T00:26:20+01:00

core: fix compilation warnings

> core/tcp_main.c:1135:13: warning: result of comparison of constant 18446744073709551615 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>                        if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
>                            ~~~~ ^  ~~~~~~~~~
> core/tcp_main.c:1147:13: warning: result of comparison of constant 18446744073709551615 with expression of type 'uint32_t' (aka 'unsigned int') is always false [-Wtautological-constant-out-of-range-compare]
>                        if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
>                            ~~~~ ^  ~~~~~~~~~
> 2 warnings generated.

---

Modified: src/core/tcp_main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d8f595fe4bb4cec6049e86202b95e40ae849b165.diff
Patch: https://github.com/kamailio/kamailio/commit/d8f595fe4bb4cec6049e86202b95e40ae849b165.patch

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 2ab169ab6b..212a3aad19 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1132,7 +1132,7 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {
 
 			/* Parse the source port */
 			port = strtoul(p, &end, 10);
-			if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
+			if (port == UINT32_MAX || port == 0 || port >= (1 << 16)) {
 				return -1; /* invalid port number */
 			}
 			c->rcv.src_port = port;
@@ -1144,7 +1144,7 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {
 
 			/* Parse the destination port */
 			port = strtoul(p, NULL, 10);
-			if (port == ULONG_MAX || port == 0 || port >= (1 << 16)) {
+			if (port == UINT32_MAX || port == 0 || port >= (1 << 16)) {
 				return -1; /* invalid port number */
 			}
 			c->rcv.dst_port = port;




More information about the sr-dev mailing list