"Damjan Jovanovic" damjan.jov@gmail.com wrote:
case AF_INET6:
{
static const struct sockaddr_in6 emptyAddr;
const struct sockaddr_in6 *in6 = (struct sockaddr_in6*) uaddr;
return in6->sin6_port || memcmp(&in6->sin6_addr, &emptyAddr.sin6_addr, sizeof(struct in6_addr));
}
case AF_INET:
{
static const struct sockaddr_in emptyAddr;
const struct sockaddr_in *in = (struct sockaddr_in*) uaddr;
return in->sin_port || memcmp(&in->sin_addr, &emptyAddr.sin_addr, sizeof(struct in_addr));
}
You should add 'const' to the casting if the target you create is 'const'.