diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-06-26 22:25:22 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-06-26 23:05:21 +0200 |
commit | d65936200a2756e6619a109fa6fa673b91df802e (patch) | |
tree | 80b6b6fc7ba9023cbe47290b8ae1bc5468a19bb1 /migration | |
parent | 4046773c41ee3c0f65840828ab983cfd13451c85 (diff) |
modernize C++ syntax
No visible changes (hopefully).
Diffstat (limited to 'migration')
-rw-r--r-- | migration/20160906_00-mappings.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
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 <QDebug> +using namespace options; using namespace migrations; static const char* const old_names[] = @@ -46,19 +47,19 @@ static QList<QList<QPointF>> 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<QPointF> 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<QPointF>& points : get_old_splines()) - if (points.size()) + if (!points.empty()) return true; } |