Skip to content

Commit 7876615

Browse files
committed
Move updates.
1 parent 988d76b commit 7876615

File tree

18 files changed

+52
-39
lines changed

18 files changed

+52
-39
lines changed

src/common/server/NetRemoteServerConfiguration.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ ParseCliAppOptions(bool throwOnParseError, Args&&... args)
6060

6161
/* static */
6262
NetRemoteServerConfiguration
63-
NetRemoteServerConfiguration::FromCommandLineArguments(int argc, char* argv[], bool throwOnParseError)
63+
NetRemoteServerConfiguration::FromCommandLineArguments(int argc, char* argv[], bool throwOnParseError) // NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
6464
{
6565
return details::ParseCliAppOptions(throwOnParseError, argc, argv);
6666
}

src/common/shared/logging/LogUtils.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ logging::GetLogName(std::string_view componentName)
1818

1919
std::stringstream ss;
2020

21-
ss << std::put_time(std::localtime(&t_c), "%Y%m%d")
21+
ss << std::put_time(std::localtime(&t_c), "%Y%m%d") // NOLINT(concurrency-mt-unsafe)
2222
<< "-LogNetRemote-"
2323
<< componentName
2424
<< ".txt";

src/common/tools/cli/NetRemoteCli.cxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
using namespace Microsoft::Net::Remote;
1818

1919
NetRemoteCli::NetRemoteCli(std::shared_ptr<NetRemoteCliData> cliData, std::shared_ptr<NetRemoteCliHandler> cliHandler) :
20-
m_cliData{ cliData },
21-
m_cliHandler{ cliHandler },
20+
m_cliData{ std::move(cliData) },
21+
m_cliHandler{ std::move(cliHandler) },
2222
m_cliApp{ CreateParser() }
2323
{
2424
}
@@ -46,7 +46,7 @@ NetRemoteCli::GetData() const
4646
}
4747

