Andrew Talbot : ws2_32: Cast-qual warnings fix.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Nov 24 06:19:33 CST 2006


Module: wine
Branch: master
Commit: d9cdd2341109524b9877cccc7a022aee51132b72
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d9cdd2341109524b9877cccc7a022aee51132b72

Author: Andrew Talbot <Andrew.Talbot at talbotville.com>
Date:   Thu Nov 23 22:39:34 2006 +0000

ws2_32: Cast-qual warnings fix.

---

 dlls/ws2_32/socket.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 727c118..e90c4b2 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -860,7 +860,7 @@ static struct sockaddr* ws_sockaddr_ws2u
 #endif
     case WS_AF_INET6: {
         struct sockaddr_in6* uin6;
-        const struct WS_sockaddr_in6* win6 = (struct WS_sockaddr_in6*)wsaddr;
+        const struct WS_sockaddr_in6* win6 = (const struct WS_sockaddr_in6*)wsaddr;
 
         /* Note: Windows has 2 versions of the sockaddr_in6 struct, one with
          * scope_id, one without. Check:
@@ -883,7 +883,7 @@ static struct sockaddr* ws_sockaddr_ws2u
     }
     case WS_AF_INET: {
         struct sockaddr_in* uin;
-        const struct WS_sockaddr_in* win = (struct WS_sockaddr_in*)wsaddr;
+        const struct WS_sockaddr_in* win = (const struct WS_sockaddr_in*)wsaddr;
 
         if (wsaddrlen<sizeof(struct WS_sockaddr_in))
             return NULL;
@@ -988,7 +988,7 @@ static int ws_sockaddr_u2ws(const struct
         break;
 #endif
     case AF_INET6: {
-        const struct sockaddr_in6* uin6 = (struct sockaddr_in6*)uaddr;
+        const struct sockaddr_in6* uin6 = (const struct sockaddr_in6*)uaddr;
         struct WS_sockaddr_in6_old* win6old = (struct WS_sockaddr_in6_old*)wsaddr;
 
         if (*wsaddrlen < sizeof(struct WS_sockaddr_in6_old))
@@ -1008,7 +1008,7 @@ static int ws_sockaddr_u2ws(const struct
         return 0;
     }
     case AF_INET: {
-        struct sockaddr_in* uin = (struct sockaddr_in*)uaddr;
+        const struct sockaddr_in* uin = (const struct sockaddr_in*)uaddr;
         struct WS_sockaddr_in* win = (struct WS_sockaddr_in*)wsaddr;
 
         if (*wsaddrlen < sizeof(struct WS_sockaddr_in))
@@ -2699,8 +2699,8 @@ int WINAPI WS_setsockopt(SOCKET s, int l
             SetLastError(WSAEFAULT);
             return SOCKET_ERROR;
         }
-        get_per_thread_data()->opentype = *(int *)optval;
-        TRACE("setting global SO_OPENTYPE to 0x%x\n", *(int *)optval );
+        get_per_thread_data()->opentype = *(const int *)optval;
+        TRACE("setting global SO_OPENTYPE to 0x%x\n", *(const int *)optval );
         return 0;
     }
 
@@ -2721,7 +2721,7 @@ int WINAPI WS_setsockopt(SOCKET s, int l
 	{
 	    case IPX_PTYPE:
 		fd = get_sock_fd( s, 0, NULL );
-		TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(int*)optval, fd);
+		TRACE("trying to set IPX_PTYPE: %d (fd: %d)\n", *(const int*)optval, fd);
 		
 		/* We try to set the ipx type on ipx socket level. */
 #ifdef SOL_IPX
@@ -2758,13 +2758,13 @@ int WINAPI WS_setsockopt(SOCKET s, int l
     /* Is a privileged and useless operation, so we don't. */
     if ((optname == WS_SO_DEBUG) && (level == WS_SOL_SOCKET))
     {
-        FIXME("(%d,SOL_SOCKET,SO_DEBUG,%p(%d)) attempted (is privileged). Ignoring.\n",s,optval,*(DWORD*)optval);
+        FIXME("(%d,SOL_SOCKET,SO_DEBUG,%p(%d)) attempted (is privileged). Ignoring.\n",s,optval,*(const DWORD*)optval);
         return 0;
     }
 
     if(optname == WS_SO_DONTLINGER && level == WS_SOL_SOCKET) {
         /* This is unique to WinSock and takes special conversion */
-        linger.l_onoff  = *((int*)optval) ? 0: 1;
+        linger.l_onoff  = *((const int*)optval) ? 0: 1;
         linger.l_linger = 0;
         optname=SO_LINGER;
         optval = (char*)&linger;
@@ -2788,7 +2788,7 @@ int WINAPI WS_setsockopt(SOCKET s, int l
         }
         else if (optval && optlen < sizeof(int))
         {
-            woptval= *((INT16 *) optval);
+            woptval= *((const INT16 *) optval);
             optval= (char*) &woptval;
             optlen=sizeof(int);
         }
@@ -2796,8 +2796,8 @@ int WINAPI WS_setsockopt(SOCKET s, int l
         {
             if (optlen == sizeof(UINT32)) {
                 /* WinSock passes miliseconds instead of struct timeval */
-                tval.tv_usec = (*(PUINT32)optval % 1000) * 1000;
-                tval.tv_sec = *(PUINT32)optval / 1000;
+                tval.tv_usec = (*(const UINT32*)optval % 1000) * 1000;
+                tval.tv_sec = *(const UINT32*)optval / 1000;
                 /* min of 500 milisec */
                 if (tval.tv_sec == 0 && tval.tv_usec < 500000)
                     tval.tv_usec = 500000;
@@ -2810,9 +2810,9 @@ int WINAPI WS_setsockopt(SOCKET s, int l
                 return 0;
             }
         }
-        if (level == SOL_SOCKET && optname == SO_RCVBUF && *(int*)optval < 2048)
+        if (level == SOL_SOCKET && optname == SO_RCVBUF && *(const int*)optval < 2048)
         {
-            WARN("SO_RCVBF for %d bytes is too small: ignored\n", *(int*)optval );
+            WARN("SO_RCVBF for %d bytes is too small: ignored\n", *(const int*)optval );
             return 0;
         }
     }




More information about the wine-cvs mailing list