Commit 4539aa0c authored by Fawzi Mohamed's avatar Fawzi Mohamed Committed by Eike Ziller

Ios: Fix version comparison

after an hint of CppCheck performed by Tobias Hunger

Change-Id: I5b2239faa4acf936389e1b4d1d7eb2acc3e7f3b3
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 75d9ce0f
...@@ -63,7 +63,7 @@ static int compareVersions(const QString &v1, const QString &v2) ...@@ -63,7 +63,7 @@ static int compareVersions(const QString &v1, const QString &v2)
QStringList v1L = v1.split(QLatin1Char('.')); QStringList v1L = v1.split(QLatin1Char('.'));
QStringList v2L = v2.split(QLatin1Char('.')); QStringList v2L = v2.split(QLatin1Char('.'));
int i = 0; int i = 0;
while (v1.length() > i && v1.length() > i) { while (v1L.length() > i && v2L.length() > i) {
bool n1Ok, n2Ok; bool n1Ok, n2Ok;
int n1 = v1L.value(i).toInt(&n1Ok); int n1 = v1L.value(i).toInt(&n1Ok);
int n2 = v2L.value(i).toInt(&n2Ok); int n2 = v2L.value(i).toInt(&n2Ok);
...@@ -77,9 +77,9 @@ static int compareVersions(const QString &v1, const QString &v2) ...@@ -77,9 +77,9 @@ static int compareVersions(const QString &v1, const QString &v2)
return 1; return 1;
++i; ++i;
} }
if (v1.length() > v2.length()) if (v1L.length() > v2L.length())
return -1; return -1;
if (v1.length() < v2.length()) if (v1L.length() < v2L.length())
return 1; return 1;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment