From 9ed5cf16a4a0f982f0fae170740ee2886f634a14 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 23 Feb 2019 18:31:02 +0100 Subject: [PATCH] Coding style: remove Java-style function definition Remove a few cases of void fun() { ... } While touching these functions, fix a few other whitespace coding style violations. Signed-off-by: Berthold Stoeger --- core/deco.c | 3 ++- core/errorhelper.c | 3 ++- core/profile.c | 3 ++- desktop-widgets/divelogimportdialog.cpp | 3 ++- desktop-widgets/filterwidget2.cpp | 6 ++++-- desktop-widgets/mainwindow.cpp | 12 +++++++----- desktop-widgets/tab-widgets/maintab.cpp | 6 +++--- desktop-widgets/usermanual.cpp | 7 +++++-- profile-widget/diveprofileitem.cpp | 3 ++- smtk-import/smartrak.c | 3 ++- 10 files changed, 31 insertions(+), 18 deletions(-) diff --git a/core/deco.c b/core/deco.c index c3a8059c0..b60a787b5 100644 --- a/core/deco.c +++ b/core/deco.c @@ -526,7 +526,8 @@ void dump_tissues(struct deco_state *ds) } #endif -void clear_vpmb_state(struct deco_state *ds) { +void clear_vpmb_state(struct deco_state *ds) +{ int ci; for (ci = 0; ci < 16; ci++) { ds->max_n2_crushing_pressure[ci] = 0.0; diff --git a/core/errorhelper.c b/core/errorhelper.c index cad595912..b77f70186 100644 --- a/core/errorhelper.c +++ b/core/errorhelper.c @@ -26,6 +26,7 @@ int report_error(const char *fmt, ...) return -1; } -void set_error_cb(void(*cb)(char *)) { +void set_error_cb(void(*cb)(char *)) +{ error_cb = cb; } diff --git a/core/profile.c b/core/profile.c index 9cc072973..ddf9b601e 100644 --- a/core/profile.c +++ b/core/profile.c @@ -124,7 +124,8 @@ int evn_allocated; int evn_used; #if WE_DONT_USE_THIS /* we need to implement event filters in Qt */ -int evn_foreach (void (*callback)(const char *, bool *, void *), void *data) { +int evn_foreach (void (*callback)(const char *, bool *, void *), void *data) +{ int i; for (i = 0; i < evn_used; i++) { diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp index a6242ec8d..7675e94c2 100644 --- a/desktop-widgets/divelogimportdialog.cpp +++ b/desktop-widgets/divelogimportdialog.cpp @@ -242,7 +242,8 @@ ColumnNameResult::ColumnNameResult(QObject *parent) : QAbstractTableModel(parent } -void ColumnNameResult::swapValues(int firstIndex, int secondIndex) { +void ColumnNameResult::swapValues(int firstIndex, int secondIndex) +{ QString one = columnNames[firstIndex]; QString two = columnNames[secondIndex]; setData(index(0, firstIndex), QVariant(two), Qt::EditRole); diff --git a/desktop-widgets/filterwidget2.cpp b/desktop-widgets/filterwidget2.cpp index f106c354e..d95311da3 100644 --- a/desktop-widgets/filterwidget2.cpp +++ b/desktop-widgets/filterwidget2.cpp @@ -213,13 +213,15 @@ void FilterWidget2::updateFilter() filterDataChanged(filterData); } -void FilterWidget2::updateLogged(int value) { +void FilterWidget2::updateLogged(int value) +{ if (value == Qt::Unchecked) ui.planned->setChecked(true); updateFilter(); } -void FilterWidget2::updatePlanned(int value) { +void FilterWidget2::updatePlanned(int value) +{ if (value == Qt::Unchecked) ui.logged->setChecked(true); updateFilter(); diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 95b714d00..2a198110e 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -403,11 +403,11 @@ void MainWindow::enableDisableOtherDCsActions() ui.actionPreviousDC->setEnabled(nr); } -void MainWindow::setDefaultState() { +void MainWindow::setDefaultState() +{ setApplicationState("Default"); - if (mainTab->getEditMode() != MainTab::NONE) { + if (mainTab->getEditMode() != MainTab::NONE) ui.bottomLeft->currentWidget()->setEnabled(false); - } } MainWindow *MainWindow::instance() @@ -437,7 +437,8 @@ void MainWindow::recreateDiveList() MultiFilterSortModel::instance()->myInvalidate(); } -void MainWindow::configureToolbar() { +void MainWindow::configureToolbar() +{ if (current_dive) { bool freeDiveMode = current_dive->dc.divemode == FREEDIVE; ui.profCalcCeiling->setDisabled(freeDiveMode); @@ -1839,7 +1840,8 @@ void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topL } } -void MainWindow::setApplicationState(const QByteArray& state) { +void MainWindow::setApplicationState(const QByteArray &state) +{ if (!applicationState.keys().contains(state)) return; diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 8b23eb147..fe4f6186a 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -1195,9 +1195,9 @@ void MainTab::escDetected() setFocus(); } -void MainTab::clearTabs() { - for (auto widget : extraWidgets) { +void MainTab::clearTabs() +{ + for (auto widget: extraWidgets) widget->clear(); - } clearEquipment(); } diff --git a/desktop-widgets/usermanual.cpp b/desktop-widgets/usermanual.cpp index 66262e2ac..69e86864b 100644 --- a/desktop-widgets/usermanual.cpp +++ b/desktop-widgets/usermanual.cpp @@ -128,7 +128,8 @@ void UserManual::linkClickedSlot(const QUrl& url) } #ifdef Q_OS_MAC -void UserManual::showEvent(QShowEvent *e) { +void UserManual::showEvent(QShowEvent *e) +{ MainWindow *m = MainWindow::instance(); filterAction = m->findChild(QLatin1String("actionFilterTags"), Qt::FindDirectChildrenOnly); if (filterAction != nullptr) @@ -137,7 +138,9 @@ void UserManual::showEvent(QShowEvent *e) { if (closeAction != nullptr) closeAction->setShortcut(QKeySequence()); } -void UserManual::hideEvent(QHideEvent *e) { + +void UserManual::hideEvent(QHideEvent *e) +{ if (closeAction != NULL) closeAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); if (filterAction != NULL) diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp index c31944f87..d47ceff02 100644 --- a/profile-widget/diveprofileitem.cpp +++ b/profile-widget/diveprofileitem.cpp @@ -638,7 +638,8 @@ void DiveMeanDepthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem* connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_average_depthChanged, this, &DiveAmbPressureItem::setVisible); } -void DiveMeanDepthItem::createTextItem() { +void DiveMeanDepthItem::createTextItem() +{ plot_data *entry = dataModel->data().entry; int sec = entry[dataModel->rowCount()-1].sec; qDeleteAll(texts); diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 67bf1fd6e..31c7e4dc3 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -645,7 +645,8 @@ static struct types_list *smtk_index_list(MdbHandle *mdb, char *table_name, char * Buddy table format: * | Idx | Text (nickname) | Name | Firstname | Middlename | Title | Picture | Phone | ... */ -static void smtk_build_buddies(MdbHandle *mdb, char *array[]) { +static void smtk_build_buddies(MdbHandle *mdb, char *array[]) +{ MdbTableDef *table; MdbColumn *col[MDB_MAX_COLS]; char *bound_values[MDB_MAX_COLS], *fullname = NULL, *str = NULL;