summaryrefslogtreecommitdiffstats
path: root/load-git.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 12:28:54 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 12:31:10 -0800
commit0ce215e0d90e8d7612917b75f73bb703b9ada9ae (patch)
treea6c844f8a635080cc972993df3a4a8c56a19e1f1 /load-git.c
parenta6336d13b302d071bc94cc15b4a865f0ba2492f7 (diff)
downloadsubsurface-0ce215e0d90e8d7612917b75f73bb703b9ada9ae.tar.gz
Fix dive site creation from v2 git storage
Clearly didn't test that part well enough. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'load-git.c')
-rw-r--r--load-git.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/load-git.c b/load-git.c
index 7bd020bd5..4fcf1f600 100644
--- a/load-git.c
+++ b/load-git.c
@@ -23,13 +23,6 @@ struct keyword_action {
#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
extern degrees_t parse_degrees(char *buf, char **end);
-static void parse_dive_gps(char *line, struct membuffer *str, void *_dive)
-{
- struct dive *dive = _dive;
-
- dive->latitude = parse_degrees(line, &line);
- dive->longitude = parse_degrees(line, &line);
-}
static char *get_utf8(struct membuffer *b)
{
@@ -145,8 +138,22 @@ static int get_index(const char *line)
static int get_hex(const char *line)
{ return strtoul(line, NULL, 16); }
+static void parse_dive_gps(char *line, struct membuffer *str, void *_dive)
+{
+ struct dive *dive = _dive;
+ struct dive_site *ds = get_or_create_dive_site_by_uuid(dive->dive_site_uuid);
+ dive->dive_site_uuid = ds->uuid;
+ ds->latitude = parse_degrees(line, &line);
+ ds->longitude = parse_degrees(line, &line);
+}
+
static void parse_dive_location(char *line, struct membuffer *str, void *_dive)
-{ struct dive *dive = _dive; dive->location = get_utf8(str); }
+{
+ struct dive *dive = _dive;
+ struct dive_site *ds = get_or_create_dive_site_by_uuid(dive->dive_site_uuid);
+ dive->dive_site_uuid = ds->uuid;
+ ds->name = get_utf8(str);
+}
static void parse_dive_divemaster(char *line, struct membuffer *str, void *_dive)
{ struct dive *dive = _dive; dive->divemaster = get_utf8(str); }