Browse Source

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.
Victor Seva 6 năm trước cách đây
mục cha
commit
d8f595fe4b
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/core/tcp_main.c

+ 2 - 2
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;