Small change to make init of vars buildable in clang and clang++ (#1590)

This commit is contained in:
dzobbe 2022-10-14 04:22:25 +02:00 committed by GitHub
parent 2e77626d0f
commit 84e88e4f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,9 +90,11 @@ wasi_addr_to_sockaddr(const __wasi_addr_t *wasi_addr,
switch (wasi_addr->kind) {
case IPv4:
{
struct sockaddr_in sock_addr_in = { 0 };
struct sockaddr_in sock_addr_in;
uint32_t s_addr;
memset(&sock_addr_in, 0, sizeof(sockaddr_in));
s_addr = (wasi_addr->addr.ip4.addr.n0 << 24)
| (wasi_addr->addr.ip4.addr.n1 << 16)
| (wasi_addr->addr.ip4.addr.n2 << 8)
@ -108,7 +110,10 @@ wasi_addr_to_sockaddr(const __wasi_addr_t *wasi_addr,
}
case IPv6:
{
struct sockaddr_in6 sock_addr_in6 = { 0 };
struct sockaddr_in6 sock_addr_in6;
memset(&sock_addr_in6, 0, sizeof(sockaddr_in6));
uint16_t *addr_buf = (uint16_t *)sock_addr_in6.sin6_addr.s6_addr;
addr_buf[0] = htons(wasi_addr->addr.ip6.addr.n0);