mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
6dc1dcaea5
commit
90b019bc8d
5 changed files with 5 additions and 10 deletions
|
@ -785,7 +785,6 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
|
||||||
dc->duration.seconds = duration;
|
dc->duration.seconds = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
dive->downloaded = true;
|
|
||||||
record_dive_to_table(dive, table);
|
record_dive_to_table(dive, table);
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,6 @@ struct dive {
|
||||||
struct dive *next, **pprev;
|
struct dive *next, **pprev;
|
||||||
bool selected;
|
bool selected;
|
||||||
bool hidden_by_filter;
|
bool hidden_by_filter;
|
||||||
bool downloaded;
|
|
||||||
timestamp_t when;
|
timestamp_t when;
|
||||||
uint32_t dive_site_uuid;
|
uint32_t dive_site_uuid;
|
||||||
char *notes;
|
char *notes;
|
||||||
|
|
|
@ -861,7 +861,6 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
||||||
add_dive_to_trip(dive, devdata->trip);
|
add_dive_to_trip(dive, devdata->trip);
|
||||||
}
|
}
|
||||||
|
|
||||||
dive->downloaded = true;
|
|
||||||
record_dive_to_table(dive, devdata->download_table);
|
record_dive_to_table(dive, devdata->download_table);
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -427,7 +427,6 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
||||||
}
|
}
|
||||||
|
|
||||||
// End dive
|
// End dive
|
||||||
dive->downloaded = true;
|
|
||||||
record_dive_to_table(dive, table);
|
record_dive_to_table(dive, table);
|
||||||
dive = NULL;
|
dive = NULL;
|
||||||
mark_divelist_changed(true);
|
mark_divelist_changed(true);
|
||||||
|
|
|
@ -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)
|
static struct dive *uemis_start_dive(uint32_t deviceid)
|
||||||
{
|
{
|
||||||
struct dive *dive = alloc_dive();
|
struct dive *dive = alloc_dive();
|
||||||
dive->downloaded = true;
|
|
||||||
dive->dc.model = strdup("Uemis Zurich");
|
dive->dc.model = strdup("Uemis Zurich");
|
||||||
dive->dc.deviceid = deviceid;
|
dive->dc.deviceid = deviceid;
|
||||||
return dive;
|
return dive;
|
||||||
|
@ -1147,12 +1146,12 @@ static int get_memory(struct dive_table *td, int checkpoint)
|
||||||
return UEMIS_MEM_OK;
|
return UEMIS_MEM_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mark a dive as deleted by setting download to false
|
/* we misuse the hidden_by_filter flag to mark a dive as deleted.
|
||||||
* this will be picked up by some cleaning statement later */
|
* this will be picked up by some cleaning statement later. */
|
||||||
static void do_delete_dives(struct dive_table *td, int idx)
|
static void do_delete_dives(struct dive_table *td, int idx)
|
||||||
{
|
{
|
||||||
for (int x = idx; x < td->nr; x++)
|
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)
|
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
|
#endif
|
||||||
deleted_files++;
|
deleted_files++;
|
||||||
/* mark this log entry as deleted and cleanup later, otherwise we mess up our array */
|
/* 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
|
#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);
|
fprintf(debugfile, "Deleted dive from %s, with id %d from table -- newmax is %s\n", d_time, dive->dc.diveid, newmax);
|
||||||
#endif
|
#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 */
|
* to see if we have to clean some dead bodies from our download table */
|
||||||
next_table_index = 0;
|
next_table_index = 0;
|
||||||
while (next_table_index < data->download_table->nr) {
|
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);
|
uemis_delete_dive(data, data->download_table->dives[next_table_index]->dc.diveid);
|
||||||
else
|
else
|
||||||
next_table_index++;
|
next_table_index++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue