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>
This commit is contained in:
Marc Mutz 2022-08-18 11:04:40 +02:00
parent 4906b43b00
commit f06c41e729

View File

@ -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) {