diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-08-18 11:04:40 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-08-21 08:29:47 +0200 |
commit | f06c41e729dd0d6f57a161cc75d0872cd7fcc621 (patch) | |
tree | 96345a3ced04c29870b981623d911131025fadda /src/corelib/io/qdir.cpp | |
parent | 4906b43b0055aef027a43044c22374a5fc31df44 (diff) |
QDir: fix non-idiomatic indexed loop counting
Counting backwards from two may be clever, and less to type, but it
raised this code reader's eyebrows, so use the formulation everyone
understands instead.
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-103525
Change-Id: I9416539e552e78e4777a744405b0773a9df1f6d0
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/io/qdir.cpp')
-rw-r--r-- | src/corelib/io/qdir.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp index 694f0ef87d..fa2746798a 100644 --- a/src/corelib/io/qdir.cpp +++ b/src/corelib/io/qdir.cpp @@ -677,7 +677,7 @@ static int drivePrefixLength(const QString &path) } else if (path.startsWith("//"_L1)) { // UNC path; use its //server/share part as "drive" - it's as sane a // thing as we can do. - for (int i = 2; i-- > 0; ) { // Scan two "path fragments": + for (int i = 0 ; i < 2 ; ++i) { // Scan two "path fragments": while (drive < size && path.at(drive).unicode() == '/') drive++; if (drive >= size) { |