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

Unified Diff: remoting/client/plugin/pepper_util.cc

Issue 12091004: POSIX: re-enable strict aliasing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years, 4 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 | « net/tools/quic/quic_socket_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/plugin/pepper_util.cc
diff --git a/remoting/client/plugin/pepper_util.cc b/remoting/client/plugin/pepper_util.cc
index 3dc8e81634188769a99a3ec1aaa2e881b8dd68f6..eed4e003bea18bb0718a9249510ffecfb4832f5d 100644
--- a/remoting/client/plugin/pepper_util.cc
+++ b/remoting/client/plugin/pepper_util.cc
@@ -59,19 +59,21 @@ bool SocketAddressToPpAddress(const talk_base::SocketAddress& address,
bool PpAddressToSocketAddress(const PP_NetAddress_Private& pp_address,
talk_base::SocketAddress* address) {
- uint8_t addr_storage[16];
+ union {
+ in_addr ip4;
+ in6_addr ip6;
+ uint8_t raw[16];
+ } addr_storage;
bool result = pp::NetAddressPrivate::GetAddress(
- pp_address, &addr_storage, sizeof(addr_storage));
+ pp_address, &addr_storage.raw, sizeof(addr_storage.raw));
if (result) {
switch (pp::NetAddressPrivate::GetFamily(pp_address)) {
case PP_NETADDRESSFAMILY_PRIVATE_IPV4:
- address->SetIP(talk_base::IPAddress(
- *reinterpret_cast<in_addr*>(addr_storage)));
+ address->SetIP(talk_base::IPAddress(addr_storage.ip4));
break;
case PP_NETADDRESSFAMILY_PRIVATE_IPV6:
- address->SetIP(talk_base::IPAddress(
- *reinterpret_cast<in6_addr*>(addr_storage)));
+ address->SetIP(talk_base::IPAddress(addr_storage.ip6));
break;
default:
result = false;
« no previous file with comments | « net/tools/quic/quic_socket_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698