ws2_32: Add the scope_id to the IPv6 address string if present.

This commit is contained in:
Jeff Latimer 2009-07-28 19:40:39 +10:00 committed by Alexandre Julliard
parent 4028a0e9f0
commit f40cbb3d77
2 changed files with 2 additions and 12 deletions

View File

@ -4967,6 +4967,8 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len,
WSASetLastError(WSAEINVAL);
return SOCKET_ERROR;
}
if ((sockaddr6->sin6_scope_id))
sprintf(buffer+strlen(buffer), "%%%u", sockaddr6->sin6_scope_id);
if ((sockaddr6->sin6_port))
sprintf(buffer+strlen(buffer), "]:%u", ntohs(sockaddr6->sin6_port));
break;

View File

@ -1442,11 +1442,8 @@ static void test_WSAAddressToStringA(void)
ret = WSAAddressToStringA( (SOCKADDR*)&sockaddr6, sizeof(sockaddr6), NULL, address6, &len );
ok( !ret, "WSAAddressToStringA() failed unexpectedly: %d\n", WSAGetLastError() );
todo_wine
{
ok( !strcmp( address6, expect6_3_2 ), "Expected: %s, got: %s\n", expect6_3_2, address6 );
ok( len == sizeof(expect6_3_2), "Got size %d\n", len);
}
/* Test IPv6 address and scope_id */
len = sizeof(address6);
@ -1458,11 +1455,8 @@ static void test_WSAAddressToStringA(void)
ret = WSAAddressToStringA( (SOCKADDR*)&sockaddr6, sizeof(sockaddr6), NULL, address6, &len );
ok( !ret, "WSAAddressToStringA() failed unexpectedly: %d\n", WSAGetLastError() );
todo_wine
{
ok( !strcmp( address6, expect6_3_3 ), "Expected: %s, got: %s\n", expect6_3_3, address6 );
ok( len == sizeof(expect6_3_3), "Got size %d\n", len);
}
end:
if (v6 != INVALID_SOCKET)
@ -1613,11 +1607,8 @@ static void test_WSAAddressToStringW(void)
ret = WSAAddressToStringW( (SOCKADDR*)&sockaddr6, sizeof(sockaddr6), NULL, address6, &len );
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
todo_wine
{
ok( !lstrcmpW( address6, expect6_3_2 ), "Wrong string returned\n" );
ok( len == sizeof(expect6_3_2)/sizeof(WCHAR), "Got %d\n", len);
}
/* Test IPv6 address and scope_id */
len = sizeof(address6)/sizeof(WCHAR);
@ -1629,11 +1620,8 @@ static void test_WSAAddressToStringW(void)
ret = WSAAddressToStringW( (SOCKADDR*)&sockaddr6, sizeof(sockaddr6), NULL, address6, &len );
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
todo_wine
{
ok( !lstrcmpW( address6, expect6_3_3 ), "Wrong string returned\n" );
ok( len == sizeof(expect6_3_3)/sizeof(WCHAR), "Got %d\n", len);
}
end:
if (v6 != INVALID_SOCKET)