mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: add constructor/destructor pairs to dive and divecomputer
This allows us to use non-C member variables. Convert a number of pointers to unique_ptr<>s. Code in uemis-downloader.cpp had to be refactored, because it mixed owning and non-owning pointers. Mad. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
bfb54aa581
commit
cc39f709ce
35 changed files with 289 additions and 308 deletions
|
@ -61,7 +61,7 @@ static int shearwater_changes(void *param, int columns, char **data, char **)
|
|||
int index;
|
||||
bool found = false;
|
||||
for (index = 0; index < state->cur_dive->cylinders.nr; ++index) {
|
||||
const cylinder_t *cyl = get_cylinder(state->cur_dive, index);
|
||||
const cylinder_t *cyl = get_cylinder(state->cur_dive.get(), index);
|
||||
if (cyl->gasmix.o2.permille == o2 && cyl->gasmix.he.permille == he) {
|
||||
found = true;
|
||||
break;
|
||||
|
@ -75,7 +75,7 @@ static int shearwater_changes(void *param, int columns, char **data, char **)
|
|||
cylinder_end(state);
|
||||
}
|
||||
|
||||
add_gas_switch_event(state->cur_dive, get_dc(state), state->sample_rate ? atoi(data[0]) / state->sample_rate * 10 : atoi(data[0]), index);
|
||||
add_gas_switch_event(state->cur_dive.get(), get_dc(state), state->sample_rate ? atoi(data[0]) / state->sample_rate * 10 : atoi(data[0]), index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ static int shearwater_dive(void *param, int, char **data, char **)
|
|||
long int dive_id = atol(data[11]);
|
||||
|
||||
if (data[2])
|
||||
add_dive_site(data[2], state->cur_dive, state);
|
||||
add_dive_site(data[2], state->cur_dive.get(), state);
|
||||
if (data[3])
|
||||
utf8_string(data[3], &state->cur_dive->buddy);
|
||||
if (data[4])
|
||||
|
@ -369,7 +369,7 @@ static int shearwater_cloud_dive(void *param, int, char **data, char **)
|
|||
state->sample_rate = 0;
|
||||
|
||||
if (data[2])
|
||||
add_dive_site(data[2], state->cur_dive, state);
|
||||
add_dive_site(data[2], state->cur_dive.get(), state);
|
||||
if (data[3])
|
||||
utf8_string(data[3], &state->cur_dive->buddy);
|
||||
if (data[4])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue