- Remove unreachable code, CID 53

- Simplify parameter checks, fix return value, set last error correctly, fix typo

svn path=/trunk/; revision=37940
This commit is contained in:
Gregor Schneider 2008-12-08 16:27:28 +00:00
parent 8019ca7330
commit 866e5d59a0

View file

@ -382,7 +382,7 @@ WSAStringToAddressA(IN LPSTR AddressString,
/* /*
* @implement * @implemented
*/ */
INT INT
EXPORT EXPORT
@ -396,14 +396,15 @@ WSAStringToAddressW(IN LPWSTR AddressString,
int res=0; int res=0;
LONG inetaddr = 0; LONG inetaddr = 0;
LPWSTR *bp=NULL; LPWSTR *bp=NULL;
SOCKADDR_IN *sockaddr;
SOCKADDR_IN *sockaddr = (SOCKADDR_IN *) lpAddress; if (!lpAddressLength || !lpAddress || !AddressString)
{
if (!lpAddressLength || !lpAddress) WSASetLastError(WSAEINVAL);
return SOCKET_ERROR; return SOCKET_ERROR;
}
if (AddressString==NULL) sockaddr = (SOCKADDR_IN *) lpAddress;
return WSAEINVAL;
/* Set right adress family */ /* Set right adress family */
if (lpProtocolInfo!=NULL) if (lpProtocolInfo!=NULL)
@ -421,11 +422,7 @@ WSAStringToAddressW(IN LPWSTR AddressString,
} }
else else
{ {
if (!lpAddress) // translate ip string to ip
res = WSAEINVAL;
else
{
// translate now ip string to ip
/* rest sockaddr.sin_addr.s_addr /* rest sockaddr.sin_addr.s_addr
for we need to be sure it is zero when we come to while */ for we need to be sure it is zero when we come to while */
@ -459,7 +456,6 @@ WSAStringToAddressW(IN LPWSTR AddressString,
res = 0; res = 0;
sockaddr->sin_addr.s_addr = inetaddr; sockaddr->sin_addr.s_addr = inetaddr;
}
} }
} }