diff --git a/core/backends/lan/mdns.h b/core/backends/lan/mdns.h index e864981c0..9b2582423 100644 --- a/core/backends/lan/mdns.h +++ b/core/backends/lan/mdns.h @@ -1,4 +1,4 @@ -/* mdns.h - mDNS/DNS-SD library - Public Domain - 2017 Mattias Jansson +/* mdns.h - mDNS/DNS-SD library v1.4.3 - Public Domain - 2017 Mattias Jansson * * This library provides a cross-platform mDNS and DNS-SD library in C. * The implementation is based on RFC 6762 and RFC 6763. diff --git a/core/backends/lan/mdns_wrapper.cpp b/core/backends/lan/mdns_wrapper.cpp index db944c4c9..5739251e9 100644 --- a/core/backends/lan/mdns_wrapper.cpp +++ b/core/backends/lan/mdns_wrapper.cpp @@ -193,7 +193,7 @@ int Discoverer::listenForQueryResponses() } // Start listening on all sockets - for (int socket : sockets) { + for (int socket : std::as_const(sockets)) { QSocketNotifier *socketNotifier = new QSocketNotifier(socket, QSocketNotifier::Read); QObject::connect(socketNotifier, &QSocketNotifier::activated, [this](QSocketDescriptor socket) { MdnsService discoveredService; @@ -257,7 +257,7 @@ int countCommonLeadingBits(quint32 int1, quint32 int2) { return count; } -static QHostAddress findBestAddressMatchV4(QVector hostAddresses, const struct sockaddr *fromAddress) +static QHostAddress findBestAddressMatchV4(const QVector &hostAddresses, const struct sockaddr *fromAddress) { Q_ASSERT(!hostAddresses.empty()); if (hostAddresses.size() == 1 || fromAddress == nullptr) { @@ -291,7 +291,7 @@ static QHostAddress findBestAddressMatchV4(QVector hostAddresses, return matchingIp; } -static QHostAddress findBestAddressMatchV6(QVector hostAddresses, const struct sockaddr *fromAddress) +static QHostAddress findBestAddressMatchV6(const QVector& hostAddresses, const struct sockaddr *fromAddress) { Q_ASSERT(!hostAddresses.empty()); // We could do the same logic for v6 that we do for V4, but we don't care that much about IPv6 @@ -595,14 +595,10 @@ void Announcer::stopAnnouncing() void Announcer::stopListeningForQueries() { - if (socketNotifier != nullptr) { - delete socketNotifier; - socketNotifier = nullptr; - } - if (socketNotifierV6 != nullptr) { - delete socketNotifierV6; - socketNotifierV6 = nullptr; - } + delete socketNotifier; + socketNotifier = nullptr; + delete socketNotifierV6; + socketNotifierV6 = nullptr; } void Announcer::sendMulticastAnnounce(bool isGoodbye)