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

Unified Diff: runtime/bin/socket.h

Issue 14139032: Fix broken Mac OS socket code (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket.h
diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h
index 84a8aa67ad264c1437699ee1ed79495cbaa573dc..b4134aa81dbfafc00760ae40ff84c0b969f90b81 100644
--- a/runtime/bin/socket.h
+++ b/runtime/bin/socket.h
@@ -25,10 +25,9 @@
union RawAddr {
- // ss_family is always at ofset 0, thus we can add it here.
- uint16_t ss_family;
struct sockaddr_in in;
struct sockaddr_in6 in6;
+ struct sockaddr_storage ss;
struct sockaddr addr;
};
@@ -43,7 +42,7 @@ class SocketAddress {
explicit SocketAddress(struct addrinfo* addrinfo);
int GetType() {
- if (addr_.ss_family == AF_INET6) return TYPE_IPV6;
+ if (addr_.ss.ss_family == AF_INET6) return TYPE_IPV6;
return TYPE_IPV4;
}
@@ -51,7 +50,7 @@ class SocketAddress {
const RawAddr& addr() const { return addr_; }
static intptr_t GetAddrLength(const RawAddr& addr) {
- return addr.ss_family == AF_INET6 ?
+ return addr.ss.ss_family == AF_INET6 ?
sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in);
}
@@ -63,7 +62,7 @@ class SocketAddress {
}
static void SetAddrPort(RawAddr* addr, intptr_t port) {
- if (addr->ss_family == AF_INET) {
+ if (addr->ss.ss_family == AF_INET) {
addr->in.sin_port = htons(port);
} else {
addr->in6.sin6_port = htons(port);
@@ -71,7 +70,7 @@ class SocketAddress {
}
static intptr_t GetAddrPort(RawAddr* addr) {
- if (addr->ss_family == AF_INET) {
+ if (addr->ss.ss_family == AF_INET) {
return ntohs(addr->in.sin_port);
} else {
return ntohs(addr->in6.sin6_port);
« no previous file with comments | « no previous file | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698