mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Automatically renumber new dives when they are "obvious".
When importing (or reading xml from files) new dives, we now renumber them based on preexisting dive data, *if* such re-numbering is obvious. NOTE! In order to be "obvious", there can be no overlap between old and new dives: all the new dives have to come at the end. That's what happens with a normal libdivecomputer import, since we cut the import short when we find a preexisting dive. But if any of the new dives overlap the old dives in any way, or already have been numbered separately, the automatic renumbering is not done, and you need to do a manual renumber. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f4820455e2
commit
d6c2236b8a
3 changed files with 65 additions and 3 deletions
|
@ -223,7 +223,7 @@ static int find_dive(struct dive *dive, device_data_t *devdata)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < devdata->preexisting; i++) {
|
||||
for (i = 0; i < dive_table.preexisting; i++) {
|
||||
struct dive *old = dive_table.dives[i];
|
||||
|
||||
if (dive->when != old->when)
|
||||
|
@ -333,7 +333,6 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
|
||||
static device_status_t import_device_data(device_t *device, device_data_t *devicedata)
|
||||
{
|
||||
devicedata->preexisting = dive_table.nr;
|
||||
return device_foreach(device, dive_cb, devicedata);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue