mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:53:23 +00:00
cleanup: replace constructs of the type &vector[0] by vector.data()
It appears that some misguided compiler / library combinations crash on &vector[0] for empty vectors. Even though very unfriendly, they are technically correct, so let's remove these constructs. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a8aa897117
commit
9b8eed7821
3 changed files with 6 additions and 6 deletions
|
@ -180,7 +180,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
|
||||||
filename.append(".xml");
|
filename.append(".xml");
|
||||||
QByteArray bt = QFile::encodeName(filename);
|
QByteArray bt = QFile::encodeName(filename);
|
||||||
std::vector<const dive_site *> sites = getDiveSitesToExport(ui->exportSelected->isChecked());
|
std::vector<const dive_site *> sites = getDiveSitesToExport(ui->exportSelected->isChecked());
|
||||||
save_dive_sites_logic(bt.data(), &sites[0], (int)sites.size(), ui->anonymize->isChecked());
|
save_dive_sites_logic(bt.data(), sites.data(), (int)sites.size(), ui->anonymize->isChecked());
|
||||||
}
|
}
|
||||||
} else if (ui->exportImageDepths->isChecked()) {
|
} else if (ui->exportImageDepths->isChecked()) {
|
||||||
filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir);
|
filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir);
|
||||||
|
|
|
@ -2120,7 +2120,7 @@ void QMLManager::exportToFile(export_types type, QString dir, bool anonymize)
|
||||||
case EX_DIVE_SITES_XML:
|
case EX_DIVE_SITES_XML:
|
||||||
{
|
{
|
||||||
std::vector<const dive_site *> sites = getDiveSitesToExport(false);
|
std::vector<const dive_site *> sites = getDiveSitesToExport(false);
|
||||||
save_dive_sites_logic(qPrintable(fileName + ".xml"), &sites[0], (int)sites.size(), anonymize);
|
save_dive_sites_logic(qPrintable(fileName + ".xml"), sites.data(), (int)sites.size(), anonymize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EX_UDDF:
|
case EX_UDDF:
|
||||||
|
|
|
@ -548,8 +548,8 @@ void CylindersModel::remove(QModelIndex index)
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
|
|
||||||
std::vector<int> mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());
|
std::vector<int> mapping = get_cylinder_map_for_remove(d->cylinders.nr + 1, index.row());
|
||||||
cylinder_renumber(d, &mapping[0]);
|
cylinder_renumber(d, mapping.data());
|
||||||
DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
|
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CylindersModel::cylinderAdded(struct dive *changed, int pos)
|
void CylindersModel::cylinderAdded(struct dive *changed, int pos)
|
||||||
|
@ -601,9 +601,9 @@ void CylindersModel::moveAtFirst(int cylid)
|
||||||
std::iota(mapping.begin(), mapping.begin() + cylid, 1);
|
std::iota(mapping.begin(), mapping.begin() + cylid, 1);
|
||||||
mapping[cylid] = 0;
|
mapping[cylid] = 0;
|
||||||
std::iota(mapping.begin() + (cylid + 1), mapping.end(), cylid);
|
std::iota(mapping.begin() + (cylid + 1), mapping.end(), cylid);
|
||||||
cylinder_renumber(d, &mapping[0]);
|
cylinder_renumber(d, mapping.data());
|
||||||
if (inPlanner)
|
if (inPlanner)
|
||||||
DivePlannerPointsModel::instance()->cylinderRenumber(&mapping[0]);
|
DivePlannerPointsModel::instance()->cylinderRenumber(mapping.data());
|
||||||
endMoveRows();
|
endMoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue