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>
This commit is contained in:
chao an 2023-02-08 16:37:04 +08:00 committed by Xiang Xiao
parent 5580de0685
commit 4a8cd8ca0c
2 changed files with 4 additions and 4 deletions

View File

@ -60,8 +60,8 @@ static ssize_t netprocfs_tcpstats(FAR struct netprocfs_file_s *priv,
int addrlen = (domain == PF_INET) ?
INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
FAR struct tcp_conn_s *conn = NULL;
char remote[addrlen + 1];
char local[addrlen + 1];
char remote[INET6_ADDRSTRLEN + 1];
char local[INET6_ADDRSTRLEN + 1];
int len = 0;
void *laddr;
void *raddr;

View File

@ -60,8 +60,8 @@ static ssize_t netprocfs_udpstats(FAR struct netprocfs_file_s *priv,
int addrlen = (domain == PF_INET) ?
INET_ADDRSTRLEN : INET6_ADDRSTRLEN;
FAR struct udp_conn_s *conn = NULL;
char remote[addrlen + 1];
char local[addrlen + 1];
char remote[INET6_ADDRSTRLEN + 1];
char local[INET6_ADDRSTRLEN + 1];
int len = 0;
void *laddr;
void *raddr;