From: Orvid King Date: Mon, 14 Sep 2015 17:47:08 +0000 (-0700) Subject: Handle MSVC correctly in detail/IPAddress.h X-Git-Tag: deprecate-dynamic-initializer~412 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=020e1260daf42445e30f84fe81fc7eafde5fb7b0;p=folly.git Handle MSVC correctly in detail/IPAddress.h Summary: Winsock's structures don't have a member named `s6_addr16`, so use the name for Winsock's structure. Closes https://github.com/facebook/folly/pull/279 Reviewed By: @yfeldblum Differential Revision: D2284223 Pulled By: @JoelMarcey --- diff --git a/folly/detail/IPAddress.h b/folly/detail/IPAddress.h index 0ebd76f7..afb3f9f6 100644 --- a/folly/detail/IPAddress.h +++ b/folly/detail/IPAddress.h @@ -283,7 +283,11 @@ inline std::string fastIpv4ToString( } inline std::string fastIpv6ToString(const in6_addr& in6Addr) { +#ifdef _MSC_VER + const uint16_t* bytes = reinterpret_cast(&in6Addr.u.Word); +#else const uint16_t* bytes = reinterpret_cast(&in6Addr.s6_addr16); +#endif char str[sizeof("2001:0db8:0000:0000:0000:ff00:0042:8329")]; char* buf = str;