]> granicus.if.org Git - transmission/commitdiff
Kill some warnings when compiling on Windows
authorMike Gelfand <mikedld@mikedld.com>
Fri, 2 Jan 2015 04:02:13 +0000 (04:02 +0000)
committerMike Gelfand <mikedld@mikedld.com>
Fri, 2 Jan 2015 04:02:13 +0000 (04:02 +0000)
libtransmission/fdlimit.c
libtransmission/file-test.c
libtransmission/file-win32.c
libtransmission/net.c
libtransmission/tr-lpd.c
libtransmission/tr-udp.c
libtransmission/tr-utp.c
libtransmission/web.c

index 5c3616775a9275337a67d49e312cbd185028e0ad..4ace4b2531dfa46317be66c76d9e25c1acd7873e 100644 (file)
@@ -531,9 +531,9 @@ tr_fdSocketCreate (tr_session * session, int domain, int type)
           int i;
           socklen_t size = sizeof (int);
           buf_logged = true;
-          getsockopt (s, SOL_SOCKET, SO_SNDBUF, &i, &size);
+          getsockopt (s, SOL_SOCKET, SO_SNDBUF, (void *) &i, &size);
           tr_logAddDebug ("SO_SNDBUF size is %d", i);
-          getsockopt (s, SOL_SOCKET, SO_RCVBUF, &i, &size);
+          getsockopt (s, SOL_SOCKET, SO_RCVBUF, (void *) &i, &size);
           tr_logAddDebug ("SO_RCVBUF size is %d", i);
         }
     }
