From 6ed8a22dd2756557954dc85052870c0894de06ba Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 11 Jul 2019 14:23:28 +0200 Subject: Eradicate the last Java-style iterators and mark the module free of them ... and of QLinkedList. The change in QDesignerAbstractPropertySheetFactory is straight-forward. The rest are little buggers: - In macdeployqt, the code iterates inside an if. Weird, but portable. - In CppCodeParser, it's still somewhat harmless: just a call to std::remove_if to avoid running into quadratic complexity, even though the original loop had a good idea of iterating backwards, saving at least some copies in the process. Need to take care there that we continue to find the _first_ main.cpp, not the last, so add a check for mainCpp.isEmpty(). - In QtGradientStopsModel, however, needed to work around the absence of QMap::rbegin()/rend(), and it shows why they're missing: QMap's funky op* makes it impossible to just use std::reverse_iterator to do the heavy lifting. Use the recently-added QKeyValueIterator to get an approximation. I say 'approximation', because that one lacks operator->, so we need to use (*it).first, which brings back memories of Qt 2's iterators... Change-Id: I051e64b8d36b04ed2e7cf7695d9b797f08efaccb Reviewed-by: Jarek Kobus Reviewed-by: Friedemann Kleint --- src/macdeployqt/shared/shared.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/macdeployqt/shared') diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index a248d8ccd..69d0ce8ca 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -530,12 +530,11 @@ QSet getBinaryRPaths(const QString &path, bool resolve = true, QString QString output = otool.readAllStandardOutput(); QStringList outputLines = output.split("\n"); - QStringListIterator i(outputLines); - while (i.hasNext()) { - if (i.next().contains("cmd LC_RPATH") && i.hasNext() && - i.next().contains("cmdsize") && i.hasNext()) { - const QString &rpathCmd = i.next(); + for (auto i = outputLines.cbegin(), end = outputLines.cend(); i != end; ++i) { + if (i->contains("cmd LC_RPATH") && ++i != end && + i->contains("cmdsize") && ++i != end) { + const QString &rpathCmd = *i; int pathStart = rpathCmd.indexOf("path "); int pathEnd = rpathCmd.indexOf(" ("); if (pathStart >= 0 && pathEnd >= 0 && pathStart < pathEnd) { -- cgit v1.2.3