D24220: [src/ioslaves/*] replace deprecated foreach with range for
David Faure
noreply at phabricator.kde.org
Thu Sep 26 08:50:39 BST 2019
dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.
INLINE COMMENTS
> http.cpp:2612
> qCDebug(KIO_HTTP) << "============ Sending Header:";
> - Q_FOREACH (const QString &s, header.split(QStringLiteral("\r\n"), QString::SkipEmptyParts)) {
> + for (const QString &s : header.split(QStringLiteral("\r\n"), QString::SkipEmptyParts)) {
> qCDebug(KIO_HTTP) << s;
need to move that function call into a const local variable
> httpauthentication.cpp:548
>
> - Q_FOREACH (const QByteArray &path, valueForKey(m_challenge, "domain").split(' ')) {
> + for (const QByteArray &path : valueForKey(m_challenge, "domain").split(' ')) {
> QUrl u = m_resource.resolved(QUrl(QString::fromUtf8(path)));
same here
> kcookiejar.cpp:348
> if (updateWindowId) {
> - Q_FOREACH (WId windowId, cookie.windowIds()) {
> + for (WId windowId : cookie.windowIds()) {
> if (windowId && (!cookiePtr.windowIds().contains(windowId))) {
[that one actually returns a reference so it's actually fine.... until someone changes that...]
> kcookiejar.cpp:1413
> bool ok;
> - QStringList portList = str.mid(index + 1).split(QL1C(','));
> - Q_FOREACH (const QString &portStr, portList) {
> + for ( const QString &portStr : str.mid(index + 1).split(QL1C(',')) ) {
> const int portNum = portStr.toInt(&ok);
Keeps the separate variable, make it const.
Otherwise this will detach.
> kcookieserver.cpp:392
> QStringList result;
> - Q_FOREACH (const QString &domain, mCookieJar->getDomainList()) {
> + for (const QString &domain : mCookieJar->getDomainList()) {
> // Ignore domains that have policy set for but contain
[ok, returns a ref]
> trashimpl.cpp:717
> filesDir += QLatin1String("/files");
> - Q_FOREACH (const QString &fileName, listDir(filesDir)) {
> + for (const QString &fileName : listDir(filesDir)) {
> if (fileName == QLatin1Char('.') || fileName == QLatin1String("..")) {
needs local var
REPOSITORY
R241 KIO
REVISION DETAIL
https://phabricator.kde.org/D24220
To: ahmadsamir, #frameworks, dfaure
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20190926/9d0c4b05/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list