socket-util: drop redundant casts

This commit is contained in:
Lennart Poettering 2009-10-30 04:55:13 +01:00
parent 75f7a971db
commit a82c6b0cd5

View file

@ -151,7 +151,7 @@ void pa_make_socket_low_delay(int fd) {
pa_assert(fd >= 0); pa_assert(fd >= 0);
priority = 6; 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)); pa_log_warn("SO_PRIORITY failed: %s", pa_cstrerror(errno));
#endif #endif
} }
@ -165,9 +165,9 @@ void pa_make_tcp_socket_low_delay(int fd) {
{ {
int on = 1; int on = 1;
#if defined(SOL_TCP) #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 #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 #endif
pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno)); 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; int tos = IPTOS_LOWDELAY;
#ifdef SOL_IP #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 #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 #endif
pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno)); 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; int tos = IPTOS_LOWDELAY;
#ifdef SOL_IP #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 #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 #endif
pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno)); 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 pa_socket_set_rcvbuf(int fd, size_t l) {
int bufsz = (int)l; int bufsz = (int) l;
pa_assert(fd >= 0); 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)); pa_log_warn("SO_RCVBUF: %s", pa_cstrerror(errno));
return -1; 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 pa_socket_set_sndbuf(int fd, size_t l) {
int bufsz = (int)l; int bufsz = (int) l;
pa_assert(fd >= 0); pa_assert(fd >= 0);
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&bufsz, sizeof(bufsz)) < 0) { if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsz, sizeof(bufsz)) < 0) {
pa_log("SO_SNDBUF: %s", pa_cstrerror(errno)); pa_log_warn("SO_SNDBUF: %s", pa_cstrerror(errno));
return -1; return -1;
} }