Skip to content

Commit 4a8cd8c

Browse files
anchaoxiaoxiang781216
authored andcommitted
net/procfs: fix visual studio Compiler Error C2057
D:\archer\code\nuttx\net\procfs\net_tcp.c(63,15): error C2057: expected constant expression Compiler error C2057: The context requires a constant expression, an expression whose value is known at compile time. Reference: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2057?view=msvc-170 Signed-off-by: chao an <anchao@xiaomi.com>
1 parent 5580de0 commit 4a8cd8c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

net/procfs/net_tcp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static ssize_t netprocfs_tcpstats(FAR struct netprocfs_file_s *priv,
6060
int addrlen = (domain == PF_INET) ?
6161
INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
6262
FAR struct tcp_conn_s *conn = NULL;
63-
char remote[addrlen + 1];
64-
char local[addrlen + 1];
63+
char remote[INET6_ADDRSTRLEN + 1];
64+
char local[INET6_ADDRSTRLEN + 1];
6565
int len = 0;
6666
void *laddr;
6767
void *raddr;

net/procfs/net_udp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static ssize_t netprocfs_udpstats(FAR struct netprocfs_file_s *priv,
6060
int addrlen = (domain == PF_INET) ?
6161
INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
6262
FAR struct udp_conn_s *conn = NULL;
63-
char remote[addrlen + 1];
64-
char local[addrlen + 1];
63+
char remote[INET6_ADDRSTRLEN + 1];
64+
char local[INET6_ADDRSTRLEN + 1];
6565
int len = 0;
6666
void *laddr;
6767
void *raddr;

0 commit comments

Comments
 (0)