diff options
-rw-r--r-- | desktop-widgets/tab-widgets/TabDiveInformation.cpp | 4 | ||||
-rw-r--r-- | profile-widget/diveprofileitem.cpp | 14 | ||||
-rw-r--r-- | qt-models/cylindermodel.cpp | 12 |
3 files changed, 15 insertions, 15 deletions
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<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; diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp index 521e3fb82..da3028ebb 100644 --- a/profile-widget/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -659,9 +659,9 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo if (!shouldCalculateStuff(topLeft, bottomRight)) return; - int plotted_cyl[MAX_CYLINDERS] = { false, }; - int last_plotted[MAX_CYLINDERS] = { 0, }; - QPolygonF poly[MAX_CYLINDERS]; + std::vector<int> plotted_cyl(MAX_CYLINDERS, false); + std::vector<int> last_plotted(MAX_CYLINDERS, 0); + std::vector<QPolygonF> poly(MAX_CYLINDERS); QPolygonF boundingPoly; polygons.clear(); @@ -707,9 +707,9 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo qDeleteAll(texts); texts.clear(); - int seen_cyl[MAX_CYLINDERS] = { false, }; - int last_pressure[MAX_CYLINDERS] = { 0, }; - int last_time[MAX_CYLINDERS] = { 0, }; + std::vector<int> seen_cyl(MAX_CYLINDERS, false); + std::vector<int> last_pressure(MAX_CYLINDERS, 0); + std::vector<int> last_time(MAX_CYLINDERS, 0); // These are offset values used to print the gas lables and pressures on a // dive profile at appropriate Y-coordinates. We alternate aligning the @@ -720,7 +720,7 @@ void DiveGasPressureItem::modelDataChanged(const QModelIndex &topLeft, const QMo // pressures. QFlags<Qt::AlignmentFlag> alignVar = Qt::AlignTop; - QFlags<Qt::AlignmentFlag> align[MAX_CYLINDERS]; + std::vector<QFlags<Qt::AlignmentFlag>> align(MAX_CYLINDERS); double axisRange = (vAxis->maximum() - vAxis->minimum())/1000; // Convert axis pressure range to bar double axisLog = log10(log10(axisRange)); diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index a05cef23f..b6e5a033a 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -507,7 +507,7 @@ Qt::ItemFlags CylindersModel::flags(const QModelIndex &index) const void CylindersModel::remove(const QModelIndex &index) { - int mapping[MAX_CYLINDERS]; + std::vector<int> mapping(MAX_CYLINDERS); if (index.column() == USE) { cylinder_t *cyl = cylinderAt(index); @@ -538,9 +538,9 @@ void CylindersModel::remove(const QModelIndex &index) for (int i = index.row() + 1; i < MAX_CYLINDERS; i++) mapping[i] = i - 1; - cylinder_renumber(&displayed_dive, mapping); + cylinder_renumber(&displayed_dive, &mapping[0]); if (in_planner()) - DivePlannerPointsModel::instance()->cylinderRenumber(mapping); + DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]); changed = true; endRemoveRows(); dataChanged(index, index); @@ -548,7 +548,7 @@ void CylindersModel::remove(const QModelIndex &index) void CylindersModel::moveAtFirst(int cylid) { - int mapping[MAX_CYLINDERS]; + std::vector<int> mapping(MAX_CYLINDERS); cylinder_t temp_cyl; beginMoveRows(QModelIndex(), cylid, cylid, QModelIndex(), 0); @@ -561,9 +561,9 @@ void CylindersModel::moveAtFirst(int cylid) mapping[cylid] = 0; for (int i = cylid + 1; i < MAX_CYLINDERS; i++) mapping[i] = i; - cylinder_renumber(&displayed_dive, mapping); + cylinder_renumber(&displayed_dive, &mapping[0]); if (in_planner()) - DivePlannerPointsModel::instance()->cylinderRenumber(mapping); + DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]); changed = true; endMoveRows(); } |