diff options
author | wtchang%redhat.com <devnull@localhost> | 2005-06-20 22:05:20 +0000 |
---|---|---|
committer | wtchang%redhat.com <devnull@localhost> | 2005-06-20 22:05:20 +0000 |
commit | 3d7dcae8690b06ffc0276fe2dd81f497ce0da528 (patch) | |
tree | 135f9c7df9169152d0de9f44e84a838784f9ea82 | |
parent | 69561d06a566e704b85aff1f2d9e2ff9be98e625 (diff) | |
download | nspr-hg-3d7dcae8690b06ffc0276fe2dd81f497ce0da528.tar.gz |
Bugzilla Bug 294017: make PR_NETADDR_SIZE return the correct value on
Windows because Windows' struct in6_addr has different alignment from
PRIPv6Addr. The patch is contributed by Shanmu <shanmus@gmail.com>. r=wtc.
Modified Files: md/_win95.h md/_winnt.h private/primpl.h
-rw-r--r-- | pr/include/md/_win95.h | 16 | ||||
-rw-r--r-- | pr/include/md/_winnt.h | 16 | ||||
-rw-r--r-- | pr/include/private/primpl.h | 2 |
3 files changed, 33 insertions, 1 deletions
diff --git a/pr/include/md/_win95.h b/pr/include/md/_win95.h index 4e61fdf3..cd26bd63 100644 --- a/pr/include/md/_win95.h +++ b/pr/include/md/_win95.h @@ -72,6 +72,22 @@ struct addrinfo { struct addrinfo *ai_next; }; #endif +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on Windows */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + } _S6_un; +}; +/* isomorphic to struct sockaddr_in6 on Windows */ +struct _md_sockaddr_in6 { + PRInt16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; +}; #endif #define _PR_HAVE_THREADSAFE_GETHOST #define _PR_HAVE_ATOMIC_OPS diff --git a/pr/include/md/_winnt.h b/pr/include/md/_winnt.h index 36cbcfae..0e6ce819 100644 --- a/pr/include/md/_winnt.h +++ b/pr/include/md/_winnt.h @@ -87,6 +87,22 @@ struct addrinfo { struct addrinfo *ai_next; }; #endif +#define _PR_HAVE_MD_SOCKADDR_IN6 +/* isomorphic to struct in6_addr on Windows */ +struct _md_in6_addr { + union { + PRUint8 _S6_u8[16]; + PRUint16 _S6_u16[8]; + } _S6_un; +}; +/* isomorphic to struct sockaddr_in6 on Windows */ +struct _md_sockaddr_in6 { + PRInt16 sin6_family; + PRUint16 sin6_port; + PRUint32 sin6_flowinfo; + struct _md_in6_addr sin6_addr; + PRUint32 sin6_scope_id; +}; #endif #define _PR_HAVE_THREADSAFE_GETHOST #define _PR_HAVE_ATOMIC_OPS diff --git a/pr/include/private/primpl.h b/pr/include/private/primpl.h index 07d4a3ed..eebcb841 100644 --- a/pr/include/private/primpl.h +++ b/pr/include/private/primpl.h @@ -1409,7 +1409,7 @@ extern PRUintn _PR_NetAddrSize(const PRNetAddr* addr); #define PR_NETADDR_SIZE(_addr) \ ((_addr)->raw.family == PR_AF_INET \ ? sizeof((_addr)->inet) \ - : sizeof(struct _md_sockaddr_in6) + : sizeof(struct _md_sockaddr_in6)) #endif /* defined(XP_UNIX) */ #else |