mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive site: set UUID only on save or load
Since the UUID will be overwritten on save and is only used on save and load, set it only on save or load. For other created dive sites, leave the UUID field uninitialized. This means that the UUID will change between saves. Let's see how the git saver handles that. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
ac1602f512
commit
31291b1c56
16 changed files with 40 additions and 65 deletions
|
@ -143,7 +143,6 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
|
||||
while (ptr < buf_size) {
|
||||
int i;
|
||||
bool found_divesite = false;
|
||||
dive = alloc_dive();
|
||||
memset(&sensor_ids, 0, sizeof(sensor_ids));
|
||||
dc = &dive->dc;
|
||||
|
@ -191,8 +190,10 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
}
|
||||
|
||||
/* Store the location only if we have one */
|
||||
if (len || place_len)
|
||||
found_divesite = true;
|
||||
if (len || place_len) {
|
||||
dive->dive_site = find_or_create_dive_site_with_name(location, sites);
|
||||
free(location);
|
||||
}
|
||||
|
||||
ptr += len + 4 + place_len;
|
||||
|
||||
|
@ -224,12 +225,6 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
|
|||
dive->when = array_uint32_le(buf + ptr);
|
||||
ptr += 4;
|
||||
|
||||
// now that we have the dive time we can store the divesite
|
||||
// (we need the dive time to create deterministic uuids)
|
||||
if (found_divesite) {
|
||||
dive->dive_site = find_or_create_dive_site_with_name(location, dive->when, sites);
|
||||
free(location);
|
||||
}
|
||||
//unsigned int end_time = array_uint32_le(buf + ptr);
|
||||
ptr += 4;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue