mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: C++-ify statistics.c
The old code was wild: For the yearly statistics it would allocate one entry per dive in the log. Of course, it would also leak C-style strings. Convert the whole thing to somewhat idiomatic C++. Somewhat wasted work, because I'd like to convert the whole thing to the new statistics code. But let's finish the conversion to C++ first. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
84219641de
commit
1daa4f0584
12 changed files with 496 additions and 582 deletions
|
|
@ -385,14 +385,13 @@ QVector<QPair<QString, int>> selectedDivesGasUsed()
|
|||
int j;
|
||||
QMap<QString, int> gasUsed;
|
||||
for (dive *d: getDiveSelection()) {
|
||||
volume_t *diveGases = get_gas_used(d);
|
||||
std::vector<volume_t> diveGases = get_gas_used(d);
|
||||
for (j = 0; j < d->cylinders.nr; j++) {
|
||||
if (diveGases[j].mliter) {
|
||||
QString gasName = gasname(get_cylinder(d, j)->gasmix);
|
||||
gasUsed[gasName] += diveGases[j].mliter;
|
||||
}
|
||||
}
|
||||
free(diveGases);
|
||||
}
|
||||
QVector<QPair<QString, int>> gasUsedOrdered;
|
||||
gasUsedOrdered.reserve(gasUsed.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue