Hello Walter, thanks for the patch!
Note that all patches need a Signed-off-by tag, to denote that the patch meets the technical and legal requirements of the project.
With respect to the content of this patch, do you have an application that needs this? Failing that, I'm not sure it's worth adding to the code. Yes, the tests confirm it, but it's more code to add for no good reason.
On 4/18/21 3:36 PM, Walter Procyk wrote:
dlls/ws2_32/socket.c | 17 +++++++++-------- dlls/ws2_32/tests/sock.c | 10 ++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 262171ebab0..1d0caab5d1c 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -4253,13 +4253,14 @@ WS_u_short WINAPI WS_htons(WS_u_short hostshort)
/***********************************************************************
WSAHtonl (WS2_32.46)
- From MSDN description of error codes, this function should also
- check if WinSock has been initialized and the socket is a valid
- socket. But why? This function only translates a host byte order
*/ int WINAPI WSAHtonl(SOCKET s, WS_u_long hostlong, WS_u_long *lpnetlong) {
- u_long into a network byte order u_long...
- if(!num_startup){
SetLastError(WSANOTINITIALISED);
return SOCKET_ERROR;
- }
if (lpnetlong) { *lpnetlong = htonl(hostlong);
@@ -4271,13 +4272,13 @@ int WINAPI WSAHtonl(SOCKET s, WS_u_long hostlong, WS_u_long *lpnetlong)
/***********************************************************************
WSAHtons (WS2_32.47)
- From MSDN description of error codes, this function should also
- check if WinSock has been initialized and the socket is a valid
- socket. But why? This function only translates a host byte order
*/ int WINAPI WSAHtons(SOCKET s, WS_u_short hostshort, WS_u_short *lpnetshort) {
- u_short into a network byte order u_short...
if(!num_startup){
SetLastError(WSANOTINITIALISED);
return SOCKET_ERROR;
}
if (lpnetshort) {
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 5a1a271b099..90987532b03 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1089,6 +1089,16 @@ static void test_WithoutWSAStartup(void) ok(gethostbyname("localhost") == NULL, "gethostbyname() succeeded unexpectedly\n"); err = WSAGetLastError(); ok(err == WSANOTINITIALISED, "Expected 10093, received %d\n", err);
WSASetLastError(0xdeadbeef);
ok(SOCKET_ERROR == WSAHtonl(0, 0, 0), "Expected SOCKET_ERROR, but was successful\n");
err = WSAGetLastError();
ok(err == WSANOTINITIALISED, "Expected 10093, received %d\n", err);
WSASetLastError(0xdeadbeef);
ok(SOCKET_ERROR == WSAHtons(0, 0, 0), "Expected SOCKET_ERROR, but was successful\n");
err = WSAGetLastError();
ok(err == WSANOTINITIALISED, "Expected 10093, received %d\n", err); }
static void test_WithWSAStartup(void)