Fix some compiler warnings from MinGW.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 15 Apr 2016 10:42:30 +0000 (12:42 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 15 Apr 2016 10:42:30 +0000 (12:42 +0200)
src/multicast_device.c
src/net_packet.c

index 931a8d0..8dab9e0 100644 (file)
@@ -162,7 +162,7 @@ static void close_device(void) {
 static bool read_packet(vpn_packet_t *packet) {
        int lenin;
 
-       if((lenin = recv(device_fd, DATA(packet), MTU, 0)) <= 0) {
+       if((lenin = recv(device_fd, (void *)DATA(packet), MTU, 0)) <= 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Error while reading from %s %s: %s", device_info,
                           device, sockstrerror(sockerrno));
                return false;
@@ -185,7 +185,7 @@ static bool write_packet(vpn_packet_t *packet) {
        logger(DEBUG_TRAFFIC, LOG_DEBUG, "Writing packet of %d bytes to %s",
                           packet->len, device_info);
 
-       if(sendto(device_fd, DATA(packet), packet->len, 0, ai->ai_addr, ai->ai_addrlen) < 0) {
+       if(sendto(device_fd, (void *)DATA(packet), packet->len, 0, ai->ai_addr, ai->ai_addrlen) < 0) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Can't write to %s %s: %s", device_info, device,
                           sockstrerror(sockerrno));
                return false;
index f8c6ac9..7d61e7b 100644 (file)
@@ -729,7 +729,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
 #if defined(IPPROTO_IPV6) & defined(IPV6_TCLASS)
                case AF_INET6:
                        logger(DEBUG_TRAFFIC, LOG_DEBUG, "Setting IPv6 outgoing packet priority to %d", origpriority);
-                       if(setsockopt(listen_socket[sock].udp.fd, IPPROTO_IPV6, IPV6_TCLASS, &origpriority, sizeof origpriority)) /* SO_PRIORITY doesn't seem to work */
+                       if(setsockopt(listen_socket[sock].udp.fd, IPPROTO_IPV6, IPV6_TCLASS, (void *)&origpriority, sizeof origpriority)) /* SO_PRIORITY doesn't seem to work */
                                logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s", "setsockopt", sockstrerror(sockerrno));
                        break;
 #endif
@@ -738,7 +738,7 @@ static void send_udppacket(node_t *n, vpn_packet_t *origpkt) {
                }
        }
 
-       if(sendto(listen_socket[sock].udp.fd, SEQNO(inpkt), inpkt->len, 0, &sa->sa, SALEN(sa->sa)) < 0 && !sockwouldblock(sockerrno)) {
+       if(sendto(listen_socket[sock].udp.fd, (void *)SEQNO(inpkt), inpkt->len, 0, &sa->sa, SALEN(sa->sa)) < 0 && !sockwouldblock(sockerrno)) {
                if(sockmsgsize(sockerrno)) {
                        if(n->maxmtu >= origlen)
                                n->maxmtu = origlen - 1;
@@ -1555,7 +1555,7 @@ void handle_incoming_vpn_data(void *data, int flags) {
        socklen_t addrlen = sizeof addr;
 
        pkt.offset = 0;
-       int len = recvfrom(ls->udp.fd, DATA(&pkt), MAXSIZE, 0, &addr.sa, &addrlen);
+       int len = recvfrom(ls->udp.fd, (void *)DATA(&pkt), MAXSIZE, 0, &addr.sa, &addrlen);
 
        if(len <= 0 || len > MAXSIZE) {
                if(!sockwouldblock(sockerrno))