summaryrefslogtreecommitdiffstats
path: root/smtk-import
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-10-26 17:03:54 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-29 00:09:31 +0000
commit724055f0af4fb7cdb9f1570967fe4b34797f3419 (patch)
tree6aab8c34e7d0a6df1d6fe84bc5794e8eb5404b7d /smtk-import
parentacd44467c1100a1a774cc644921b1dc33dca1266 (diff)
downloadsubsurface-724055f0af4fb7cdb9f1570967fe4b34797f3419.tar.gz
Dive site: replace dive->dive_site_uuid by dive_site
Replace the UUID reference of struct dive by a pointer to dive_site. This commit is rather large in lines, but nevertheless quite simple since most of the UUID->pointer work was done in previous commits. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'smtk-import')
-rw-r--r--smtk-import/smartrak.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c
index d97e8b69f..d998ef544 100644
--- a/smtk-import/smartrak.c
+++ b/smtk-import/smartrak.c
@@ -315,7 +315,7 @@ static void smtk_wreck_site(MdbHandle *mdb, char *site_idx, struct dive_site *ds
* Location format:
* | Idx | Text | Province | Country | Depth |
*/
-static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, uint32_t *location)
+static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, struct dive_site **location)
{
MdbTableDef *table;
MdbColumn *col[MDB_MAX_COLS];
@@ -376,13 +376,11 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, uin
ds = get_dive_site_by_name(str);
if (!ds) {
if (!has_location(&loc))
- *location = create_dive_site(str, when)->uuid;
+ ds = create_dive_site(str, when);
else
- *location = create_dive_site_with_gps(str, &loc, when)->uuid;
- ds = get_dive_site_by_uuid(*location);
- } else {
- *location = ds->uuid;
+ ds = create_dive_site_with_gps(str, &loc, when);
}
+ *location = ds;
smtk_free(bound_values, table->num_cols);
/* Insert site notes */
@@ -1065,7 +1063,7 @@ void smartrak_import(const char *file, struct dive_table *divetable)
smtkdive->visibility = strtod(col[coln(VISIBILITY)]->bind_ptr, NULL) > 25 ? 5 : lrint(strtod(col[13]->bind_ptr, NULL) / 5);
smtkdive->weightsystem[0].weight.grams = lrint(strtod(col[coln(WEIGHT)]->bind_ptr, NULL) * 1000);
smtkdive->suit = copy_string(suit_list[atoi(col[coln(SUITIDX)]->bind_ptr) - 1]);
- smtk_build_location(mdb_clon, col[coln(SITEIDX)]->bind_ptr, smtkdive->when, &smtkdive->dive_site_uuid);
+ smtk_build_location(mdb_clon, col[coln(SITEIDX)]->bind_ptr, smtkdive->when, &smtkdive->dive_site);
smtkdive->buddy = smtk_locate_buddy(mdb_clon, col[0]->bind_ptr, buddy_list);
smtk_parse_relations(mdb_clon, smtkdive, col[0]->bind_ptr, "Type", "TypeRelation", type_list, true);
smtk_parse_relations(mdb_clon, smtkdive, col[0]->bind_ptr, "Activity", "ActivityRelation", activity_list, false);