Whitespace cleanup core divecomputer handling

Not entirely script based because of two odd issues where the script creates
bogus indentation.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2018-07-25 18:43:55 -07:00 committed by Lubomir I. Ivanov
parent 0e6c3db24c
commit c7f0e65b12
2 changed files with 19 additions and 20 deletions

View file

@ -1,8 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include "divecomputer.h"
#include "dive.h"
#include "subsurface-string.h"
#include "subsurface-qt/SettingsObjectWrapper.h"
#include "subsurface-string.h"
DiveComputerList dcList;
@ -38,13 +38,13 @@ bool DiveComputerNode::changesValues(const DiveComputerNode &b) const
const DiveComputerNode *DiveComputerList::getExact(const QString &m, uint32_t d)
{
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, d , {}, {}, {} } );
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, d, {}, {}, {}});
return it != dcs.end() && it->model == m && it->deviceId == d ? &*it : NULL;
}
const DiveComputerNode *DiveComputerList::get(const QString &m)
{
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, 0 , {}, {}, {} } );
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, 0, {}, {}, {}});
return it != dcs.end() && it->model == m ? &*it : NULL;
}
@ -62,7 +62,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin
{
if (m.isEmpty() || d == 0)
return;
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode { m, d , {}, {}, {} } );
auto it = std::lower_bound(dcs.begin(), dcs.end(), DiveComputerNode{m, d, {}, {}, {}});
if (it != dcs.end() && it->model == m && it->deviceId == d) {
// debugging: show changes
if (verbose)
@ -75,7 +75,7 @@ void DiveComputerList::addDC(QString m, uint32_t d, QString n, QString s, QStrin
if (!f.isEmpty())
it->firmware = f;
} else {
dcs.insert(it, DiveComputerNode { m, d, s, f, n });
dcs.insert(it, DiveComputerNode{m, d, s, f, n});
}
}
@ -89,13 +89,12 @@ static bool compareDCById(const DiveComputerNode &a, const DiveComputerNode &b)
return a.deviceId < b.deviceId;
}
extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t,
const char *, const char *, const char *),
bool select_only)
extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *, uint32_t, const char *, const char *, const char *),
bool select_only)
{
QVector<DiveComputerNode> values = dcList.dcs;
std::sort(values.begin(), values.end(), compareDCById);
for (const DiveComputerNode &node: values) {
for (const DiveComputerNode &node : values) {
bool found = false;
if (select_only) {
int j;
@ -104,7 +103,7 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *
struct divecomputer *dc;
if (!d->selected)
continue;
for_each_dc(d, dc) {
for_each_dc (d, dc) {
if (dc->deviceid == node.deviceId) {
found = true;
break;
@ -117,7 +116,7 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *
found = true;
}
if (found)
callback(f, qPrintable(node.model), node.deviceId, qPrintable(node.nickName),
callback(f, qPrintable(node.model), node.deviceId, qPrintable(node.nickName),
qPrintable(node.serialNumber), qPrintable(node.firmware));
}
}