From d65936200a2756e6619a109fa6fa673b91df802e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 26 Jun 2018 22:25:22 +0200 Subject: modernize C++ syntax No visible changes (hopefully). --- migration/20160906_00-mappings.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'migration') diff --git a/migration/20160906_00-mappings.cpp b/migration/20160906_00-mappings.cpp index 567fbdcb..0019d0ef 100644 --- a/migration/20160906_00-mappings.cpp +++ b/migration/20160906_00-mappings.cpp @@ -18,6 +18,7 @@ #include +using namespace options; using namespace migrations; static const char* const old_names[] = @@ -46,19 +47,19 @@ static QList> get_old_splines() return group::with_settings_object([&](QSettings& settings) { for (const char* name : old_names) { + const int max = settings.value("point-count", 0).toInt(); + + if (max < 0 || max > 1 << 16) + return ret; + QList points; + points.reserve(max); settings.beginGroup(QString("Curves-%1").arg(name)); - const int max = settings.value("point-count", 0).toInt(); - for (int i = 0; i < max; i++) - { - QPointF new_point(settings.value(QString("point-%1-x").arg(i), 0).toDouble(), - settings.value(QString("point-%1-y").arg(i), 0).toDouble()); - - points.append(new_point); - } + points.append({ settings.value(QString("point-%1-x").arg(i), 0).toDouble(), + settings.value(QString("point-%1-y").arg(i), 0).toDouble() }); settings.endGroup(); @@ -85,7 +86,7 @@ struct mappings_from_2_3_0_rc11 : migration // run only if old splines exist for (const QList& points : get_old_splines()) - if (points.size()) + if (!points.empty()) return true; } -- cgit v1.2.3