| Index: runtime/bin/socket_win.cc
|
| diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
|
| index adc6aef87ae7026ad3dabfa9f11e29ee513644c3..fdefef2abbd9d1444f800b6d44510fb0cd3aacae 100644
|
| --- a/runtime/bin/socket_win.cc
|
| +++ b/runtime/bin/socket_win.cc
|
| @@ -66,12 +66,14 @@ bool Socket::GetRemotePeer(intptr_t fd, char *host, intptr_t *port) {
|
| // Clear the port before calling WSAAddressToString as WSAAddressToString
|
| // includes the port in the formatted string.
|
| socket_address.sin_port = 0;
|
| + wchar_t* unicode_host = StringUtils::Utf8ToWide(host);
|
| DWORD len = INET_ADDRSTRLEN;
|
| - int err = WSAAddressToString(reinterpret_cast<LPSOCKADDR>(&socket_address),
|
| - sizeof(socket_address),
|
| - NULL,
|
| - host,
|
| - &len);
|
| + int err = WSAAddressToStringW(reinterpret_cast<LPSOCKADDR>(&socket_address),
|
| + sizeof(socket_address),
|
| + NULL,
|
| + unicode_host,
|
| + &len);
|
| + free(unicode_host);
|
| if (err != 0) {
|
| Log::PrintErr("Error WSAAddressToString: %d\n", WSAGetLastError());
|
| return false;
|
| @@ -195,12 +197,14 @@ const char* Socket::LookupIPv4Address(char* host, OSError** os_error) {
|
|
|
| // Clear the port before calling WSAAddressToString as WSAAddressToString
|
| // includes the port in the formatted string.
|
| + wchar_t* unicode_buffer = StringUtils::Utf8ToWide(buffer);
|
| DWORD len = INET_ADDRSTRLEN;
|
| - int err = WSAAddressToString(reinterpret_cast<LPSOCKADDR>(sockaddr),
|
| - sizeof(sockaddr_in),
|
| - NULL,
|
| - buffer,
|
| - &len);
|
| + int err = WSAAddressToStringW(reinterpret_cast<LPSOCKADDR>(sockaddr),
|
| + sizeof(sockaddr_in),
|
| + NULL,
|
| + unicode_buffer,
|
| + &len);
|
| + free(unicode_buffer);
|
| if (err != 0) {
|
| free(buffer);
|
| return NULL;
|
|
|