4848
int
49-
NetRemoteCli::Parse(int argc, char* argv[]) noexcept
49+
NetRemoteCli::Parse(int argc, char* argv[]) noexcept // NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
5050
{
5151
try {
5252
m_cliApp->parse(argc, argv);
@@ -66,7 +66,7 @@ NetRemoteCli::CreateParser() noexcept
6666

6767
app->require_subcommand();
6868

69-
auto optionServer = app->add_option_function<std::string>("-s,--server", [this](const std::string& serverAddress) {
69+
auto* optionServer = app->add_option_function<std::string>("-s,--server", [this](const std::string& serverAddress) {
7070
OnServerAddressChanged(serverAddress);
7171
});
7272
optionServer->description("The address of the netremote server to connect to, with format '<hostname>[:port]");
@@ -93,7 +93,7 @@ NetRemoteCli::AddSubcommandWifi(CLI::App* parent)
9393
CLI::App*
9494
NetRemoteCli::AddSubcommandWifiEnumerateAccessPoints(CLI::App* parent)
9595
{
96-
auto cliAppWifiEnumerateAccessPoints = parent->add_subcommand("enumerate-access-points", "Enumerate available Wi-Fi access points");
96+
auto* cliAppWifiEnumerateAccessPoints = parent->add_subcommand("enumerate-access-points", "Enumerate available Wi-Fi access points");
9797
cliAppWifiEnumerateAccessPoints->alias("enumaps");
9898
cliAppWifiEnumerateAccessPoints->callback([this] {
9999
OnWifiEnumerateAccessPoints();
@@ -109,7 +109,7 @@ NetRemoteCli::OnServerAddressChanged(const std::string& serverAddressArg)
109109

110110
// Append the default port if not specified in command-line argument.
111111
auto serverAddress = serverAddressArg;
112-
if (serverAddress.find(':') == serverAddress.npos) {
112+
if (serverAddress.find(':') == std::string::npos) {
113113
serverAddress += std::format("{}{}", NetRemoteProtocol::PortSeparator, NetRemoteProtocol::PortDefault);
114114
}
115115

src/common/tools/cli/NetRemoteCliHandler.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ NetRemoteCliHandler::NetRemoteCliHandler(std::unique_ptr<INetRemoteCliHandlerOpe
1818
void
1919
NetRemoteCliHandler::SetParent(std::weak_ptr<NetRemoteCli> parent)
2020
{
21-
m_parent = parent;
21+
m_parent = std::move(parent);
2222
}
2323

2424
void
2525
NetRemoteCliHandler::SetConnection(std::shared_ptr<NetRemoteServerConnection> connection)
2626
{
27-
m_connection = connection;
27+
m_connection = std::move(connection);
2828
m_operations = m_operationsFactory->Create(m_connection);
2929
}
3030

src/common/tools/cli/NetRemoteCliHandlerOperations.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ NetRemoteAccessPointCapabilitiesToString(const Microsoft::Net::Wifi::Dot11Access
9797
void
9898
NetRemoteCliHandlerOperations::WifiEnumerateAccessPoints()
9999
{
100-
WifiEnumerateAccessPointsRequest request{};
100+
const WifiEnumerateAccessPointsRequest request{};
101101
WifiEnumerateAccessPointsResult result{};
102102
grpc::ClientContext clientContext{};
103103

src/common/wifi/apmanager/AccessPointDiscoveryAgent.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ AccessPointDiscoveryAgent::GetInstance() noexcept
4141
void
4242
AccessPointDiscoveryAgent::RegisterDiscoveryEventCallback(AccessPointPresenceEventCallback onDevicePresenceChanged)
4343
{
44-
std::unique_lock<std::shared_mutex> onDevicePresenceChangedLock{ m_onDevicePresenceChangedGate };
44+
const std::unique_lock<std::shared_mutex> onDevicePresenceChangedLock{ m_onDevicePresenceChangedGate };
4545
m_onDevicePresenceChanged = std::move(onDevicePresenceChanged);
4646
}
4747

4848
void
4949
AccessPointDiscoveryAgent::DevicePresenceChanged(AccessPointPresenceEvent presence, std::shared_ptr<IAccessPoint> accessPoint) const noexcept
5050
{
51-
std::shared_lock<std::shared_mutex> onDevicePresenceChangedLock{ m_onDevicePresenceChangedGate };
51+
const std::shared_lock<std::shared_mutex> onDevicePresenceChangedLock{ m_onDevicePresenceChangedGate };
5252
if (m_onDevicePresenceChanged) {
5353
LOGI << std::format("Access Point Discovery Event: Interface {} {}", accessPoint->GetInterfaceName(), magic_enum::enum_name(presence));
5454
m_onDevicePresenceChanged(presence, std::move(accessPoint));

src/common/wifi/apmanager/AccessPointManager.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ AccessPointManager::AddDiscoveryAgent(std::shared_ptr<AccessPointDiscoveryAgent>
121121

122122
// Add the agent.
123123
{
124-
std::unique_lock<std::shared_mutex> discoveryAgentLock{ m_discoveryAgentsGate };
124+
const std::unique_lock<std::shared_mutex> discoveryAgentLock{ m_discoveryAgentsGate };
125125
m_discoveryAgents.push_back(std::move(discoveryAgent));
126126
}
127127

@@ -134,7 +134,7 @@ AccessPointManager::AddDiscoveryAgent(std::shared_ptr<AccessPointDiscoveryAgent>
134134
// If the operation completed, get the results and add those access points.
135135
if (waitResult == std::future_status::ready) {
136136
auto existingAccessPoints = existingAccessPointsProbe.get();
137-
for (const auto& existingAccessPoint : existingAccessPoints) {
137+
for (auto& existingAccessPoint : existingAccessPoints) {
138138
AddAccessPoint(std::move(existingAccessPoint));
139139
}
140140
} else {

src/linux/libnl-helpers/Netlink80211Interface.cxx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929

3030
using namespace Microsoft::Net::Netlink::Nl80211;
3131

32-
using Microsoft::Net::Netlink::NetlinkMessage;
33-
using Microsoft::Net::Netlink::NetlinkSocket;
34-
3532
Nl80211Interface::Nl80211Interface(std::string_view name, nl80211_iftype type, uint32_t index, uint32_t wiphyIndex) noexcept :
3633
Name(name),
3734
Type(type),
@@ -75,7 +72,7 @@ Nl80211Interface::Parse(struct nl_msg *nl80211Message) noexcept
7572
}
7673

7774
// Tease out parameters to populate the Nl80211Interface instance.
78-
auto *interfaceName = static_cast<const char *>(nla_data(newInterfaceMessageAttributes[NL80211_ATTR_IFNAME]));
75+
const auto *interfaceName = static_cast<const char *>(nla_data(newInterfaceMessageAttributes[NL80211_ATTR_IFNAME]));
7976
auto interfaceType = static_cast<nl80211_iftype>(nla_get_u32(newInterfaceMessageAttributes[NL80211_ATTR_IFTYPE]));
8077
auto interfaceIndex = static_cast<uint32_t>(nla_get_u32(newInterfaceMessageAttributes[NL80211_ATTR_IFINDEX]));
8178
auto wiphyIndex = static_cast<uint32_t>(nla_get_u32(newInterfaceMessageAttributes[NL80211_ATTR_WIPHY]));
@@ -108,10 +105,9 @@ HandleNl80211InterfaceDumpResponse(struct nl_msg *nl80211Message, void *context)
108105
if (!nl80211Interface.has_value()) {
109106
LOGW << "Failed to parse nl80211 interface dump response";
110107
return NL_SKIP;
111-
} else {
112-
LOGD << std::format("Parsed nl80211 interface dump response: {}", nl80211Interface->ToString());
113108
}
114-
109+
110+
LOGD << std::format("Parsed nl80211 interface dump response: {}", nl80211Interface->ToString());
115111
nl80211Interfaces.push_back(std::move(nl80211Interface.value()));
116112

117113
return NL_OK;

src/linux/libnl-helpers/include/microsoft/net/netlink/nl80211/Netlink80211.hxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#ifndef NETLINK_82011_HXX
33
#define NETLINK_82011_HXX
44

5+
#include <cstdint>
56
#include <optional>
67
#include <string_view>
78
#include <unordered_map>
@@ -54,7 +55,7 @@ Nl80211InterfaceTypeToString(nl80211_iftype type) noexcept;
5455
* @return std::string_view
5556
*/
5657
std::string_view
57-
Nl80211CipherSuiteToString(uint32_t cipherType) noexcept;
58+
Nl80211CipherSuiteToString(uint32_t cipherSuite) noexcept;
5859

5960
/**
6061
* @brief Create a netlink socket for use with Nl80211.

src/linux/wpa-controller/ProtocolHostapd.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ using namespace Wpa;
88
HostapdInterfaceState
99
Wpa::HostapdInterfaceStateFromString(std::string_view state) noexcept
1010
{
11+
// NOLINTBEGIN(readability-else-after-return)
1112
// Implementation uses starts_with() instead of equals() to accommodate
1213
// unparsed payloads from command responses.
1314
if (state.starts_with(ProtocolHostapd::ResponsePayloadStatusUninitialized)) {
@@ -27,6 +28,7 @@ Wpa::HostapdInterfaceStateFromString(std::string_view state) noexcept
2728
} else if (state.starts_with(ProtocolHostapd::ResponsePayloadStatusNoIr)) {
2829
return HostapdInterfaceState::NoIr;
2930
}
31+
// NOLINTEND(readability-else-after-return)
3032

3133
return HostapdInterfaceState::Unknown;
3234
}

0 commit comments

Comments
 (0)