summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/kdtools/updatefinder.cpp10
-rw-r--r--tests/auto/installer/compareversion/tst_compareversion.cpp6
2 files changed, 10 insertions, 6 deletions
diff --git a/src/libs/kdtools/updatefinder.cpp b/src/libs/kdtools/updatefinder.cpp
index b64f922c3..b12ffac99 100644
--- a/src/libs/kdtools/updatefinder.cpp
+++ b/src/libs/kdtools/updatefinder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Installer Framework.
@@ -601,18 +601,18 @@ int KDUpdater::compareVersion(const QString &v1, const QString &v2)
bool v2_ok = false;
if (index == v1_comps.count() && index < v2_comps.count()) {
- v2_comps.at(index).toInt(&v2_ok);
+ v2_comps.at(index).toLongLong(&v2_ok);
return v2_ok ? -1 : +1;
}
if (index < v1_comps.count() && index == v2_comps.count()) {
- v1_comps.at(index).toInt(&v1_ok);
+ v1_comps.at(index).toLongLong(&v1_ok);
return v1_ok ? +1 : -1;
}
if (index >= v1_comps.count() || index >= v2_comps.count())
break;
- int v1_comp = v1_comps.at(index).toInt(&v1_ok);
- int v2_comp = v2_comps.at(index).toInt(&v2_ok);
+ qlonglong v1_comp = v1_comps.at(index).toLongLong(&v1_ok);
+ qlonglong v2_comp = v2_comps.at(index).toLongLong(&v2_ok);
if (!v1_ok) {
if (v1_comps.at(index) == QLatin1String("x"))
diff --git a/tests/auto/installer/compareversion/tst_compareversion.cpp b/tests/auto/installer/compareversion/tst_compareversion.cpp
index 24ebe9ba6..a33d25b28 100644
--- a/tests/auto/installer/compareversion/tst_compareversion.cpp
+++ b/tests/auto/installer/compareversion/tst_compareversion.cpp
@@ -47,7 +47,11 @@ void tst_CompareVersion::compareVersion()
QCOMPARE(KDUpdater::compareVersion("2.1", "2.0"), +1);
QCOMPARE(KDUpdater::compareVersion("2.0", "2.0"), 0);
QCOMPARE(KDUpdater::compareVersion("2.1", "2.1"), 0);
-
+ QCOMPARE(KDUpdater::compareVersion("2.1", "2.1-201903190747"), -1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1"), +1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1-201903190747"), 0);
+ QCOMPARE(KDUpdater::compareVersion("2.1-0", "2.1-201903190747"), -1);
+ QCOMPARE(KDUpdater::compareVersion("2.1-201903190747", "2.1-0"), +1);
QCOMPARE(KDUpdater::compareVersion("2.0.12.4", "2.1.10.4"), -1);
}