Cylinders: dynamically allocate cylinder arrays

When keeping track of cylinder related data, the code was using
static arrays of MAX_CYLINDERS length. If we want to use dynamically
sized cylinder arrays, these have to be dynamically allocated.
In C++ code, this is trivial: simply replace the C-style arrays
by std::vector<>. Don't use QVector, as no reference counting or
COW semantics are needed here. These are purely local and unshared
arrays.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-06-27 07:52:15 +02:00 committed by Dirk Hohndel
parent 11467fa326
commit ff653f721c
3 changed files with 15 additions and 15 deletions

View file

@ -55,8 +55,8 @@ void TabDiveInformation::updateProfile()
volume_t *gases = get_gas_used(current_dive);
QString volumes;
int mean[MAX_CYLINDERS], duration[MAX_CYLINDERS];
per_cylinder_mean_depth(current_dive, select_dc(current_dive), mean, duration);
std::vector<int> mean(MAX_CYLINDERS), duration(MAX_CYLINDERS);
per_cylinder_mean_depth(current_dive, select_dc(current_dive), &mean[0], &duration[0]);
volume_t sac;
QString gaslist, SACs, separator;