summaryrefslogtreecommitdiffstats
path: root/core/uemis-downloader.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-03 22:03:39 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-06 19:47:06 -0700
commit90b019bc8d5e7ce6ed0de2851312ef368cdc7a12 (patch)
treeb469ce0c5608f48f609e220ce6abedde3def3d01 /core/uemis-downloader.c
parent6dc1dcaea52e383803a620369567684f553ede80 (diff)
downloadsubsurface-90b019bc8d5e7ce6ed0de2851312ef368cdc7a12.tar.gz
Core: remove dive->downloaded flag
This flag had two distinct uses: - signal that dives were downloaded, not imported - use to mark imported dives Both are not used anymore, therefore remove the flag. The uemis downloaded misused the flag to mark deleted dives. Instead misuse the "hidden_by_filter" flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/uemis-downloader.c')
-rw-r--r--core/uemis-downloader.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index 129a48373..18d8c280e 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -197,7 +197,6 @@ static void uemis_get_weight(char *buffer, weightsystem_t *weight, int diveid)
static struct dive *uemis_start_dive(uint32_t deviceid)
{
struct dive *dive = alloc_dive();
- dive->downloaded = true;
dive->dc.model = strdup("Uemis Zurich");
dive->dc.deviceid = deviceid;
return dive;
@@ -1147,12 +1146,12 @@ static int get_memory(struct dive_table *td, int checkpoint)
return UEMIS_MEM_OK;
}
-/* mark a dive as deleted by setting download to false
- * this will be picked up by some cleaning statement later */
+/* we misuse the hidden_by_filter flag to mark a dive as deleted.
+ * this will be picked up by some cleaning statement later. */
static void do_delete_dives(struct dive_table *td, int idx)
{
for (int x = idx; x < td->nr; x++)
- td->dives[x]->downloaded = false;
+ td->dives[x]->hidden_by_filter = true;
}
static bool load_uemis_divespot(const char *mountpath, int divespot_id)
@@ -1265,7 +1264,7 @@ static bool get_matching_dive(int idx, char *newmax, int *uemis_mem_status, devi
#endif
deleted_files++;
/* mark this log entry as deleted and cleanup later, otherwise we mess up our array */
- dive->downloaded = false;
+ dive->hidden_by_filter = true;
#if UEMIS_DEBUG & 2
fprintf(debugfile, "Deleted dive from %s, with id %d from table -- newmax is %s\n", d_time, dive->dc.diveid, newmax);
#endif
@@ -1471,7 +1470,7 @@ const char *do_uemis_import(device_data_t *data)
* to see if we have to clean some dead bodies from our download table */
next_table_index = 0;
while (next_table_index < data->download_table->nr) {
- if (!data->download_table->dives[next_table_index]->downloaded)
+ if (data->download_table->dives[next_table_index]->hidden_by_filter)
uemis_delete_dive(data, data->download_table->dives[next_table_index]->dc.diveid);
else
next_table_index++;