From 0233239198ee89559aeb5e2d8ee5194a05b18911 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 28 Dec 2012 18:21:34 -0800 Subject: 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 --- uemis-downloader.c | 8 ++++++-- 1 file 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); -- cgit v1.2.3-70-g09d2