From c893d19ea41aa74087f4ec595d059cc1c091f85c Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 2 Jan 2022 14:24:04 +0100 Subject: [PATCH] cleanup: pass all parameters to weightsystem_t With -Wextra, gcc/g++ complains that compound initialization of weightsystem_t misses the auto_filled parameter. Add it. For C++ code we might think about writing a constructor. However, we use two versions: with and without copied string. Signed-off-by: Berthold Stoeger --- core/datatrak.c | 2 +- core/import-divinglog.c | 2 +- desktop-widgets/modeldelegates.cpp | 2 +- mobile-widgets/qmlmanager.cpp | 2 +- smtk-import/smartrak.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/datatrak.c b/core/datatrak.c index c19c243a5..01b03615d 100644 --- a/core/datatrak.c +++ b/core/datatrak.c @@ -636,7 +636,7 @@ static void wlog_compl_parser(struct memblock *wl_mem, struct dive *dt_dive, int */ tmp = (int) two_bytes_to_int(runner[pos_weight + 1], runner[pos_weight]); if (tmp != 0x7fff) { - weightsystem_t ws = { {lrint(tmp * 10)}, QT_TRANSLATE_NOOP("gettextFromC", "unknown") }; + weightsystem_t ws = { {lrint(tmp * 10)}, QT_TRANSLATE_NOOP("gettextFromC", "unknown"), false }; add_cloned_weightsystem(&dt_dive->weightsystems, ws); } diff --git a/core/import-divinglog.c b/core/import-divinglog.c index 8f396b872..a961a4e40 100644 --- a/core/import-divinglog.c +++ b/core/import-divinglog.c @@ -305,7 +305,7 @@ static int divinglog_dive(void *param, int columns, char **data, char **column) state->cur_dive->watertemp.mkelvin = C_to_mkelvin(atol(data[9])); if (data[10]) { - weightsystem_t ws = { { atol(data[10]) * 1000 }, translate("gettextFromC", "unknown") }; + weightsystem_t ws = { { atol(data[10]) * 1000 }, translate("gettextFromC", "unknown"), false }; add_cloned_weightsystem(&state->cur_dive->weightsystems, ws); } diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index acfbfde52..1f8dac9f4 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -303,7 +303,7 @@ void WSInfoDelegate::setModelData(QWidget *, QAbstractItemModel *, const QModelI grams = wsim->data(wsim->index(row, WSInfoModel::GR)).toInt(); } - mymodel->setTempWS(currCombo.currRow, weightsystem_t{ { grams }, copy_qstring(weightName) }); + mymodel->setTempWS(currCombo.currRow, weightsystem_t{ { grams }, copy_qstring(weightName), false }); } WSInfoDelegate::WSInfoDelegate(QObject *parent) : ComboBoxDelegate(WSInfoModel::instance(), parent, true) diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 6b422c741..a0ae9770e 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1126,7 +1126,7 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt // not sure what we'd do if there was more than one weight system // defined - for now just ignore that case if (d->weightsystems.nr == 0) { - weightsystem_t ws = { { parseWeightToGrams(weight) } , strdup(qPrintable(tr("weight"))) }; + weightsystem_t ws = { { parseWeightToGrams(weight) } , strdup(qPrintable(tr("weight"))), false }; add_to_weightsystem_table(&d->weightsystems, 0, ws); // takes ownership of the string } else if (d->weightsystems.nr == 1) { d->weightsystems.weightsystems[0].weight.grams = parseWeightToGrams(weight); diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 9eeb7bb13..1b1172368 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -1094,7 +1094,7 @@ void smartrak_import(const char *file, struct dive_table *divetable) /* No DC related data */ smtkdive->visibility = strtod(col[coln(VISIBILITY)]->bind_ptr, NULL) > 25 ? 5 : lrint(strtod(col[13]->bind_ptr, NULL) / 5); - weightsystem_t ws = { {lrint(strtod(col[coln(WEIGHT)]->bind_ptr, NULL) * 1000)}, "" }; + weightsystem_t ws = { {lrint(strtod(col[coln(WEIGHT)]->bind_ptr, NULL) * 1000)}, "", false }; add_cloned_weightsystem(&smtkdive->weightsystems, ws); smtkdive->suit = copy_string(suit_list[atoi(col[coln(SUITIDX)]->bind_ptr) - 1]); smtk_build_location(mdb_clon, col[coln(SITEIDX)]->bind_ptr, &smtkdive->dive_site);