Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: runtime/bin/socket_win.cc

Issue 10411069: Make the Dart standalone VM run on Windows XP (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_win.cc
diff --git a/runtime/bin/socket_win.cc b/runtime/bin/socket_win.cc
index 6dabff24ef382531aeaf3ab0126def5ec1691254..edb217fcbcbfdf2f674289ac343aa612df666de8 100644
--- a/runtime/bin/socket_win.cc
+++ b/runtime/bin/socket_win.cc
@@ -191,15 +191,19 @@ const char* Socket::LookupIPv4Address(char* host, OSError** os_error) {
// Convert the address into IPv4 dotted decimal notation.
char* buffer = reinterpret_cast<char*>(malloc(INET_ADDRSTRLEN));
sockaddr_in *sockaddr = reinterpret_cast<sockaddr_in *>(info->ai_addr);
- const char* result = inet_ntop(AF_INET,
- reinterpret_cast<void *>(&sockaddr->sin_addr),
- buffer,
- INET_ADDRSTRLEN);
- if (result == NULL) {
+
+ // Clear the port before calling WSAAddressToString as WSAAddressToString
+ // includes the port in the formatted string.
+ DWORD len = INET_ADDRSTRLEN;
+ int err = WSAAddressToString(reinterpret_cast<LPSOCKADDR>(sockaddr),
+ sizeof(sockaddr_in),
+ NULL,
+ buffer,
+ &len);
+ if (err != 0) {
free(buffer);
return NULL;
}
- ASSERT(result == buffer);
return buffer;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698