ws2_32: Cast-qual warnings fix.

This commit is contained in:
Andrew Talbot 2006-11-23 22:39:34 +00:00 committed by Alexandre Julliard
parent 972826b267
commit d9cdd23411
1 changed files with 14 additions and 14 deletions

View File

@ -860,7 +860,7 @@ static struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, int w
#endif #endif
case WS_AF_INET6: { case WS_AF_INET6: {
struct sockaddr_in6* uin6; 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 /* Note: Windows has 2 versions of the sockaddr_in6 struct, one with
* scope_id, one without. Check: * scope_id, one without. Check:
@ -883,7 +883,7 @@ static struct sockaddr* ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, int w
} }
case WS_AF_INET: { case WS_AF_INET: {
struct sockaddr_in* uin; 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)) if (wsaddrlen<sizeof(struct WS_sockaddr_in))
return NULL; return NULL;
@ -988,7 +988,7 @@ static int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct W
break; break;
#endif #endif
case AF_INET6: { 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; struct WS_sockaddr_in6_old* win6old = (struct WS_sockaddr_in6_old*)wsaddr;
if (*wsaddrlen < sizeof(struct WS_sockaddr_in6_old)) if (*wsaddrlen < sizeof(struct WS_sockaddr_in6_old))
@ -1008,7 +1008,7 @@ static int ws_sockaddr_u2ws(const struct sockaddr* uaddr, int uaddrlen, struct W
return 0; return 0;
} }
case AF_INET: { 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; struct WS_sockaddr_in* win = (struct WS_sockaddr_in*)wsaddr;
if (*wsaddrlen < sizeof(struct WS_sockaddr_in)) if (*wsaddrlen < sizeof(struct WS_sockaddr_in))
@ -2699,8 +2699,8 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
SetLastError(WSAEFAULT); SetLastError(WSAEFAULT);
return SOCKET_ERROR; return SOCKET_ERROR;
} }
get_per_thread_data()->opentype = *(int *)optval; get_per_thread_data()->opentype = *(const int *)optval;
TRACE("setting global SO_OPENTYPE to 0x%x\n", *(int *)optval ); TRACE("setting global SO_OPENTYPE to 0x%x\n", *(const int *)optval );
return 0; return 0;
} }
@ -2721,7 +2721,7 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
{ {
case IPX_PTYPE: case IPX_PTYPE:
fd = get_sock_fd( s, 0, NULL ); 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. */ /* We try to set the ipx type on ipx socket level. */
#ifdef SOL_IPX #ifdef SOL_IPX
@ -2758,13 +2758,13 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
/* Is a privileged and useless operation, so we don't. */ /* Is a privileged and useless operation, so we don't. */
if ((optname == WS_SO_DEBUG) && (level == WS_SOL_SOCKET)) 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; return 0;
} }
if(optname == WS_SO_DONTLINGER && level == WS_SOL_SOCKET) { if(optname == WS_SO_DONTLINGER && level == WS_SOL_SOCKET) {
/* This is unique to WinSock and takes special conversion */ /* 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; linger.l_linger = 0;
optname=SO_LINGER; optname=SO_LINGER;
optval = (char*)&linger; optval = (char*)&linger;
@ -2788,7 +2788,7 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
} }
else if (optval && optlen < sizeof(int)) else if (optval && optlen < sizeof(int))
{ {
woptval= *((INT16 *) optval); woptval= *((const INT16 *) optval);
optval= (char*) &woptval; optval= (char*) &woptval;
optlen=sizeof(int); optlen=sizeof(int);
} }
@ -2796,8 +2796,8 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
{ {
if (optlen == sizeof(UINT32)) { if (optlen == sizeof(UINT32)) {
/* WinSock passes miliseconds instead of struct timeval */ /* WinSock passes miliseconds instead of struct timeval */
tval.tv_usec = (*(PUINT32)optval % 1000) * 1000; tval.tv_usec = (*(const UINT32*)optval % 1000) * 1000;
tval.tv_sec = *(PUINT32)optval / 1000; tval.tv_sec = *(const UINT32*)optval / 1000;
/* min of 500 milisec */ /* min of 500 milisec */
if (tval.tv_sec == 0 && tval.tv_usec < 500000) if (tval.tv_sec == 0 && tval.tv_usec < 500000)
tval.tv_usec = 500000; tval.tv_usec = 500000;
@ -2810,9 +2810,9 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
return 0; 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; return 0;
} }
} }