Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit fc3a890

Browse files
committed
Change qC{Debug,Warning} calls to those strictly valid before C++20
This fixes builds on Fedora 36 / GCC 12 and probably other strict compilers. See https://bugreports.qt.io/browse/QTBUG-101635
1 parent b8ad988 commit fc3a890

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/restclient/paging.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void Paging<T>::iterate(const std::function<bool (T, qint64)> &iterator, qint64
140140
//continue to the next one
141141
auto max = calcMax(to);
142142
if (index < max && d->iPaging->hasNext()) {
143-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
144-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
143+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
144+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
145145
next()->onSucceeded([iterator, to, index](int, const Paging<T> &paging) {
146146
if (paging.isValid())
147147
paging.iterate(iterator, to, index);
@@ -161,8 +161,8 @@ void Paging<T>::iterate(QObject *scope, const std::function<bool (T, qint64)> &i
161161
//continue to the next one
162162
auto max = calcMax(to);
163163
if (index < max && d->iPaging->hasNext()) {
164-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
165-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
164+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
165+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
166166
next()->onSucceeded(scope, [scope, iterator, to, index](int, const Paging<T> &paging) {
167167
if (paging.isValid())
168168
paging.iterate(scope, iterator, to, index);
@@ -183,8 +183,8 @@ void Paging<T>::iterate(const std::function<bool(T, qint64)> &iterator, const st
183183
//continue to the next one
184184
auto max = calcMax(to);
185185
if (index < max && d->iPaging->hasNext()) {
186-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
187-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
186+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
187+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
188188
next<EO>()->onSucceeded([iterator, errorHandler, failureTransformer, to, index](int, const Paging<T> &paging) {
189189
if (paging.isValid())
190190
paging.iterate(iterator, errorHandler, failureTransformer, to, index);
@@ -206,8 +206,8 @@ void Paging<T>::iterate(QObject *scope, const std::function<bool(T, qint64)> &it
206206
//continue to the next one
207207
auto max = calcMax(to);
208208
if (index < max && d->iPaging->hasNext()) {
209-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
210-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
209+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
210+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
211211
next<EO>()->onSucceeded(scope, [scope, iterator, errorHandler, failureTransformer, to, index](int, const Paging<T> &paging) {
212212
if (paging.isValid())
213213
paging.iterate(scope, iterator, errorHandler, failureTransformer, to, index);
@@ -229,8 +229,8 @@ void Paging<T>::iterate(const std::function<bool(T, qint64)> &iterator, const st
229229
//continue to the next one
230230
auto max = calcMax(to);
231231
if (index < max && d->iPaging->hasNext()) {
232-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
233-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
232+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
233+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
234234
next<EO>()->onSucceeded([iterator, failureHandler, errorHandler, exceptionHandler, to, index](int, const Paging<T> &paging) {
235235
if (paging.isValid())
236236
paging.iterate(iterator, failureHandler, errorHandler, exceptionHandler, to, index);
@@ -254,8 +254,8 @@ void Paging<T>::iterate(QObject *scope, const std::function<bool(T, qint64)> &it
254254
//continue to the next one
255255
auto max = calcMax(to);
256256
if(index < max && d->iPaging->hasNext()) {
257-
qCDebug(logPaging) << "Requesting next paging object with offset" << index
258-
<< "as" << d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo);
257+
qCDebug(logPaging, "Requesting next paging object with offset %s as %s", QString::number(index),
258+
d->iPaging->next().toString(QUrl::PrettyDecoded | QUrl::RemoveUserInfo));
259259
next<EO>()->onSucceeded(scope, [scope, iterator, failureHandler, errorHandler, exceptionHandler, to, index](int, const Paging<T> &paging) {
260260
if (paging.isValid())
261261
paging.iterate(scope, iterator, failureHandler, errorHandler, exceptionHandler, to, index);
@@ -292,9 +292,9 @@ qint64 Paging<T>::internalIterate(const std::function<bool (T, qint64)> &iterato
292292
max = static_cast<int>(std::min(to, offset + count) - offset);
293293
}
294294

295-
qCDebug(logPaging).nospace() << "iterating over available range ["
296-
<< offset + start << ":"
297-
<< offset + max - 1 << "]";
295+
qCDebug(logPaging, "iterating over available range [%s:%s]",
296+
QString::number(offset + start),
297+
QString::number(offset + max - 1));
298298

299299
// delete unused items caused by from
300300
for (auto j = 0; j < start; ++j)
@@ -307,8 +307,8 @@ qint64 Paging<T>::internalIterate(const std::function<bool (T, qint64)> &iterato
307307
auto item = d->data.value(i);
308308
auto index = offset >= 0 ? offset + i : -1ll;
309309
if (!iterator(item, index)) {
310-
qCDebug(logPaging) << "Iterator stopped paging iteration at index"
311-
<< index;
310+
qCDebug(logPaging, "Iterator stopped paging iteration at index %s",
311+
QString::number(index));
312312
canceled = true;
313313
break;
314314
}

src/restclient/qtrestclient_helpertypes.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct FnBinder<int, QJsonValue> {
7878
xFn(code, QJsonValue{QJsonValue::Undefined});
7979
},
8080
[xFn, code](const QCborValue &){
81-
qCWarning(logGlobal) << "CBOR data in JSON callback - discarding";
81+
qCWarning(logGlobal, "CBOR data in JSON callback - discarding");
8282
},
8383
[xFn, code](const QJsonValue &vValue){
8484
xFn(code, vValue);
@@ -98,7 +98,7 @@ struct FnBinder<int, QJsonObject> {
9898
xFn(code, QJsonObject{});
9999
},
100100
[xFn, code](const QCborValue &){
101-
qCWarning(logGlobal) << "CBOR data in JSON callback - discarding";
101+
qCWarning(logGlobal, "CBOR data in JSON callback - discarding");
102102
},
103103
[xFn, code](const QJsonValue &vValue){
104104
xFn(code, vValue.toObject());
@@ -118,7 +118,7 @@ struct FnBinder<int, QJsonArray> {
118118
xFn(code, QJsonArray{});
119119
},
120120
[xFn, code](const QCborValue &){
121-
qCWarning(logGlobal) << "CBOR data in JSON callback - discarding";
121+
qCWarning(logGlobal, "CBOR data in JSON callback - discarding");
122122
},
123123
[xFn, code](const QJsonValue &vValue){
124124
xFn(code, vValue.toArray());
@@ -141,7 +141,7 @@ struct FnBinder<int, QCborValue> {
141141
xFn(code, vValue);
142142
},
143143
[xFn, code](const QJsonValue &){
144-
qCWarning(logGlobal) << "JSON data in CBOR callback - discarding";
144+
qCWarning(logGlobal, "JSON data in CBOR callback - discarding");
145145
}
146146
}, value);
147147
};
@@ -161,7 +161,7 @@ struct FnBinder<int, QCborMap> {
161161
xFn(code, vValue.toMap());
162162
},
163163
[xFn, code](const QJsonValue &){
164-
qCWarning(logGlobal) << "JSON data in CBOR callback - discarding";
164+
qCWarning(logGlobal, "JSON data in CBOR callback - discarding");
165165
}
166166
}, value);
167167
};
@@ -181,7 +181,7 @@ struct FnBinder<int, QCborArray> {
181181
xFn(code, vValue.toArray());
182182
},
183183
[xFn, code](const QJsonValue &){
184-
qCWarning(logGlobal) << "JSON data in CBOR callback - discarding";
184+
qCWarning(logGlobal, "JSON data in CBOR callback - discarding");
185185
}
186186
}, value);
187187
};

0 commit comments

Comments
 (0)