mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cleanup: user properly typed pointers
A trivial cleanup: replace void by properly typed pointers in cylinder_none() and weightsystem_none(). Moreover, remove the unused function no_weightsystems(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
62672276d0
commit
ecb64d7e3e
3 changed files with 6 additions and 17 deletions
|
@ -749,9 +749,8 @@ struct ws_info_t {
|
||||||
extern struct ws_info_t ws_info[MAX_WS_INFO];
|
extern struct ws_info_t ws_info[MAX_WS_INFO];
|
||||||
|
|
||||||
extern bool cylinder_nodata(const cylinder_t *cyl);
|
extern bool cylinder_nodata(const cylinder_t *cyl);
|
||||||
extern bool cylinder_none(void *_data);
|
extern bool cylinder_none(const cylinder_t *cyl);
|
||||||
extern bool weightsystem_none(void *_data);
|
extern bool weightsystem_none(const weightsystem_t *ws);
|
||||||
extern bool no_weightsystems(weightsystem_t *ws);
|
|
||||||
extern void remove_cylinder(struct dive *dive, int idx);
|
extern void remove_cylinder(struct dive *dive, int idx);
|
||||||
extern void remove_weightsystem(struct dive *dive, int idx);
|
extern void remove_weightsystem(struct dive *dive, int idx);
|
||||||
extern void reset_cylinders(struct dive *dive, bool track_gas);
|
extern void reset_cylinders(struct dive *dive, bool track_gas);
|
||||||
|
|
|
@ -69,15 +69,14 @@ bool cylinder_nodata(const cylinder_t *cyl)
|
||||||
!cyl->deco_gas_used.mliter;
|
!cyl->deco_gas_used.mliter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool cylinder_nosamples(cylinder_t *cyl)
|
static bool cylinder_nosamples(const cylinder_t *cyl)
|
||||||
{
|
{
|
||||||
return !cyl->sample_start.mbar &&
|
return !cyl->sample_start.mbar &&
|
||||||
!cyl->sample_end.mbar;
|
!cyl->sample_end.mbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cylinder_none(void *_data)
|
bool cylinder_none(const cylinder_t *cyl)
|
||||||
{
|
{
|
||||||
cylinder_t *cyl = _data;
|
|
||||||
return cylinder_nodata(cyl) && cylinder_nosamples(cyl);
|
return cylinder_nodata(cyl) && cylinder_nosamples(cyl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,20 +100,11 @@ const char *gasname(struct gasmix gasmix)
|
||||||
return gas;
|
return gas;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool weightsystem_none(void *_data)
|
bool weightsystem_none(const weightsystem_t *ws)
|
||||||
{
|
{
|
||||||
weightsystem_t *ws = _data;
|
|
||||||
return !ws->weight.grams && !ws->description;
|
return !ws->weight.grams && !ws->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool no_weightsystems(weightsystem_t *ws)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++)
|
|
||||||
if (!weightsystem_none(ws + i))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We hardcode the most common standard cylinders,
|
* We hardcode the most common standard cylinders,
|
||||||
* we should pick up any other names from the dive
|
* we should pick up any other names from the dive
|
||||||
|
|
|
@ -1040,7 +1040,7 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
||||||
}
|
}
|
||||||
// not sure what we'd do if there was more than one weight system
|
// not sure what we'd do if there was more than one weight system
|
||||||
// defined - for now just ignore that case
|
// defined - for now just ignore that case
|
||||||
if (weightsystem_none((void *)&d->weightsystem[1])) {
|
if (weightsystem_none(&d->weightsystem[1])) {
|
||||||
if (myDive->sumWeight() != weight) {
|
if (myDive->sumWeight() != weight) {
|
||||||
diveChanged = true;
|
diveChanged = true;
|
||||||
d->weightsystem[0].weight.grams = parseWeightToGrams(weight);
|
d->weightsystem[0].weight.grams = parseWeightToGrams(weight);
|
||||||
|
|
Loading…
Reference in a new issue