summaryrefslogtreecommitdiffstats
path: root/core/liquivision.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-03 18:39:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit31291b1c56bf418732cf6ef52550aada492eff9b (patch)
tree4ff9e70839ced99fab1d13b7a38d43ece8171f4f /core/liquivision.c
parentac1602f5125caae322e3e819a7c622b0be9feca1 (diff)
downloadsubsurface-31291b1c56bf418732cf6ef52550aada492eff9b.tar.gz
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>
Diffstat (limited to 'core/liquivision.c')
-rw-r--r--core/liquivision.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/core/liquivision.c b/core/liquivision.c
index 019f7613c..bfe970e15 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -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;