socket-util: drop redundant casts
authorLennart Poettering <lennart@poettering.net>
Fri, 30 Oct 2009 03:55:13 +0000 (04:55 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 30 Oct 2009 03:55:13 +0000 (04:55 +0100)
src/pulsecore/socket-util.c

index 0d0762d..2cc9882 100644 (file)
@@ -151,7 +151,7 @@ void pa_make_socket_low_delay(int fd) {
     pa_assert(fd >= 0);
 
     priority = 6;
-    if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) < 0)
+    if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0)
         pa_log_warn("SO_PRIORITY failed: %s", pa_cstrerror(errno));
 #endif
 }
@@ -165,9 +165,9 @@ void pa_make_tcp_socket_low_delay(int fd) {
     {
         int on = 1;
 #if defined(SOL_TCP)
-        if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
+        if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof(on)) < 0)
 #else
-        if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
+        if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0)
 #endif
             pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno));
     }
@@ -177,9 +177,9 @@ void pa_make_tcp_socket_low_delay(int fd) {
     {
         int tos = IPTOS_LOWDELAY;
 #ifdef SOL_IP
-        if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+        if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0)
 #else
-        if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+        if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
 #endif
             pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
     }
@@ -195,9 +195,9 @@ void pa_make_udp_socket_low_delay(int fd) {
     {
         int tos = IPTOS_LOWDELAY;
 #ifdef SOL_IP
-        if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+        if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0)
 #else
-        if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+        if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0)
 #endif
             pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
     }
@@ -205,11 +205,11 @@ void pa_make_udp_socket_low_delay(int fd) {
 }
 
 int pa_socket_set_rcvbuf(int fd, size_t l) {
-    int bufsz = (int)l;
+    int bufsz = (int) l;
 
     pa_assert(fd >= 0);
 
-    if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&bufsz, sizeof(bufsz)) < 0) {
+    if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz)) < 0) {
         pa_log_warn("SO_RCVBUF: %s", pa_cstrerror(errno));
         return -1;
     }
@@ -218,12 +218,12 @@ int pa_socket_set_rcvbuf(int fd, size_t l) {
 }
 
 int pa_socket_set_sndbuf(int fd, size_t l) {
-    int bufsz = (int)l;
+    int bufsz = (int) l;
 
     pa_assert(fd >= 0);
 
-    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&bufsz, sizeof(bufsz)) < 0) {
-        pa_log("SO_SNDBUF: %s", pa_cstrerror(errno));
+    if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsz, sizeof(bufsz)) < 0) {
+        pa_log_warn("SO_SNDBUF: %s", pa_cstrerror(errno));
         return -1;
     }