summaryrefslogtreecommitdiffstats
path: root/core/divesite.h
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2017-02-19 14:11:37 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-19 15:23:46 -0800
commit4a550e4d7d5ec11640bb511d28097fa7644cdd3b (patch)
treef89ca8ee5c890a1d185a1f2c8aea8b3e1a0227b6 /core/divesite.h
parentfc55620d2d2942f7f8d95b5e73f8b58ec17ffdb9 (diff)
downloadsubsurface-4a550e4d7d5ec11640bb511d28097fa7644cdd3b.tar.gz
Properly handle dive sites loaded from XML
We used to always create a new dive site structure when loading dive site data from XML. That is completely bogus, because it can (and does) create duplicate dive sites with the same UUID. Which makes the whole UUID pointless. So instead, look up the existing dive site associated with the UUID loaded from the XML, and try to merge the data properly if we already had dive site information for that UUID. Reported-by: Alessandro Volpi <volpial@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/divesite.h')
-rw-r--r--core/divesite.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/divesite.h b/core/divesite.h
index f18b2e8e8..0c38f3556 100644
--- a/core/divesite.h
+++ b/core/divesite.h
@@ -64,6 +64,7 @@ uint32_t get_dive_site_uuid_by_gps_and_name(char *name, degrees_t latitude, degr
uint32_t get_dive_site_uuid_by_gps_proximity(degrees_t latitude, degrees_t longitude, int distance, struct dive_site **dsp);
bool dive_site_is_empty(struct dive_site *ds);
void copy_dive_site(struct dive_site *orig, struct dive_site *copy);
+void merge_dive_site(struct dive_site *a, struct dive_site *b);
void clear_dive_site(struct dive_site *ds);
unsigned int get_distance(degrees_t lat1, degrees_t lon1, degrees_t lat2, degrees_t lon2);
uint32_t find_or_create_dive_site_with_name(const char *name, timestamp_t divetime);