miniupnpc.c: reindent upnpDiscover()

This commit is contained in:
Thomas Bernard 2013-02-20 16:29:28 +01:00
parent 2b9c014394
commit 09d5473c54
1 changed files with 144 additions and 149 deletions

View File

@ -536,10 +536,8 @@ upnpDiscoverDevices(const char * const deviceTypes[],
/* Calculating maximum response time in seconds */ /* Calculating maximum response time in seconds */
mx = ((unsigned int)delay) / 1000u; mx = ((unsigned int)delay) / 1000u;
/* receiving SSDP response packet */ /* receiving SSDP response packet */
for(n = 0; deviceTypes[deviceIndex]; deviceIndex++) for(n = 0; deviceTypes[deviceIndex]; deviceIndex++) {
{ if(n == 0) {
if(n == 0)
{
/* sending the SSDP M-SEARCH packet */ /* sending the SSDP M-SEARCH packet */
n = snprintf(bufr, sizeof(bufr), n = snprintf(bufr, sizeof(bufr),
MSearchMsgFmt, MSearchMsgFmt,
@ -554,7 +552,6 @@ upnpDiscoverDevices(const char * const deviceTypes[],
(linklocal ? "[" UPNP_MCAST_LL_ADDR "]" : "[" UPNP_MCAST_SL_ADDR "]") (linklocal ? "[" UPNP_MCAST_LL_ADDR "]" : "[" UPNP_MCAST_SL_ADDR "]")
: UPNP_MCAST_ADDR, : UPNP_MCAST_ADDR,
deviceTypes[deviceIndex]); deviceTypes[deviceIndex]);
#endif #endif
#ifdef NO_GETADDRINFO #ifdef NO_GETADDRINFO
/* the following code is not using getaddrinfo */ /* the following code is not using getaddrinfo */
@ -573,8 +570,7 @@ upnpDiscoverDevices(const char * const deviceTypes[],
p->sin_port = htons(PORT); p->sin_port = htons(PORT);
p->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR); p->sin_addr.s_addr = inet_addr(UPNP_MCAST_ADDR);
} }
n = sendto(sudp, bufr, n, 0, n = sendto(sudp, bufr, n, 0, &sockudp_w,
&sockudp_w,
ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in)); ipv6 ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));
if (n < 0) { if (n < 0) {
if(error) if(error)
@ -655,8 +651,7 @@ upnpDiscoverDevices(const char * const deviceTypes[],
int stsize=0; int stsize=0;
/*printf("%d byte(s) :\n%s\n", n, bufr);*/ /* affichage du message */ /*printf("%d byte(s) :\n%s\n", n, bufr);*/ /* affichage du message */
parseMSEARCHReply(bufr, n, &descURL, &urlsize, &st, &stsize); parseMSEARCHReply(bufr, n, &descURL, &urlsize, &st, &stsize);
if(st&&descURL) if(st&&descURL) {
{
#ifdef DEBUG #ifdef DEBUG
printf("M-SEARCH Reply:\n ST: %.*s\n Location: %.*s\n", printf("M-SEARCH Reply:\n ST: %.*s\n Location: %.*s\n",
stsize, st, urlsize, descURL); stsize, st, urlsize, descURL);