Commit 6ae681f7 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

style++

- use auto on obvious new
- give the magic number a name so it's obvious why it is 6
- don't detatch
parent fd23997a
Pipeline #80957 passed with stage
in 3 minutes and 59 seconds
...@@ -246,7 +246,8 @@ void WSDiscoverer::resolveReceived(const WSDiscoveryTargetService &service) ...@@ -246,7 +246,8 @@ void WSDiscoverer::resolveReceived(const WSDiscoveryTargetService &service)
m_seenEndpoints << service.endpointReference(); m_seenEndpoints << service.endpointReference();
QUrl addr; QUrl addr;
for (const auto &xAddr : service.xAddrList()) { const QList<QUrl> xAddrList = service.xAddrList();
for (const auto &xAddr : xAddrList) {
// https://docs.microsoft.com/en-us/windows/win32/wsdapi/xaddr-validation-rules // https://docs.microsoft.com/en-us/windows/win32/wsdapi/xaddr-validation-rules
// "At least one IP address included in the XAddrs (or IP address resolved from // "At least one IP address included in the XAddrs (or IP address resolved from
// a hostname included in the XAddrs) must be on the same subnet as the adapter // a hostname included in the XAddrs) must be on the same subnet as the adapter
...@@ -265,7 +266,7 @@ void WSDiscoverer::resolveReceived(const WSDiscoveryTargetService &service) ...@@ -265,7 +266,7 @@ void WSDiscoverer::resolveReceived(const WSDiscoveryTargetService &service)
return; return;
} }
PBSDResolver *resolver = new PBSDResolver(addr, service.endpointReference(), this); auto *resolver = new PBSDResolver(addr, service.endpointReference(), this);
connect(resolver, &PBSDResolver::resolved, this, [this](Discovery::Ptr discovery) { connect(resolver, &PBSDResolver::resolved, this, [this](Discovery::Ptr discovery) {
++m_resolvedCount; ++m_resolvedCount;
Q_EMIT newDiscovery(discovery); Q_EMIT newDiscovery(discovery);
...@@ -296,7 +297,8 @@ QString WSDiscovery::udsName() const ...@@ -296,7 +297,8 @@ QString WSDiscovery::udsName() const
KIO::UDSEntry WSDiscovery::toEntry() const KIO::UDSEntry WSDiscovery::toEntry() const
{ {
KIO::UDSEntry entry; KIO::UDSEntry entry;
entry.reserve(6); const int fastInsertCount = 6;
entry.reserve(fastInsertCount);
entry.fastInsert(KIO::UDSEntry::UDS_NAME, udsName()); entry.fastInsert(KIO::UDSEntry::UDS_NAME, udsName());
entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); entry.fastInsert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment