Andrew Talbot : ws2_32: Replace switch statement with more suitable if statement.
Alexandre Julliard
julliard at winehq.org
Fri Oct 21 11:01:59 CDT 2011
Module: wine
Branch: master
Commit: 35555862fcdc6f489b6b27a62d12dbfaf3bda838
URL: http://source.winehq.org/git/wine.git/?a=commit;h=35555862fcdc6f489b6b27a62d12dbfaf3bda838
Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date: Thu Oct 20 21:37:09 2011 +0100
ws2_32: Replace switch statement with more suitable if statement.
---
dlls/ws2_32/socket.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index e8f781f..219e954 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -5356,14 +5356,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-cvs
mailing list