diff --git a/iemnet_sender.c b/iemnet_sender.c index 1886919..1794c4f 100644 --- a/iemnet_sender.c +++ b/iemnet_sender.c @@ -229,7 +229,7 @@ t_iemnet_sender*iemnet__sender_create(int sock, { static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; t_iemnet_sender*result = (t_iemnet_sender*)calloc(1, - sizeof(t_iemnet_sender)); + sizeof(t_iemnet_sender)); int res = 0; DEBUG("create sender %x in%sthread", result,subthread?"sub":"main "); if(NULL == result) { @@ -277,7 +277,7 @@ int iemnet__sender_getsockopt(t_iemnet_sender*s, int level, int optname, int result = getsockopt(s->sockfd, level, optname, optval, optlen); if(result != 0) { pd_error(0, "iemnet::sender: getsockopt returned %d", - iemnet__sender_getlasterror(s)); + iemnet__sender_getlasterror(s)); } return result; } @@ -287,7 +287,7 @@ int iemnet__sender_setsockopt(t_iemnet_sender*s, int level, int optname, int result = setsockopt(s->sockfd, level, optname, optval, optlen); if(result != 0) { pd_error(0, "iemnet::sender: setsockopt returned %d", - iemnet__sender_getlasterror(s)); + iemnet__sender_getlasterror(s)); } return result; } @@ -309,19 +309,22 @@ int iemnet__sender_getsize(t_iemnet_sender*x) static int sock_set_nonblocking(int socket, int nonblocking) { #ifdef _WIN32 - u_long modearg = nonblocking; - if (ioctlsocket(socket, FIONBIO, &modearg) != NO_ERROR) - return -1; + u_long modearg = nonblocking; + if (ioctlsocket(socket, FIONBIO, &modearg) != NO_ERROR) { + return -1; + } #else - int sockflags = fcntl(socket, F_GETFL, 0); - if (nonblocking) - sockflags |= O_NONBLOCK; - else - sockflags &= ~O_NONBLOCK; - if (fcntl(socket, F_SETFL, sockflags) < 0) - return -1; + int sockflags = fcntl(socket, F_GETFL, 0); + if (nonblocking) { + sockflags |= O_NONBLOCK; + } else { + sockflags &= ~O_NONBLOCK; + } + if (fcntl(socket, F_SETFL, sockflags) < 0) { + return -1; + } #endif - return 0; + return 0; } static int conn_in_progress() { diff --git a/tcpclient.c b/tcpclient.c index 5439da8..4927e5c 100644 --- a/tcpclient.c +++ b/tcpclient.c @@ -148,7 +148,7 @@ static int tcpclient_do_connect(const char*host, unsigned short port, sender = iemnet__sender_create(sockfd, NULL, NULL, 0); receiver = iemnet__receiver_create(sockfd, x, tcpclient_receive_callback, - 0); + 0); if(addrOUT) { *addrOUT = ntohl(*(long *)hp->h_addr); } @@ -191,8 +191,8 @@ static void tcpclient_connect(t_tcpclient *x, t_symbol *hostname, x->x_port = fportno; state = tcpclient_do_connect(x->x_hostname, x->x_port, x, - &x->x_sender, &x->x_receiver, - &x->x_addr); + &x->x_sender, &x->x_receiver, + &x->x_addr); x->x_connectstate = (state>0); x->x_fd = state; tcpclient_info(x); @@ -245,7 +245,7 @@ static void tcpclient_receive_callback(void*y, t_iemnet_chunk*c) if(c) { iemnet__addrout(x->x_statusout, x->x_addrout, x->x_addr, x->x_port); - /* get's destroyed in the dtor */ + /* get's destroyed in the dtor */ x->x_floatlist = iemnet__chunk2list(c, x->x_floatlist); iemnet__streamout(x->x_msgout, x->x_floatlist->argc, x->x_floatlist->argv, x->x_serialize); diff --git a/tcpreceive.c b/tcpreceive.c index 007cd12..b8e7806 100644 --- a/tcpreceive.c +++ b/tcpreceive.c @@ -116,7 +116,7 @@ static int tcpreceive_addconnection(t_tcpreceive *x, int fd, long addr, x->x_connection[i].addr = addr; x->x_connection[i].port = port; x->x_connection[i].owner = x; - x->x_connection[i].receiver = + x->x_connection[i].receiver = iemnet__receiver_create(fd, x->x_connection+i, tcpreceive_read_callback, diff --git a/tcpserver.c b/tcpserver.c index 1860209..c5e3050 100644 --- a/tcpserver.c +++ b/tcpserver.c @@ -611,7 +611,7 @@ static void tcpserver_connectpoll(t_tcpserver *x, int fd) fd = accept(fd, (struct sockaddr*)&incomer_address, &sockaddrl); tcpserver_info_event(x, CONNECT); - if (fd < 0) { + if (fd < 0) { post("%s: accept failed", objName); } else if(!x->x_accepting) { iemnet__closesocket(fd, 1); @@ -724,8 +724,8 @@ static void tcpserver_port(t_tcpserver*x, t_floatarg fportno) outlet_anything(x->x_statusout, gensym("port"), 1, ap); return; } else { - /* wait for new connections */ - sys_addpollfn(sockfd, (t_fdpollfn)tcpserver_connectpoll, x); + /* wait for new connections */ + sys_addpollfn(sockfd, (t_fdpollfn)tcpserver_connectpoll, x); } x->x_connectsocket = sockfd; diff --git a/udpclient.c b/udpclient.c index 0e67423..eaf22c2 100644 --- a/udpclient.c +++ b/udpclient.c @@ -157,7 +157,7 @@ static void *udpclient_doconnect(t_udpclient*x, int subthread) x->x_sender = iemnet__sender_create(sockfd, NULL, NULL, subthread); x->x_receiver = iemnet__receiver_create(sockfd, x, - udpclient_receive_callback, subthread); + udpclient_receive_callback, subthread); x->x_connectstate = 1; udpclient_info(x); @@ -194,7 +194,7 @@ static void udpclient_disconnect(t_udpclient *x) { static void udpclient_connect(t_udpclient *x, t_symbol *hostname, t_floatarg fportno, - t_floatarg fsndportno) + t_floatarg fsndportno) { if(x->x_fd >= 0) { udpclient_disconnect(x); @@ -235,7 +235,7 @@ static void udpclient_receive_callback(void*y, t_iemnet_chunk*c) if(c) { iemnet__addrout(x->x_statusout, x->x_addrout, x->x_addr, x->x_port); x->x_floatlist = iemnet__chunk2list(c, - x->x_floatlist); /* gets destroyed in the dtor */ + x->x_floatlist); /* gets destroyed in the dtor */ outlet_list(x->x_msgout, gensym("list"),x->x_floatlist->argc, x->x_floatlist->argv); } else { diff --git a/udpreceive.c b/udpreceive.c index 39b7b59..c207930 100644 --- a/udpreceive.c +++ b/udpreceive.c @@ -138,9 +138,9 @@ static int udpreceive_setport(t_udpreceive*x, unsigned short portno) } x->x_receiver = iemnet__receiver_create(sockfd, - x, - udpreceive_read_callback, - 0); + x, + udpreceive_read_callback, + 0); return 1; } diff --git a/udpsend.c b/udpsend.c index 3a43e29..bd7f31d 100644 --- a/udpsend.c +++ b/udpsend.c @@ -138,7 +138,7 @@ static void *udpsend_new(void) outlet_new(&x->x_obj, gensym("float")); x->x_sender = NULL; x->x_fd = -1; - return (x); + return (x); } IEMNET_EXTERN void udpsend_setup(void) diff --git a/udpserver.c b/udpserver.c index 2a68373..f0980ee 100644 --- a/udpserver.c +++ b/udpserver.c @@ -748,9 +748,9 @@ static void udpserver_do_bind(t_udpserver*x, t_symbol*ifaddr, unsigned short por } x->x_receiver = iemnet__receiver_create(sockfd, - x, - udpserver_receive_callback, - 0); + x, + udpserver_receive_callback, + 0); x->x_connectsocket = sockfd; x->x_port = portno; x->x_ifaddr = ifaddr;