Commit 337ffb63 authored by Olivier Crête's avatar Olivier Crête 👻
Browse files

address: Use union

This makes coverity happier.
parent a1535cdb
......@@ -194,13 +194,21 @@ NICEAPI_EXPORT void
nice_address_set_from_sockaddr (NiceAddress *addr,
const struct sockaddr *sa)
union {
const struct sockaddr *sa;
const struct sockaddr_in *in;
const struct sockaddr_in6 *in6;
} s; = sa;
switch (sa->sa_family)
case AF_INET:
memcpy(&addr->s.ip4, sa, sizeof (addr->s.ip4));
memcpy(&addr->s.ip4,, sizeof (addr->s.ip4));
case AF_INET6:
memcpy(&addr->s.ip6, sa, sizeof (addr->s.ip6));
memcpy(&addr->s.ip6, s.in6, sizeof (addr->s.ip6));
g_return_if_reached ();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment