mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correct the detection of existing dives in the Uemis downloader
This didn't take multiple divecomputers into account and didn't compare the model as well as the deviceid to match a divecomputer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
020154215d
commit
0233239198
1 changed files with 6 additions and 2 deletions
|
@ -730,8 +730,12 @@ static char *get_divenr(char *deviceidstr)
|
||||||
deviceid = atoi(deviceidstr);
|
deviceid = atoi(deviceidstr);
|
||||||
for (i = 0; i < dive_table.nr; i++) {
|
for (i = 0; i < dive_table.nr; i++) {
|
||||||
struct divecomputer *dc = &dive_table.dives[i]->dc;
|
struct divecomputer *dc = &dive_table.dives[i]->dc;
|
||||||
if (dc->deviceid == deviceid && dc->diveid > maxdiveid)
|
while (dc) {
|
||||||
maxdiveid = dc->diveid;
|
if (!strcmp(dc->model, "Uemis Zurich") &&
|
||||||
|
dc->deviceid == deviceid && dc->diveid > maxdiveid)
|
||||||
|
maxdiveid = dc->diveid;
|
||||||
|
dc = dc->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
snprintf(divenr, 10, "%d", maxdiveid);
|
snprintf(divenr, 10, "%d", maxdiveid);
|
||||||
return strdup(divenr);
|
return strdup(divenr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue