summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-08 21:25:02 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-10 02:37:03 +0900
commite1cd055111cc4f7e11454b3726741f9f8a55d850 (patch)
treebb391d65743da3285367ec1f1803925978db6877 /desktop-widgets
parent70cabb968c481e566e8249465f153e05e6dc0347 (diff)
downloadsubsurface-e1cd055111cc4f7e11454b3726741f9f8a55d850.tar.gz
code cleanup: add empty table structures
It seemed to make sense to combine all three types in one commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/divelogimportdialog.cpp6
-rw-r--r--desktop-widgets/divesiteimportdialog.cpp2
-rw-r--r--desktop-widgets/mainwindow.cpp12
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp6
4 files changed, 13 insertions, 13 deletions
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index 1d6557697..e0d24fd92 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -904,9 +904,9 @@ int DiveLogImportDialog::parseTxtHeader(QString fileName, char **params, int pnr
void DiveLogImportDialog::on_buttonBox_accepted()
{
- struct dive_table table = { 0 };
- struct trip_table trips = { 0 };
- struct dive_site_table sites = { 0 };
+ struct dive_table table = empty_dive_table;
+ struct trip_table trips = empty_trip_table;
+ struct dive_site_table sites = empty_dive_site_table;
QStringList r = resultModel->result();
if (ui->knownImports->currentText() != "Manual import") {
for (int i = 0; i < fileNames.size(); ++i) {
diff --git a/desktop-widgets/divesiteimportdialog.cpp b/desktop-widgets/divesiteimportdialog.cpp
index defb90617..f440d6edb 100644
--- a/desktop-widgets/divesiteimportdialog.cpp
+++ b/desktop-widgets/divesiteimportdialog.cpp
@@ -65,7 +65,7 @@ void DivesiteImportDialog::on_cancel_clicked()
void DivesiteImportDialog::on_ok_clicked()
{
// delete non-selected dive sites
- struct dive_site_table selectedSites = { 0 };
+ struct dive_site_table selectedSites = empty_dive_site_table;
for (int i = 0; i < importedSites.nr; i++)
if (divesiteImportedModel->data(divesiteImportedModel->index(i, 0), Qt::CheckStateRole) == Qt::Checked) {
struct dive_site *newSite = alloc_dive_site();
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index ddb174984..0b7975054 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -1662,9 +1662,9 @@ void MainWindow::importFiles(const QStringList fileNames)
return;
QByteArray fileNamePtr;
- struct dive_table table = { 0 };
- struct trip_table trips = { 0 };
- struct dive_site_table sites = { 0 };
+ struct dive_table table = empty_dive_table;
+ struct trip_table trips = empty_trip_table;
+ struct dive_site_table sites = empty_dive_site_table;
for (int i = 0; i < fileNames.size(); ++i) {
fileNamePtr = QFile::encodeName(fileNames.at(i));
@@ -1757,9 +1757,9 @@ void MainWindow::on_actionImportDiveSites_triggered()
return;
updateLastUsedDir(QFileInfo(fileNames[0]).dir().path());
- struct dive_table table = { 0 };
- struct trip_table trips = { 0 };
- struct dive_site_table sites = { 0 };
+ struct dive_table table = empty_dive_table;
+ struct trip_table trips = empty_trip_table;
+ struct dive_site_table sites = empty_dive_site_table;
for (const QString &s: fileNames) {
QByteArray fileNamePtr = QFile::encodeName(s);
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index 2fecd07a1..658b8196a 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -453,9 +453,9 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton *button)
break;
}
/* parse file and import dives */
- struct dive_table table = { 0 };
- struct trip_table trips = { 0 };
- struct dive_site_table sites = { 0 };
+ struct dive_table table = empty_dive_table;
+ struct trip_table trips = empty_trip_table;
+ struct dive_site_table sites = empty_dive_site_table;
parse_file(QFile::encodeName(zipFile.fileName()), &table, &trips, &sites);
Command::importDives(&table, &trips, &sites, IMPORT_MERGE_ALL_TRIPS, QStringLiteral("divelogs.de"));