summaryrefslogtreecommitdiffstats
path: root/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-28 18:21:34 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-28 18:23:19 -0800
commit0233239198ee89559aeb5e2d8ee5194a05b18911 (patch)
tree3c28c4213ad6a86a575e4753b99b73daabae660e /uemis-downloader.c
parent020154215dd4de641a18c311f2844aea91bf2e88 (diff)
downloadsubsurface-0233239198ee89559aeb5e2d8ee5194a05b18911.tar.gz
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>
Diffstat (limited to 'uemis-downloader.c')
-rw-r--r--uemis-downloader.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/uemis-downloader.c b/uemis-downloader.c
index ec146afee..90f3d2317 100644
--- a/uemis-downloader.c
+++ b/uemis-downloader.c
@@ -730,8 +730,12 @@ static char *get_divenr(char *deviceidstr)
deviceid = atoi(deviceidstr);
for (i = 0; i < dive_table.nr; i++) {
struct divecomputer *dc = &dive_table.dives[i]->dc;
- if (dc->deviceid == deviceid && dc->diveid > maxdiveid)
- maxdiveid = dc->diveid;
+ while (dc) {
+ if (!strcmp(dc->model, "Uemis Zurich") &&
+ dc->deviceid == deviceid && dc->diveid > maxdiveid)
+ maxdiveid = dc->diveid;
+ dc = dc->next;
+ }
}
snprintf(divenr, 10, "%d", maxdiveid);
return strdup(divenr);