From e68723f1c7f5619c532f433d86ef6a6712b2633c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Mon, 15 Jun 2020 10:16:13 -0400 Subject: [PATCH] [libcalamares] Handle integers prefixed with 0 or 0x - QString to-integer members detect if an integer string begins with "0x" (base 16) or "0", base 8; but QVariant members do not. - QString: the C language convention is used is base is set to 0. - Convert to QString and use its member toLongLong() and set base to 0 to detect integer strings begin with a prefix. --- src/libcalamares/utils/Variant.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libcalamares/utils/Variant.cpp b/src/libcalamares/utils/Variant.cpp index e0156c35e..b8173acfa 100644 --- a/src/libcalamares/utils/Variant.cpp +++ b/src/libcalamares/utils/Variant.cpp @@ -72,14 +72,7 @@ getInteger( const QVariantMap& map, const QString& key, qint64 d ) if ( map.contains( key ) ) { auto v = map.value( key ); - if ( v.type() == QVariant::Int ) - { - result = v.toInt(); - } - else if ( v.type() == QVariant::LongLong ) - { - result = v.toLongLong(); - } + result = v.toString().toLongLong(nullptr, 0); } return result;