diff options
author | 2015-02-13 23:52:41 -0800 | |
---|---|---|
committer | 2015-02-13 23:52:41 -0800 | |
commit | 56de6b73f67d5ddeec74153303a27866e39279c7 (patch) | |
tree | 45040e1fb23c26e12b3002e9381f13717a9eb78d /liquivision.c | |
parent | 2843dc38c9e64e87ac1ee84e2cb0147f630ab117 (diff) | |
parent | f81e2c111d9c563a78e62c3bae64bec07c052ec0 (diff) | |
download | subsurface-56de6b73f67d5ddeec74153303a27866e39279c7.tar.gz |
Merge branch 'divesites'
This brings in the dive site infrastructure and initial UI work
Diffstat (limited to 'liquivision.c')
-rw-r--r-- | liquivision.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/liquivision.c b/liquivision.c index a42c35aab..7126c9b79 100644 --- a/liquivision.c +++ b/liquivision.c @@ -121,21 +121,24 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int // Dive location, assemble Location and Place unsigned int len, place_len; + char *location; len = array_uint32_le(buf + ptr); ptr += 4; place_len = array_uint32_le(buf + ptr + len); if (len && place_len) { - dive->location = malloc(len + place_len + 4); - memset(dive->location, 0, len + place_len + 4); - memcpy(dive->location, buf + ptr, len); - memcpy(dive->location + len, ", ", 2); - memcpy(dive->location + len + 2, buf + ptr + len + 4, place_len); + location = malloc(len + place_len + 4); + memset(location, 0, len + place_len + 4); + memcpy(location, buf + ptr, len); + memcpy(location + len, ", ", 2); + memcpy(location + len + 2, buf + ptr + len + 4, place_len); } else if (len) { - dive->location = strndup(buf + ptr, len); + location = strndup(buf + ptr, len); } else if (place_len) { - dive->location = strndup(buf + ptr + len + 4, place_len); + location = strndup(buf + ptr + len + 4, place_len); } + dive->dive_site_uuid = create_dive_site(location); + free(location); ptr += len + 4 + place_len; |