index c4be94cf4cb797dfef4fa447d72858bceeb1e7bb..30b11157deec6431b240960a82df12aaf63ffb1f 100644 (file)
@@ -148,6 +148,9 @@ validate_permissions (const char   * path,
 
 #else
 
+  (void) path;
+  (void) permissions;
+
   /* No UNIX permissions on Windows */
   return true;
 
index f3f69b7fbef1bdcfbc991ac361a90282239cfad5..8138d56e22b6751ae5ae827d29ba9200f6270170 100644 (file)
@@ -145,6 +145,8 @@ create_dir (const char  * path,
 
   assert (path != NULL);
 
+  (void) permissions;
+
   wide_path = tr_win32_utf8_to_native (path, -1);
 
   if ((flags & TR_SYS_DIR_CREATE_PARENTS) != 0)
@@ -225,12 +227,6 @@ create_temp_path (char      * path_template,
   else
     memcpy (path_template, path, path_size);
 
-  goto cleanup;
-
-fail:
-  set_system_error (error, GetLastError ());
-
-cleanup:
   tr_free (path);
 }
 
@@ -444,6 +440,8 @@ tr_sys_path_basename (const char  * path,
 
   assert (path != NULL);
 
+  (void) error;
+
   /* TODO: Error handling */
 
   if (_splitpath_s (path, NULL, 0, NULL, 0, fname, sizeof (fname), ext, sizeof (ext)) == 0 &&
@@ -467,6 +465,8 @@ tr_sys_path_dirname (const char  * path,
 
   assert (path != NULL);
 
+  (void) error;
+
   /* TODO: Error handling */
 
   if (_splitpath_s (path, drive, sizeof (drive), dir, sizeof (dir), NULL, 0, NULL, 0) == 0 &&
@@ -613,6 +613,8 @@ tr_sys_file_open (const char  * path,
   assert (path != NULL);
   assert ((flags & (TR_SYS_FILE_READ | TR_SYS_FILE_WRITE)) != 0);
 
+  (void) permissions;
+
   if (flags & TR_SYS_FILE_READ)
     native_access |= GENERIC_READ;
   if (flags & TR_SYS_FILE_WRITE)
@@ -941,6 +943,11 @@ tr_sys_file_prefetch (tr_sys_file_t    handle,
   assert (handle != TR_BAD_SYS_FILE);
   assert (size > 0);
 
+  (void) handle;
+  (void) offset;
+  (void) size;
+  (void) error;
+
   /* ??? */
 
   return ret;
@@ -1015,6 +1022,8 @@ tr_sys_file_unmap (const void  * address,
   assert (address != NULL);
   assert (size > 0);
 
+  (void) size;
+
   ret = UnmapViewOfFile (address);
 
   if (!ret)
index 1515498f3bd1b60f8be85337961cb236d034f74f..66d6bd50d66506a998fac2f8b18ebef7f299ecf4 100644 (file)
@@ -75,7 +75,7 @@ tr_net_strerror (char * buf, size_t buflen, int err)
 {
     *buf = '\0';
 #ifdef _WIN32
-    FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buf, buflen, NULL);
+    FormatMessageA (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, buf, buflen, NULL);
 #else
     tr_strlcpy (buf, tr_strerror (err), buflen);
 #endif
@@ -148,7 +148,7 @@ int
 tr_netSetTOS (int s, int tos)
 {
 #ifdef IP_TOS
-    return setsockopt (s, IPPROTO_IP, IP_TOS, (char*)&tos, sizeof (tos));
+    return setsockopt (s, IPPROTO_IP, IP_TOS, (const void *) &tos, sizeof (tos));
 #else
     return 0;
 #endif
@@ -159,7 +159,7 @@ tr_netSetCongestionControl (int s UNUSED, const char *algorithm UNUSED)
 {
 #ifdef TCP_CONGESTION
     return setsockopt (s, IPPROTO_TCP, TCP_CONGESTION,
-                       algorithm, strlen (algorithm) + 1);
+                       (const void *) algorithm, strlen (algorithm) + 1);
 #else
     errno = ENOSYS;
     return -1;
@@ -248,7 +248,7 @@ tr_netOpenPeerSocket (tr_session        * session,
     /* seeds don't need much of a read buffer... */
     if (clientIsSeed) {
         int n = 8192;
-        if (setsockopt (s, SOL_SOCKET, SO_RCVBUF, &n, sizeof (n)))
+        if (setsockopt (s, SOL_SOCKET, SO_RCVBUF, (const void *) &n, sizeof (n)))
             tr_logAddInfo ("Unable to set SO_RCVBUF on socket %d: %s", s, tr_strerror (sockerrno));
     }
 
@@ -337,12 +337,12 @@ tr_netBindTCPImpl (const tr_address * addr, tr_port port, bool suppressMsgs, int
     }
 
     optval = 1;
-    setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof (optval));
-    setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof (optval));
+    setsockopt (fd, SOL_SOCKET, SO_KEEPALIVE, (const void *) &optval, sizeof (optval));
+    setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (const void *) &optval, sizeof (optval));
 
 #ifdef IPV6_V6ONLY
     if (addr->type == TR_AF_INET6)
-        if (setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, &optval, sizeof (optval)) == -1)
+        if (setsockopt (fd, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &optval, sizeof (optval)) == -1)
             if (sockerrno != ENOPROTOOPT) { /* if the kernel doesn't support it, ignore it */
                 *errOut = sockerrno;
                 return -1;
index 29dd788aaf583965ff4b7bbcd6161d039aa5690c..4a484c982ee63c371c0b598e16436179ecb93cad 100644 (file)
@@ -292,7 +292,7 @@ int tr_lpdInit (tr_session* ss, tr_address* tr_addr UNUSED)
             goto fail;
 
         if (setsockopt (lpd_socket, SOL_SOCKET, SO_REUSEADDR,
-                &opt_on, sizeof opt_on) < 0)
+                (const void *) &opt_on, sizeof opt_on) < 0)
             goto fail;
 
         memset (&lpd_mcastAddr, 0, sizeof lpd_mcastAddr);
@@ -311,11 +311,11 @@ int tr_lpdInit (tr_session* ss, tr_address* tr_addr UNUSED)
         mcastReq.imr_multiaddr = lpd_mcastAddr.sin_addr;
         mcastReq.imr_interface.s_addr = htonl (INADDR_ANY);
         if (setsockopt (lpd_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-                &mcastReq, sizeof mcastReq) < 0)
+                (const void *) &mcastReq, sizeof mcastReq) < 0)
             goto fail;
 
         if (setsockopt (lpd_socket, IPPROTO_IP, IP_MULTICAST_LOOP,
-                &opt_off, sizeof opt_off) < 0)
+                (const void *) &opt_off, sizeof opt_off) < 0)
             goto fail;
     }
 
@@ -332,11 +332,11 @@ int tr_lpdInit (tr_session* ss, tr_address* tr_addr UNUSED)
 
         /* configure outbound multicast TTL */
         if (setsockopt (lpd_socket2, IPPROTO_IP, IP_MULTICAST_TTL,
-                &scope, sizeof scope) < 0)
+                (const void *) &scope, sizeof scope) < 0)
             goto fail;
 
         if (setsockopt (lpd_socket2, IPPROTO_IP, IP_MULTICAST_LOOP,
-                &opt_off, sizeof opt_off) < 0)
+                (const void *) &opt_off, sizeof opt_off) < 0)
             goto fail;
     }
 
@@ -463,7 +463,7 @@ tr_lpdSendAnnounce (const tr_torrent* t)
 
         /* destination address info has already been set up in tr_lpdInit (),
          * so we refrain from preparing another sockaddr_in here */
