Henri Verbeet : ws2_32: Simplify some address calculations for SIO_ADDRESS_LIST_QUERY.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Oct 7 14:49:56 CDT 2014
Module: wine
Branch: master
Commit: c0e49c5c40c064e4a7a4ddaeaf039ca0813b7d84
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c0e49c5c40c064e4a7a4ddaeaf039ca0813b7d84
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Oct 7 08:41:13 2014 +0200
ws2_32: Simplify some address calculations for SIO_ADDRESS_LIST_QUERY.
---
dlls/ws2_32/socket.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index aba7d3f..8b60fb3 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3963,9 +3963,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
for (p = table, num = 0; p; p = p->Next)
if (p->IpAddressList.IpAddress.String[0]) num++;
- total = sizeof(SOCKET_ADDRESS_LIST) + sizeof(SOCKET_ADDRESS) * (num - 1);
- total += sizeof(SOCKADDR) * num;
-
+ total = FIELD_OFFSET(SOCKET_ADDRESS_LIST, Address[num]) + num * sizeof(*sockaddr);
if (total > out_size || !out_buff)
{
*ret_size = total;
@@ -3976,7 +3974,7 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
sa_list = out_buff;
sa = sa_list->Address;
- sockaddr = (SOCKADDR_IN *)((char *)sa + num * sizeof(SOCKET_ADDRESS));
+ sockaddr = (SOCKADDR_IN *)&sa[num];
sa_list->iAddressCount = num;
for (p = table, i = 0; p; p = p->Next)
More information about the wine-cvs
mailing list