ws2_32: Replace switch statement with more suitable if statement
Andrew Talbot
andrew.talbot at talbotville.com
Thu Oct 20 15:37:09 CDT 2011
Changelog:
ws2_32: Replace switch statement with more suitable if statement.
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 7a1947f..60fee6a 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5355,14 +5355,18 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
}
if ( af == AF_UNSPEC) /* did they not specify the address family? */
- switch(protocol)
- {
- case IPPROTO_TCP:
- if (type == SOCK_STREAM) { af = AF_INET; break; }
- case IPPROTO_UDP:
- if (type == SOCK_DGRAM) { af = AF_INET; break; }
- default: SetLastError(WSAEPROTOTYPE); return INVALID_SOCKET;
+ {
+ if ((protocol == IPPROTO_TCP && type == SOCK_STREAM) ||
+ (protocol == IPPROTO_UDP && type == SOCK_DGRAM))
+ {
+ af = AF_INET;
}
+ else
+ {
+ SetLastError(WSAEPROTOTYPE);
+ return INVALID_SOCKET;
+ }
+ }
SERVER_START_REQ( create_socket )
{
More information about the wine-patches
mailing list