core: default initialize units-type objects to 0

Makes the code much nicer to read.

Default initialize cylinder_t to the empty cylinder.

This produces lots of warnings, because most structure are now
not PODs anymore and shouldn't be erased using memset().

These memset()s will be removed one-by-one and replaced by
proper constructors.

The whole ordeal made it necessary to add a constructor to
struct event. To simplify things the whole optimization of
the variable-size event names was removed. In upcoming commits
this will be replaced by std::string anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-04 19:15:47 +02:00 committed by bstoeger
parent b82fdd1d20
commit 408b31b6ce
34 changed files with 128 additions and 148 deletions

View file

@ -217,7 +217,7 @@ static location_t parseGpsText(const QString &text)
double lat, lon;
if (parseGpsText(text.trimmed(), &lat, &lon))
return create_location(lat, lon);
return zero_location;
return location_t();
}
// Check if GPS text is parseable
@ -263,7 +263,7 @@ void LocationInformationWidget::initFields(dive_site *ds)
DiveFilter::instance()->startFilterDiveSites(QVector<dive_site *>{ ds });
filter_model.invalidate();
} else {
filter_model.set(0, zero_location);
filter_model.set(0, location_t());
clearLabels();
}
@ -348,7 +348,7 @@ void LocationInformationWidget::reverseGeocode()
Command::editDiveSiteTaxonomy(ds, taxonomy);
}
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *) : currentLocation(zero_location)
DiveLocationFilterProxyModel::DiveLocationFilterProxyModel(QObject *)
{
}
@ -669,7 +669,6 @@ void DiveLocationLineEdit::setCurrentDiveSite(struct dive *d)
currentLocation = dive_get_gps_location(d);
} else {
currDs = nullptr;
currentLocation = zero_location;
}
if (!currDs)
clear();