-        int res = sendto (lpd_socket2, query, len, 0,
+        int res = sendto (lpd_socket2, (const void *) query, len, 0,
           (const struct sockaddr*) &lpd_mcastAddr, sizeof lpd_mcastAddr);
 
         if (res != len)
@@ -646,7 +646,7 @@ static void event_callback (evutil_socket_t s UNUSED, short type, void* ignore U
         char foreignMsg[lpd_maxDatagramLength + 1] = { 0 };
 
         /* process local announcement from foreign peer */
-        int res = recvfrom (lpd_socket, foreignMsg, lpd_maxDatagramLength,
+        int res = recvfrom (lpd_socket, (void *) foreignMsg, lpd_maxDatagramLength,
             0, (struct sockaddr*) &foreignAddr, (socklen_t*) &addrLen);
 
         /* besides, do we get flooded? then bail out! */
index 2f5f33b4a392b612a7d76c49f9f9989542373b93..c2022f47d79afba48507081cf6ac7aa4dede2eb2 100644 (file)
@@ -57,23 +57,23 @@ set_socket_buffers (int fd, int large)
     socklen_t rbuf_len = sizeof (rbuf), sbuf_len = sizeof (sbuf);
 
     size = large ? RECV_BUFFER_SIZE : SMALL_BUFFER_SIZE;
-    rc = setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof (size));
+    rc = setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (const void *) &size, sizeof (size));
     if (rc < 0)
         tr_logAddNamedError ("UDP", "Failed to set receive buffer: %s",
                 tr_strerror (errno));
 
     size = large ? SEND_BUFFER_SIZE : SMALL_BUFFER_SIZE;
-    rc = setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof (size));
+    rc = setsockopt (fd, SOL_SOCKET, SO_SNDBUF, (const void *) &size, sizeof (size));
     if (rc < 0)
         tr_logAddNamedError ("UDP", "Failed to set send buffer: %s",
                 tr_strerror (errno));
 
     if (large) {
-        rc = getsockopt (fd, SOL_SOCKET, SO_RCVBUF, &rbuf, &rbuf_len);
+        rc = getsockopt (fd, SOL_SOCKET, SO_RCVBUF, (void *) &rbuf, &rbuf_len);
         if (rc < 0)
             rbuf = 0;
 
-        rc = getsockopt (fd, SOL_SOCKET, SO_SNDBUF, &sbuf, &sbuf_len);
+        rc = getsockopt (fd, SOL_SOCKET, SO_SNDBUF, (void *) &sbuf, &sbuf_len);
         if (rc < 0)
             sbuf = 0;
 
@@ -147,7 +147,7 @@ rebind_ipv6 (tr_session *ss, bool force)
 #ifdef IPV6_V6ONLY
         /* Since we always open an IPv4 socket on the same port, this
            shouldn't matter.  But I'm superstitious. */
-        setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof (one));
+        setsockopt (s, IPPROTO_IPV6, IPV6_V6ONLY, (const void *) &one, sizeof (one));
 #endif
 
     memset (&sin6, 0, sizeof (sin6));
@@ -205,7 +205,7 @@ event_callback (evutil_socket_t s, short type UNUSED, void *sv)
     assert (type == EV_READ);
 
     fromlen = sizeof (from);
-    rc = recvfrom (s, buf, 4096 - 1, 0,
+    rc = recvfrom (s, (void *) buf, 4096 - 1, 0,
                 (struct sockaddr*)&from, &fromlen);
 
     /* Since most packets we receive here are ÂµTP, make quick inline
index ca87e48965dc0160074d239f8535eed96b12c3c7..90d12860acd8636225322ff24919bc4878823be3 100644 (file)
@@ -131,9 +131,9 @@ tr_utpSendTo (void *closure, const unsigned char *buf, size_t buflen,
     tr_session *ss = closure;
 
     if (to->sa_family == AF_INET && ss->udp_socket)
-        sendto (ss->udp_socket, buf, buflen, 0, to, tolen);
+        sendto (ss->udp_socket, (const void *) buf, buflen, 0, to, tolen);
     else if (to->sa_family == AF_INET6 && ss->udp_socket)
-        sendto (ss->udp6_socket, buf, buflen, 0, to, tolen);
+        sendto (ss->udp6_socket, (const void *) buf, buflen, 0, to, tolen);
 }
 
 static void
index 1dfacf01b5c4b1e5050b55bc9d0afa5d47f10629..79b56a79396257895228fcd5b4941f097a681adb 100644 (file)
@@ -147,8 +147,8 @@ sockoptfunction (void * vtask, curl_socket_t fd, curlsocktype purpose UNUSED)
     {
       const int sndbuf = isScrape ? 4096 : 1024;
       const int rcvbuf = isScrape ? 4096 : 3072;
-      setsockopt (fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof (sndbuf));
-      setsockopt (fd, SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof (rcvbuf));
+      setsockopt (fd, SOL_SOCKET, SO_SNDBUF, (const void *) &sndbuf, sizeof (sndbuf));
+      setsockopt (fd, SOL_SOCKET, SO_RCVBUF, (const void *) &rcvbuf, sizeof (rcvbuf));
     }
 
   /* return nonzero if this function encountered an error */