22
22
* IN THE SOFTWARE.
23
23
*/
24
24
25
+ #include < utility>
26
+
25
27
#include < qmdnsengine/abstractserver.h>
26
28
#include < qmdnsengine/browser.h>
27
29
#include < qmdnsengine/cache.h>
@@ -89,7 +91,11 @@ bool BrowserPrivate::updateService(const QByteArray &fqName)
89
91
QList<Record> txtRecords;
90
92
if (cache->lookupRecords (fqName, TXT, txtRecords)) {
91
93
QMap<QByteArray, QByteArray> attributes;
92
- for (const Record &record : qAsConst (txtRecords)) {
94
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
95
+ for (const Record &record : std::as_const (txtRecords)) {
96
+ #else
97
+ for (const Record &record : qAsConst (txtRecords)) {
98
+ #endif
93
99
for (auto i = record.attributes ().constBegin ();
94
100
i != record.attributes ().constEnd (); ++i) {
95
101
attributes.insert (i.key (), i.value ());
@@ -154,7 +160,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
154
160
// For each of the services marked to be updated, perform the update and
155
161
// make a list of all missing SRV records
156
162
QSet<QByteArray> queryNames;
157
- for (const QByteArray &name : qAsConst (updateNames)) {
163
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
164
+ for (const QByteArray &name : std::as_const (updateNames)) {
165
+ #else
166
+ for (const QByteArray &name : qAsConst (updateNames)) {
167
+ #endif
158
168
if (updateService (name)) {
159
169
queryNames.insert (name);
160
170
}
@@ -178,7 +188,11 @@ void BrowserPrivate::onMessageReceived(const Message &message)
178
188
// Build and send a query for all of the SRV and TXT records
179
189
if (queryNames.count ()) {
180
190
Message queryMessage;
181
- for (const QByteArray &name : qAsConst (queryNames)) {
191
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
192
+ for (const QByteArray &name : std::as_const (queryNames)) {
193
+ #else
194
+ for (const QByteArray &name : qAsConst (queryNames)) {
195
+ #endif
182
196
Query query;
183
197
query.setName (name);
184
198
query.setType (SRV);
@@ -240,7 +254,11 @@ void BrowserPrivate::onQueryTimeout()
240
254
// Include PTR records for the target that are already known
241
255
QList<Record> records;
242
256
if (cache->lookupRecords (query.name (), PTR, records)) {
243
- for (const Record &record : qAsConst (records)) {
257
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
258
+ for (const Record &record : std::as_const (records)) {
259
+ #else
260
+ for (const Record &record : qAsConst (records)) {
261
+ #endif
244
262
message.addRecord (record);
245
263
}
246
264
}
@@ -253,8 +271,11 @@ void BrowserPrivate::onServiceTimeout()
253
271
{
254
272
if (ptrTargets.count ()) {
255
273
Message message;
256
- for (const QByteArray &target : qAsConst (ptrTargets)) {
257
-
274
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
275
+ for (const QByteArray &target : std::as_const (ptrTargets)) {
276
+ #else
277
+ for (const QByteArray &target : qAsConst (ptrTargets)) {
278
+ #endif
258
279
// Add a query for PTR records
259
280
Query query;
260
281
query.setName (target);
@@ -264,7 +285,11 @@ void BrowserPrivate::onServiceTimeout()
264
285
// Include PTR records for the target that are already known
265
286
QList<Record> records;
266
287
if (cache->lookupRecords (target, PTR, records)) {
267
- for (const Record &record : qAsConst (records)) {
288
+ #if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
289
+ for (const Record &record : std::as_const (records)) {
290
+ #else
291
+ for (const Record &record : qAsConst (records)) {
292
+ #endif
268
293
message.addRecord (record);
269
294
}
270
295
}
0 commit comments