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

Unified Diff: net/base/net_util_win.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: net/base/net_util_win.cc
diff --git a/net/base/net_util_win.cc b/net/base/net_util_win.cc
index c3d9f3b3779d077e5969c09de388352b9579408d..892743f49aed78610768a0d6a785aafbd011be43 100644
--- a/net/base/net_util_win.cc
+++ b/net/base/net_util_win.cc
@@ -29,15 +29,19 @@ namespace net {
namespace {
struct WlanApi {
- typedef DWORD (WINAPI *WlanOpenHandleFunc)(
- DWORD, VOID*, DWORD*, HANDLE*);
- typedef DWORD (WINAPI *WlanEnumInterfacesFunc)(
- HANDLE, VOID*, WLAN_INTERFACE_INFO_LIST**);
- typedef DWORD (WINAPI *WlanQueryInterfaceFunc)(
- HANDLE, const GUID*, WLAN_INTF_OPCODE, VOID*, DWORD*, VOID**,
- WLAN_OPCODE_VALUE_TYPE*);
- typedef VOID (WINAPI *WlanFreeMemoryFunc)(VOID*);
- typedef DWORD (WINAPI *WlanCloseHandleFunc)(HANDLE, VOID*);
+ typedef DWORD(WINAPI* WlanOpenHandleFunc)(DWORD, VOID*, DWORD*, HANDLE*);
+ typedef DWORD(WINAPI* WlanEnumInterfacesFunc)(HANDLE,
+ VOID*,
+ WLAN_INTERFACE_INFO_LIST**);
+ typedef DWORD(WINAPI* WlanQueryInterfaceFunc)(HANDLE,
+ const GUID*,
+ WLAN_INTF_OPCODE,
+ VOID*,
+ DWORD*,
+ VOID**,
+ WLAN_OPCODE_VALUE_TYPE*);
+ typedef VOID(WINAPI* WlanFreeMemoryFunc)(VOID*);
+ typedef DWORD(WINAPI* WlanCloseHandleFunc)(HANDLE, VOID*);
WlanApi() : initialized(false) {
// Use an absolute path to load the DLL to avoid DLL preloading attacks.
@@ -59,15 +63,14 @@ struct WlanApi {
close_handle_func = reinterpret_cast<WlanCloseHandleFunc>(
::GetProcAddress(module, "WlanCloseHandle"));
initialized = open_handle_func && enum_interfaces_func &&
- query_interface_func && free_memory_func &&
- close_handle_func;
+ query_interface_func && free_memory_func && close_handle_func;
}
template <typename T>
DWORD OpenHandle(DWORD client_version, DWORD* cur_version, T* handle) const {
HANDLE temp_handle;
- DWORD result = open_handle_func(client_version, NULL, cur_version,
- &temp_handle);
+ DWORD result =
+ open_handle_func(client_version, NULL, cur_version, &temp_handle);
if (result != ERROR_SUCCESS)
return result;
handle->Set(temp_handle);
@@ -111,8 +114,8 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
return true;
}
scoped_ptr<char[]> buf(new char[len]);
- IP_ADAPTER_ADDRESSES *adapters =
- reinterpret_cast<IP_ADAPTER_ADDRESSES *>(buf.get());
+ IP_ADAPTER_ADDRESSES* adapters =
+ reinterpret_cast<IP_ADAPTER_ADDRESSES*>(buf.get());
result = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, adapters, &len);
if (result != NO_ERROR) {
LOG(ERROR) << "GetAdaptersAddresses failed: " << result;
@@ -124,7 +127,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
ULONG ipv6_valid_lifetime = 0;
scoped_ptr<NetworkInterface> ipv6_address;
- for (IP_ADAPTER_ADDRESSES *adapter = adapters; adapter != NULL;
+ for (IP_ADAPTER_ADDRESSES* adapter = adapters; adapter != NULL;
adapter = adapter->Next) {
// Ignore the loopback device.
if (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK) {
@@ -145,7 +148,8 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
}
for (IP_ADAPTER_UNICAST_ADDRESS* address = adapter->FirstUnicastAddress;
- address; address = address->Next) {
+ address;
+ address = address->Next) {
int family = address->Address.lpSockaddr->sa_family;
if (family == AF_INET || family == AF_INET6) {
IPEndPoint endpoint;
@@ -163,7 +167,8 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
int prefix_family = prefix->Address.lpSockaddr->sa_family;
IPEndPoint network_endpoint;
if (prefix_family == family &&
- network_endpoint.FromSockAddr(prefix->Address.lpSockaddr,
+ network_endpoint.FromSockAddr(
+ prefix->Address.lpSockaddr,
prefix->Address.iSockaddrLength) &&
IPNumberMatchesPrefix(endpoint.address(),
network_endpoint.address(),
@@ -184,20 +189,23 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
if (ipv6_valid_lifetime == 0 ||
ipv6_valid_lifetime > address->ValidLifetime) {
ipv6_valid_lifetime = address->ValidLifetime;
- ipv6_address.reset(new NetworkInterface(adapter->AdapterName,
- base::SysWideToNativeMB(adapter->FriendlyName),
- index,
- GetNetworkInterfaceType(adapter->IfType),
- endpoint.address(),
- net_prefix));
+ ipv6_address.reset(new NetworkInterface(
+ adapter->AdapterName,
+ base::SysWideToNativeMB(adapter->FriendlyName),
+ index,
+ GetNetworkInterfaceType(adapter->IfType),
+ endpoint.address(),
+ net_prefix));
continue;
}
}
networks->push_back(
NetworkInterface(adapter->AdapterName,
base::SysWideToNativeMB(adapter->FriendlyName),
- index, GetNetworkInterfaceType(adapter->IfType),
- endpoint.address(), net_prefix));
+ index,
+ GetNetworkInterfaceType(adapter->IfType),
+ endpoint.address(),
+ net_prefix));
}
}
}
@@ -218,19 +226,17 @@ WifiPHYLayerProtocol GetWifiPHYLayerProtocol() {
static bool CloseHandle(HANDLE handle) {
return lazy_wlanapi.Get().close_handle_func(handle, NULL) ==
- ERROR_SUCCESS;
+ ERROR_SUCCESS;
}
static bool IsHandleValid(HANDLE handle) {
return base::win::HandleTraits::IsHandleValid(handle);
}
- static HANDLE NullHandle() {
- return base::win::HandleTraits::NullHandle();
- }
+ static HANDLE NullHandle() { return base::win::HandleTraits::NullHandle(); }
};
- typedef base::win::GenericScopedHandle<
- WlanApiHandleTraits,
- base::win::DummyVerifierTraits> WlanHandle;
+ typedef base::win::GenericScopedHandle<WlanApiHandleTraits,
+ base::win::DummyVerifierTraits>
+ WlanHandle;
struct WlanApiDeleter {
inline void operator()(void* ptr) const {
@@ -272,9 +278,14 @@ WifiPHYLayerProtocol GetWifiPHYLayerProtocol() {
WLAN_CONNECTION_ATTRIBUTES* conn_info_ptr;
DWORD conn_info_size = 0;
WLAN_OPCODE_VALUE_TYPE op_code;
- result = wlanapi.query_interface_func(
- client, &info->InterfaceGuid, wlan_intf_opcode_current_connection, NULL,
- &conn_info_size, reinterpret_cast<VOID**>(&conn_info_ptr), &op_code);
+ result =
+ wlanapi.query_interface_func(client,
+ &info->InterfaceGuid,
+ wlan_intf_opcode_current_connection,
+ NULL,
+ &conn_info_size,
+ reinterpret_cast<VOID**>(&conn_info_ptr),
+ &op_code);
if (result != ERROR_SUCCESS)
return WIFI_PHY_LAYER_PROTOCOL_UNKNOWN;
scoped_ptr<WLAN_CONNECTION_ATTRIBUTES, WlanApiDeleter> conn_info(

Powered by Google App Engine
This is Rietveld 408576698