diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-08-25 13:57:12 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-25 13:57:12 -0700 |
commit | c22adebebe9792fc0471a5f4c2cab9de6aff1d6e (patch) | |
tree | 25a872afa0650a30c036fbf09aa872babfb5714b /liquivision.c | |
parent | ab255e07ea6060d1a36a5195f6be9cccd3e0ffcc (diff) | |
parent | 72817ff47f8a990aa043603ebe2d3ead1ff811c9 (diff) | |
download | subsurface-c22adebebe9792fc0471a5f4c2cab9de6aff1d6e.tar.gz |
Merge branch 'gitMerge'
Diffstat (limited to 'liquivision.c')
-rw-r--r-- | liquivision.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/liquivision.c b/liquivision.c index add377237..295287c15 100644 --- a/liquivision.c +++ b/liquivision.c @@ -101,6 +101,7 @@ 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(); primary_sensor = 0; dc = &dive->dc; @@ -148,10 +149,8 @@ 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) { - dive->dive_site_uuid = find_or_create_dive_site_with_name(location); - free(location); - } + if (len || place_len) + found_divesite = true; ptr += len + 4 + place_len; @@ -183,6 +182,12 @@ 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_uuid = find_or_create_dive_site_with_name(location, dive->when); + free(location); + } //unsigned int end_time = array_uint32_le(buf + ptr); ptr += 4; |