miniupnpd/minissdp.c: fix 50e370abcd

while() => for() / reindent/etc
This commit is contained in:
Thomas Bernard 2014-10-22 12:10:30 +02:00
parent ac816e91f9
commit aef2c0a3b4
1 changed files with 52 additions and 53 deletions

View File

@ -606,7 +606,7 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
#endif
socklen_t sockname_len;
const char * dest_str;
int i=0;
int i;
char ver_str[4];
#ifndef ENABLE_IPV6
UNUSED(ipv6);
@ -615,8 +615,7 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
memset(&sockname, 0, sizeof(sockname));
#ifdef ENABLE_IPV6
for(j = 0; (mcast_addrs[j].p1 != 0 && ipv6) || j < 1; j++) {
if(ipv6)
{
if(ipv6) {
struct sockaddr_in6 * p = (struct sockaddr_in6 *)&sockname;
sockname_len = sizeof(struct sockaddr_in6);
p->sin6_family = AF_INET6;
@ -631,10 +630,11 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
* using either global scope FF0E::C or site local scope FF05::C.
* In networks with complex topologies and overlapping sites, use of
* global scope is RECOMMENDED. */
}
else
#endif
} else {
#else /* ENABLE_IPV6 */
{
#endif /* ENABLE_IPV6 */
/* IPv4 */
struct sockaddr_in *p = (struct sockaddr_in *)&sockname;
sockname_len = sizeof(struct sockaddr_in);
p->sin_family = AF_INET;
@ -643,8 +643,8 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
dest_str = SSDP_MCAST_ADDR;
}
while(known_service_types[i].s)
{
/* iterate all services / devices */
for(i = 0; known_service_types[i].s; i++) {
if(i==0)
ver_str[0] = '\0';
else
@ -658,9 +658,9 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
known_service_types[i].uuid, "::",
known_service_types[i].s, /* ver_str, USN: */
lifetime);
/* for devices, also send NOTIFY on the uuid */
if(0==memcmp(known_service_types[i].s,
"urn:schemas-upnp-org:device", sizeof("urn:schemas-upnp-org:device")-1))
{
"urn:schemas-upnp-org:device", sizeof("urn:schemas-upnp-org:device")-1)) {
SendSSDPNotify(s, (struct sockaddr *)&sockname, sockname_len, dest_str,
host, http_port,
#ifdef ENABLE_HTTPS
@ -670,11 +670,10 @@ SendSSDPNotifies(int s, const char * host, unsigned short http_port,
known_service_types[i].uuid, "", "", /* ver_str, USN: */
lifetime);
}
i++;
}
} /* for(i = 0; known_service_types[i].s; i++) */
#ifdef ENABLE_IPV6
}
#endif
} /* for(j = 0; (mcast_addrs[j].p1 != 0 && ipv6) || j < 1; j++) */
#endif /* ENABLE_IPV6 */
}
void