diff options
author | Katja Marttila <katja.marttila@qt.io> | 2019-03-21 13:14:53 +0200 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2019-03-25 05:41:56 +0000 |
commit | 2767210585916bc5b9c94701ad736ca07eb6d067 (patch) | |
tree | 6c83287d3d86abaf406358458c649d8b1397b9fd /src | |
parent | 407b19ff904244e287d62c7d02ca2a0779fc7b09 (diff) |
Fix update with long version numbers
Update fails if version number is longer than 32bit int. Fixed so that the
value is converted to 64bit int instead so the int overflow will not happen.
Change-Id: If7ab57e89b155793e9fab3ba5dad9c734adc2234
Fixes: QTIFW-1310
Reviewed-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/kdtools/updatefinder.cpp | 10 |
1 files changed, 5 insertions, 5 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")) |