From ff653f721c01b98587236c0b4e0cf662cb3a33a6 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 27 Jun 2019 07:52:15 +0200 Subject: 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 --- desktop-widgets/tab-widgets/TabDiveInformation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/tab-widgets/TabDiveInformation.cpp b/desktop-widgets/tab-widgets/TabDiveInformation.cpp index e6bb7c581..d5ce7d035 100644 --- a/desktop-widgets/tab-widgets/TabDiveInformation.cpp +++ b/desktop-widgets/tab-widgets/TabDiveInformation.cpp @@ -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 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; -- cgit v1.2.3-70-g09d2