Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/ksslinfodialog.cpp
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Line(s) | 245 | { | |||
---|---|---|---|---|---|
246 | const QStringList sl = es.split(QLatin1Char('\n'), QString::KeepEmptyParts); | 246 | const QStringList sl = es.split(QLatin1Char('\n'), QString::KeepEmptyParts); | ||
247 | QList<QList<KSslError::Error> > ret; | 247 | QList<QList<KSslError::Error> > ret; | ||
248 | ret.reserve(sl.size()); | 248 | ret.reserve(sl.size()); | ||
249 | for (const QString &s : sl) { | 249 | for (const QString &s : sl) { | ||
250 | QList<KSslError::Error> certErrors; | 250 | QList<KSslError::Error> certErrors; | ||
251 | const QStringList sl2 = s.split(QLatin1Char('\t'), QString::SkipEmptyParts); | 251 | const QStringList sl2 = s.split(QLatin1Char('\t'), QString::SkipEmptyParts); | ||
252 | for (const QString &s2 : sl2) { | 252 | for (const QString &s2 : sl2) { | ||
253 | bool didConvert; | 253 | bool didConvert; | ||
254 | KSslError::Error error = static_cast<KSslError::Error>(s2.toInt(&didConvert)); | 254 | KSslError::Error error = KSslErrorPrivate::errorFromQSslError(static_cast<QSslError::SslError>(s2.toInt(&didConvert))); | ||
255 | if (didConvert) { | 255 | if (didConvert) { | ||
256 | certErrors.append(error); | 256 | certErrors.append(error); | ||
257 | } | 257 | } | ||
258 | } | 258 | } | ||
259 | ret.append(certErrors); | 259 | ret.append(certErrors); | ||
260 | } | 260 | } | ||
261 | return ret; | 261 | return ret; | ||
262 | } | 262 | } | ||
263 | 263 | | |||
264 | //static | ||||
265 | QList<QList<QSslError::SslError>> KSslInfoDialog::certificateErrorsFromString(const QString &errorsString) | ||||
266 | { | ||||
267 | const QStringList sl = errorsString.split(QLatin1Char('\n'), QString::KeepEmptyParts); | ||||
268 | QList<QList<QSslError::SslError>> ret; | ||||
269 | ret.reserve(sl.size()); | ||||
270 | for (const QString &s : sl) { | ||||
271 | QList<QSslError::SslError> certErrors; | ||||
272 | const QStringList sl2 = s.split(QLatin1Char('\t'), QString::SkipEmptyParts); | ||||
273 | for (const QString &s2 : sl2) { | ||||
274 | bool didConvert; | ||||
275 | QSslError::SslError error = static_cast<QSslError::SslError>(s2.toInt(&didConvert)); | ||||
276 | if (didConvert) { | ||||
277 | certErrors.append(error); | ||||
278 | } | ||||
279 | } | ||||
280 | ret.append(certErrors); | ||||
281 | } | ||||
282 | return ret; | ||||
283 | } | ||||
ahmadsamir: Nitpick, shouldn't there be a "// static" comment like the other method?
Wouldn't a QVector be… | |||||
In theory, yes. However, changing this here and now would trigger quite some ripple effect through the code, which currently is using QList everywhere, so I'd suggest to do that as a separate change (if at all), to not hide security-relevant changes under lots of QList -> QVector porting noise. The other thing to consider the consistency in this code if we change just a single use from QList to QVector, especially if that's not a performance-sensitive path and Qt6 is supposed to change all this anyway (QList's implementation going away). vkrause: In theory, yes. However, changing this here and now would trigger quite some ripple effect… | |||||
OK, thanks for explaining. (But I think there still should be a "// static" comment for that method). ahmadsamir: OK, thanks for explaining.
(But I think there still should be a "// static" comment for that… |
Nitpick, shouldn't there be a "// static" comment like the other method?
Wouldn't a QVector be better here (QVector<QList<QSslError::SslError>>)? that is IIUC what the QList docs and [1] are saying.
[1]https://marcmutz.wordpress.com/effective-qt/containers/