Skip to content

Commit

Permalink
indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
umlaeute committed Mar 14, 2024
1 parent 80122d8 commit 911b013
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 29 deletions.
27 changes: 15 additions & 12 deletions iemnet_sender.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions tcpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions tcpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions udpclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions udpreceive.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion udpsend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions udpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 911b013

Please sign in to comment.