From 9b7afea9abf2c913b302343068730e0cc9686961 Mon Sep 17 00:00:00 2001 From: Albert Vaca Cintora Date: Sat, 29 Jul 2023 16:28:37 +0200 Subject: [PATCH] Fix some clazy warnings --- core/backends/lan/mdns_wrapper.cpp | 32 +++++++++++++++--------------- core/backends/lan/mdns_wrapper.h | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/backends/lan/mdns_wrapper.cpp b/core/backends/lan/mdns_wrapper.cpp index d55120518..6a71f09f1 100644 --- a/core/backends/lan/mdns_wrapper.cpp +++ b/core/backends/lan/mdns_wrapper.cpp @@ -160,7 +160,7 @@ void Discoverer::stopDiscovering() void Discoverer::stopListeningForQueryResponses() { qCDebug(KDECONNECT_CORE) << "Closing" << responseSocketNotifiers.size() << "sockets"; - for (QSocketNotifier *socketNotifier : responseSocketNotifiers) { + for (QSocketNotifier *socketNotifier : qAsConst(responseSocketNotifiers)) { mdns_socket_close(socketNotifier->socket()); delete socketNotifier; } @@ -226,7 +226,7 @@ void Discoverer::sendQuery(const QString &serviceType) query.type = MDNS_RECORDTYPE_PTR; static char buffer[2048]; - for (QSocketNotifier *socketNotifier : responseSocketNotifiers) { + for (QSocketNotifier *socketNotifier : qAsConst(responseSocketNotifiers)) { int socket = socketNotifier->socket(); qCDebug(KDECONNECT_CORE) << "Sending mDNS query via socket" << socket; int ret = mdns_multiquery_send(socket, &query, 1, buffer, sizeof(buffer), 0); @@ -329,9 +329,9 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle if (unicast) { mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, NULL, 0, NULL, 0); + answer, nullptr, 0, nullptr, 0); } else { - mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, 0, 0, 0, 0); + mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, nullptr, 0); } } } else if (name == self.serviceType) { @@ -363,9 +363,9 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle if (unicast) { mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, 0, 0, additional.constData(), additional.length()); + answer, nullptr, 0, additional.constData(), additional.length()); } else { - mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, 0, 0, + mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } @@ -397,9 +397,9 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle if (unicast) { mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, 0, 0, additional.constData(), additional.length()); + answer, nullptr, 0, additional.constData(), additional.length()); } else { - mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, 0, 0, + mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } @@ -427,9 +427,9 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle if (unicast) { mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, 0, 0, additional.constData(), additional.length()); + answer, nullptr, 0, additional.constData(), additional.length()); } else { - mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, 0, 0, + mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } else if (((record_type == MDNS_RECORDTYPE_AAAA) || (record_type == MDNS_RECORDTYPE_ANY)) && !self.addressesV6.empty()) { @@ -454,9 +454,9 @@ static int service_callback(int sock, const struct sockaddr* from, size_t addrle if (unicast) { mdns_query_answer_unicast(sock, from, addrlen, sendbuffer, sizeof(sendbuffer), query_id, (mdns_record_type_t)record_type, nameMdnsString.str, nameMdnsString.length, - answer, 0, 0, additional.constData(), additional.length()); + answer, nullptr, 0, additional.constData(), additional.length()); } else { - mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, 0, 0, + mdns_query_answer_multicast(sock, sendbuffer, sizeof(sendbuffer), answer, nullptr, 0, additional.constData(), additional.length()); } } @@ -602,15 +602,15 @@ void Announcer::sendMulticastAnnounce(bool isGoodbye) if (isGoodbye) { qCDebug(KDECONNECT_CORE) << "Sending goodbye"; if (socketNotifier) - mdns_goodbye_multicast(socketNotifier->socket(), buffer, sizeof(buffer), ptr_record, 0, 0, additional.constData(), additional.length()); + mdns_goodbye_multicast(socketNotifier->socket(), buffer, sizeof(buffer), ptr_record, nullptr, 0, additional.constData(), additional.length()); if (socketNotifierV6) - mdns_goodbye_multicast(socketNotifierV6->socket(), buffer, sizeof(buffer), ptr_record, 0, 0, additional.constData(), additional.length()); + mdns_goodbye_multicast(socketNotifierV6->socket(), buffer, sizeof(buffer), ptr_record, nullptr, 0, additional.constData(), additional.length()); } else { qCDebug(KDECONNECT_CORE) << "Sending announce"; if (socketNotifier) - mdns_announce_multicast(socketNotifier->socket(), buffer, sizeof(buffer), ptr_record, 0, 0, additional.constData(), additional.length()); + mdns_announce_multicast(socketNotifier->socket(), buffer, sizeof(buffer), ptr_record, nullptr, 0, additional.constData(), additional.length()); if (socketNotifierV6) - mdns_announce_multicast(socketNotifierV6->socket(), buffer, sizeof(buffer), ptr_record, 0, 0, additional.constData(), additional.length()); + mdns_announce_multicast(socketNotifierV6->socket(), buffer, sizeof(buffer), ptr_record, nullptr, 0, additional.constData(), additional.length()); } } diff --git a/core/backends/lan/mdns_wrapper.h b/core/backends/lan/mdns_wrapper.h index 06b3478d5..1af2148a6 100644 --- a/core/backends/lan/mdns_wrapper.h +++ b/core/backends/lan/mdns_wrapper.h @@ -39,7 +39,7 @@ public: void sendQuery(const QString &serviceName); Q_SIGNALS: - void serviceFound(const MdnsService &service); + void serviceFound(const MdnsWrapper::Discoverer::MdnsService &service); private: int listenForQueryResponses();