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

Side by Side Diff: net/base/address_list.cc

Issue 1158923005: Use the exact-width integer types defined in <stdint.h> rather than (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments. Exclude mime_sniffer*. Rebase. Created 5 years, 6 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
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/base/address_list.h" 5 #include "net/base/address_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 23 matching lines...) Expand all
34 AddressList::AddressList() {} 34 AddressList::AddressList() {}
35 35
36 AddressList::~AddressList() {} 36 AddressList::~AddressList() {}
37 37
38 AddressList::AddressList(const IPEndPoint& endpoint) { 38 AddressList::AddressList(const IPEndPoint& endpoint) {
39 push_back(endpoint); 39 push_back(endpoint);
40 } 40 }
41 41
42 // static 42 // static
43 AddressList AddressList::CreateFromIPAddress(const IPAddressNumber& address, 43 AddressList AddressList::CreateFromIPAddress(const IPAddressNumber& address,
44 uint16 port) { 44 uint16_t port) {
45 return AddressList(IPEndPoint(address, port)); 45 return AddressList(IPEndPoint(address, port));
46 } 46 }
47 47
48 // static 48 // static
49 AddressList AddressList::CreateFromIPAddressList( 49 AddressList AddressList::CreateFromIPAddressList(
50 const IPAddressList& addresses, 50 const IPAddressList& addresses,
51 const std::string& canonical_name) { 51 const std::string& canonical_name) {
52 AddressList list; 52 AddressList list;
53 list.set_canonical_name(canonical_name); 53 list.set_canonical_name(canonical_name);
54 for (IPAddressList::const_iterator iter = addresses.begin(); 54 for (IPAddressList::const_iterator iter = addresses.begin();
(...skipping 14 matching lines...) Expand all
69 // NOTE: Ignoring non-INET* families. 69 // NOTE: Ignoring non-INET* families.
70 if (ipe.FromSockAddr(ai->ai_addr, ai->ai_addrlen)) 70 if (ipe.FromSockAddr(ai->ai_addr, ai->ai_addrlen))
71 list.push_back(ipe); 71 list.push_back(ipe);
72 else 72 else
73 DLOG(WARNING) << "Unknown family found in addrinfo: " << ai->ai_family; 73 DLOG(WARNING) << "Unknown family found in addrinfo: " << ai->ai_family;
74 } 74 }
75 return list; 75 return list;
76 } 76 }
77 77
78 // static 78 // static
79 AddressList AddressList::CopyWithPort(const AddressList& list, uint16 port) { 79 AddressList AddressList::CopyWithPort(const AddressList& list, uint16_t port) {
80 AddressList out; 80 AddressList out;
81 out.set_canonical_name(list.canonical_name()); 81 out.set_canonical_name(list.canonical_name());
82 for (size_t i = 0; i < list.size(); ++i) 82 for (size_t i = 0; i < list.size(); ++i)
83 out.push_back(IPEndPoint(list[i].address(), port)); 83 out.push_back(IPEndPoint(list[i].address(), port));
84 return out; 84 return out;
85 } 85 }
86 86
87 void AddressList::SetDefaultCanonicalName() { 87 void AddressList::SetDefaultCanonicalName() {
88 DCHECK(!empty()); 88 DCHECK(!empty());
89 set_canonical_name(front().ToStringWithoutPort()); 89 set_canonical_name(front().ToStringWithoutPort());
90 } 90 }
91 91
92 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const { 92 NetLog::ParametersCallback AddressList::CreateNetLogCallback() const {
93 return base::Bind(&NetLogAddressListCallback, this); 93 return base::Bind(&NetLogAddressListCallback, this);
94 } 94 }
95 95
96 } // namespace net 96 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698