mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-11 18:26:18 +00:00
Fix Clazy range-loop-detach warnings
This commit is contained in:
@@ -141,7 +141,7 @@ NvComputer::NvComputer(NvHTTP& http, QString serverInfo)
|
||||
QString newMacString = NvHTTP::getXmlString(serverInfo, "mac");
|
||||
if (newMacString != "00:00:00:00:00:00") {
|
||||
QStringList macOctets = newMacString.split(':');
|
||||
for (const QString& macOctet : macOctets) {
|
||||
for (const QString& macOctet : std::as_const(macOctets)) {
|
||||
this->macAddress.append((char) macOctet.toInt(nullptr, 16));
|
||||
}
|
||||
}
|
||||
@@ -254,14 +254,16 @@ bool NvComputer::wake() const
|
||||
// case the host has timed out in ARP entries.
|
||||
QMap<QString, quint16> addressMap;
|
||||
QSet<quint16> basePortSet;
|
||||
for (const NvAddress& addr : uniqueAddresses()) {
|
||||
const auto uniqueHostAddresses = uniqueAddresses();
|
||||
for (const NvAddress& addr : uniqueHostAddresses) {
|
||||
addressMap.insert(addr.address(), addr.port());
|
||||
basePortSet.insert(addr.port());
|
||||
}
|
||||
addressMap.insert("255.255.255.255", 0);
|
||||
|
||||
// Try to broadcast on all available NICs
|
||||
for (const QNetworkInterface& nic : QNetworkInterface::allInterfaces()) {
|
||||
const auto allInterfaces = QNetworkInterface::allInterfaces();
|
||||
for (const QNetworkInterface& nic : allInterfaces) {
|
||||
// Ensure the interface is up and skip the loopback adapter
|
||||
if ((nic.flags() & QNetworkInterface::IsUp) == 0 ||
|
||||
(nic.flags() & QNetworkInterface::IsLoopBack) != 0) {
|
||||
@@ -269,7 +271,8 @@ bool NvComputer::wake() const
|
||||
}
|
||||
|
||||
QHostAddress allNodesMulticast("FF02::1");
|
||||
for (const QNetworkAddressEntry& addr : nic.addressEntries()) {
|
||||
const auto allInterfaceAddresses = nic.addressEntries();
|
||||
for (const QNetworkAddressEntry& addr : allInterfaceAddresses) {
|
||||
// Store the scope ID for this NIC if IPv6 is enabled
|
||||
if (!addr.ip().scopeId().isEmpty()) {
|
||||
allNodesMulticast.setScopeId(addr.ip().scopeId());
|
||||
@@ -375,13 +378,15 @@ NvComputer::ReachabilityType NvComputer::getActiveAddressReachability() const
|
||||
Q_ASSERT(!s.localAddress().isNull());
|
||||
Q_ASSERT(!s.peerAddress().isNull());
|
||||
|
||||
for (const QNetworkInterface& nic : QNetworkInterface::allInterfaces()) {
|
||||
const auto allInterfaces = QNetworkInterface::allInterfaces();
|
||||
for (const QNetworkInterface& nic : allInterfaces) {
|
||||
// Ensure the interface is up
|
||||
if ((nic.flags() & QNetworkInterface::IsUp) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const QNetworkAddressEntry& addr : nic.addressEntries()) {
|
||||
const auto allInterfaceAddresses = nic.addressEntries();
|
||||
for (const QNetworkAddressEntry& addr : allInterfaceAddresses) {
|
||||
if (addr.ip() == s.localAddress()) {
|
||||
qInfo() << "Found matching interface:" << nic.humanReadableName() << nic.hardwareAddress() << nic.flags();
|
||||
|
||||
@@ -463,7 +468,7 @@ bool NvComputer::updateAppList(QVector<NvApp> newAppList) {
|
||||
}
|
||||
|
||||
// Propagate client-side attributes to the new app list
|
||||
for (const NvApp& existingApp : appList) {
|
||||
for (const NvApp& existingApp : std::as_const(appList)) {
|
||||
for (NvApp& newApp : newAppList) {
|
||||
if (existingApp.id == newApp.id) {
|
||||
newApp.hidden = existingApp.hidden;
|
||||
|
||||
Reference in New Issue
Block a user