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

Side by Side Diff: net/tools/quic/quic_socket_utils.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gpu/gpu.gyp ('k') | remoting/client/plugin/pepper_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/tools/quic/quic_socket_utils.h" 5 #include "net/tools/quic/quic_socket_utils.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 25 matching lines...) Expand all
36 } 36 }
37 ret.assign(addr_data, addr_data + len); 37 ret.assign(addr_data, addr_data + len);
38 break; 38 break;
39 } 39 }
40 } 40 }
41 return ret; 41 return ret;
42 } 42 }
43 43
44 // static 44 // static
45 bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr *hdr, 45 bool QuicSocketUtils::GetOverflowFromMsghdr(struct msghdr *hdr,
46 int *dropped_packets) { 46 int *dropped_packets) {
47 if (hdr->msg_controllen > 0) { 47 if (hdr->msg_controllen > 0) {
48 struct cmsghdr *cmsg; 48 struct cmsghdr *cmsg;
49 for (cmsg = CMSG_FIRSTHDR(hdr); 49 for (cmsg = CMSG_FIRSTHDR(hdr);
50 cmsg != NULL; 50 cmsg != NULL;
51 cmsg = CMSG_NXTHDR(hdr, cmsg)) { 51 cmsg = CMSG_NXTHDR(hdr, cmsg)) {
52 if (cmsg->cmsg_type == SO_RXQ_OVFL) { 52 if (cmsg->cmsg_type == SO_RXQ_OVFL) {
53 *dropped_packets = *(reinterpret_cast<int*>CMSG_DATA(cmsg)); 53 memcpy(dropped_packets, CMSG_DATA(cmsg), sizeof(*dropped_packets));
54 return true; 54 return true;
55 } 55 }
56 } 56 }
57 } 57 }
58 return false; 58 return false;
59 } 59 }
60 60
61 // static 61 // static
62 int QuicSocketUtils::SetGetAddressInfo(int fd, int address_family) { 62 int QuicSocketUtils::SetGetAddressInfo(int fd, int address_family) {
63 int get_local_ip = 1; 63 int get_local_ip = 1;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 hdr.msg_controllen = cmsg->cmsg_len; 182 hdr.msg_controllen = cmsg->cmsg_len;
183 } 183 }
184 184
185 int rc = sendmsg(fd, &hdr, 0); 185 int rc = sendmsg(fd, &hdr, 0);
186 *error = (rc >= 0) ? 0 : errno; 186 *error = (rc >= 0) ? 0 : errno;
187 return rc; 187 return rc;
188 } 188 }
189 189
190 } // namespace tools 190 } // namespace tools
191 } // namespace net 191 } // namespace net
OLDNEW
« no previous file with comments | « gpu/gpu.gyp ('k') | remoting/client/plugin/pepper_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698