From: Maarten Bosmans Date: Wed, 2 Nov 2011 20:54:13 +0000 (+0100) Subject: win32: Avoid some compiler warnings when cross-compiling for mingw32 X-Git-Url: https://code.delx.au/pulseaudio/commitdiff_plain/e8028304b30c359ee4c0e97fb57a0f6e985227e8 win32: Avoid some compiler warnings when cross-compiling for mingw32 Autoconf documentation says that AC_FUNC_SELECT_ARGTYPES shouldn't be used anyway. --- diff --git a/configure.ac b/configure.ac index b15b1e4a..e3ce9874 100644 --- a/configure.ac +++ b/configure.ac @@ -490,7 +490,6 @@ AC_CHECK_FUNCS_ONCE([lrintf strtof]) # POSIX AC_FUNC_FORK AC_FUNC_GETGROUPS -AC_FUNC_SELECT_ARGTYPES AC_CHECK_FUNCS_ONCE([chmod chown fstat fchown fchmod clock_gettime getaddrinfo getgrgid_r getgrnam_r \ getpwnam_r getpwuid_r gettimeofday getuid mlock nanosleep \ pipe posix_fadvise posix_madvise posix_memalign setpgid setsid shm_open \ diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c index d79054f8..1e26e5e4 100644 --- a/src/modules/module-esound-sink.c +++ b/src/modules/module-esound-sink.c @@ -377,7 +377,7 @@ static int do_write(struct userdata *u) { pa_make_tcp_socket_low_delay(u->fd); - if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, &so_sndbuf, &sl) < 0) + if (getsockopt(u->fd, SOL_SOCKET, SO_SNDBUF, (void *) &so_sndbuf, &sl) < 0) pa_log_warn("getsockopt(SO_SNDBUF) failed: %s", pa_cstrerror(errno)); else { pa_log_debug("SO_SNDBUF is %zu.", (size_t) so_sndbuf); diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index 8e956c99..5c0345ed 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -186,9 +186,7 @@ static pa_io_event* mainloop_io_new( FD_ZERO (&xset); FD_SET (fd, &xset); - if ((select((SELECT_TYPE_ARG1) fd, NULL, NULL, SELECT_TYPE_ARG234 &xset, - SELECT_TYPE_ARG5 &tv) == -1) && - (WSAGetLastError() == WSAENOTSOCK)) { + if ((select(fd, NULL, NULL, &xset, &tv) == -1) && (WSAGetLastError() == WSAENOTSOCK)) { pa_log_warn("Cannot monitor non-socket file descriptors."); e->dead = TRUE; } diff --git a/src/pulsecore/poll.c b/src/pulsecore/poll.c index d5abb04d..cd888b50 100644 --- a/src/pulsecore/poll.c +++ b/src/pulsecore/poll.c @@ -106,9 +106,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout % 1000) * 1000; - ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset, - SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset, - SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv)); + ready = select(maxfd + 1, &rset, &wset, &xset, (timeout == -1 ? NULL : &tv)); if ((ready == -1) && (errno == EBADF)) { ready = 0; @@ -144,9 +142,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { singl_tv.tv_sec = 0; singl_tv.tv_usec = 0; - if (select((SELECT_TYPE_ARG1) f->fd, SELECT_TYPE_ARG234 &rset, - SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset, - SELECT_TYPE_ARG5 &singl_tv) != -1) { + if (select(f->fd, &rset, &wset, &xset, &singl_tv) != -1) { if (f->events & POLLIN) FD_SET (f->fd, &rset); if (f->events & POLLOUT) @@ -185,9 +181,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { /* Linux alters the tv struct... but it shouldn't matter here ... * as we're going to be a little bit out anyway as we've just eaten * more than a couple of cpu cycles above */ - ready = select((SELECT_TYPE_ARG1) maxfd + 1, SELECT_TYPE_ARG234 &rset, - SELECT_TYPE_ARG234 &wset, SELECT_TYPE_ARG234 &xset, - SELECT_TYPE_ARG5 (timeout == -1 ? NULL : &tv)); + ready = select(maxfd + 1, &rset, &wset, &xset, (timeout == -1 ? NULL : &tv)); } } @@ -196,8 +190,6 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { #endif if (ready > 0) { - int r; - ready = 0; for (f = fds; f < &fds[nfds]; ++f) { f->revents = 0; @@ -210,7 +202,7 @@ int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) { * for some kinds of descriptors. Detect if this descriptor is a * connected socket, a server socket, or something else using a * 0-byte recv, and use ioctl(2) to detect POLLHUP. */ - r = recv(f->fd, NULL, 0, MSG_PEEK); + int r = recv(f->fd, NULL, 0, MSG_PEEK); if (r == 0 || (r < 0 && errno == ENOTSOCK)) ioctl(f->fd, FIONREAD, &r); diff --git a/src/pulsecore/socket-server.c b/src/pulsecore/socket-server.c index fd81c2ae..0b0b2a5c 100644 --- a/src/pulsecore/socket-server.c +++ b/src/pulsecore/socket-server.c @@ -244,7 +244,7 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address } #ifdef SO_REUSEADDR - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &on, sizeof(on)) < 0) pa_log("setsockopt(): %s", pa_cstrerror(errno)); #endif @@ -307,13 +307,13 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad #ifdef IPV6_V6ONLY on = 1; - if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) + if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &on, sizeof(on)) < 0) pa_log("setsockopt(IPPROTO_IPV6, IPV6_V6ONLY): %s", pa_cstrerror(errno)); #endif #ifdef SO_REUSEADDR on = 1; - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &on, sizeof(on)) < 0) pa_log("setsockopt(SOL_SOCKET, SO_REUSEADDR, 1): %s", pa_cstrerror(errno)); #endif diff --git a/src/pulsecore/socket-util.c b/src/pulsecore/socket-util.c index 00fcbc4f..2b8d4634 100644 --- a/src/pulsecore/socket-util.c +++ b/src/pulsecore/socket-util.c @@ -63,7 +63,9 @@ #include "socket-util.h" void pa_socket_peer_to_string(int fd, char *c, size_t l) { +#ifndef OS_IS_WIN32 struct stat st; +#endif pa_assert(fd >= 0); pa_assert(c); @@ -139,7 +141,7 @@ void pa_make_socket_low_delay(int fd) { pa_assert(fd >= 0); priority = 6; - if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0) + if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (const void *) &priority, sizeof(priority)) < 0) pa_log_warn("SO_PRIORITY failed: %s", pa_cstrerror(errno)); #endif } @@ -153,9 +155,9 @@ void pa_make_tcp_socket_low_delay(int fd) { { int on = 1; #if defined(SOL_TCP) - if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) + if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *) &on, sizeof(on)) < 0) #else - if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) + if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *) &on, sizeof(on)) < 0) #endif pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno)); } @@ -165,9 +167,9 @@ void pa_make_tcp_socket_low_delay(int fd) { { int tos = IPTOS_LOWDELAY; #ifdef SOL_IP - if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0) + if (setsockopt(fd, SOL_IP, IP_TOS, (const void *) &tos, sizeof(tos)) < 0) #else - if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) + if (setsockopt(fd, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof(tos)) < 0) #endif pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno)); } @@ -183,9 +185,9 @@ void pa_make_udp_socket_low_delay(int fd) { { int tos = IPTOS_LOWDELAY; #ifdef SOL_IP - if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0) + if (setsockopt(fd, SOL_IP, IP_TOS, (const void *) &tos, sizeof(tos)) < 0) #else - if (setsockopt(fd, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) + if (setsockopt(fd, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof(tos)) < 0) #endif pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno)); } @@ -197,7 +199,7 @@ int pa_socket_set_rcvbuf(int fd, size_t l) { pa_assert(fd >= 0); - if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsz, sizeof(bufsz)) < 0) { + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (const void *) &bufsz, sizeof(bufsz)) < 0) { pa_log_warn("SO_RCVBUF: %s", pa_cstrerror(errno)); return -1; } @@ -210,7 +212,7 @@ int pa_socket_set_sndbuf(int fd, size_t l) { pa_assert(fd >= 0); - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsz, sizeof(bufsz)) < 0) { + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (const void *) &bufsz, sizeof(bufsz)) < 0) { pa_log_warn("SO_SNDBUF: %s", pa_cstrerror(errno)); return -1; }