diff options
author | Salvador Cuñat <salvador.cunat@gmail.com> | 2017-03-16 16:55:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-18 08:33:31 -0700 |
commit | 20b348579bc206231d81f8c5fd256e656c8409e4 (patch) | |
tree | 99a49f4df56b8bbc9ca49e741bddd9dd4b332c7a /smtk-import | |
parent | 36658d87f3d99955ecfcbd8eb6b3d855e8328b34 (diff) | |
download | subsurface-20b348579bc206231d81f8c5fd256e656c8409e4.tar.gz |
smtk-import rework smtk_build_tank_info()
The cylinder info is built one by one. This way, instead of passing dive
and tank number parameters, just passing a pointer to the tank been
worked seems preferable.
It also introduces lrint() in the function to round the doubles values
obtained from libmdb for tank size and workingpressure.
Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com>
Diffstat (limited to 'smtk-import')
-rw-r--r-- | smtk-import/smartrak.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/smtk-import/smartrak.c b/smtk-import/smartrak.c index 2e50baf0a..789955654 100644 --- a/smtk-import/smartrak.c +++ b/smtk-import/smartrak.c @@ -396,7 +396,7 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, uin free(str); } -static void smtk_build_tank_info(MdbHandle *mdb, struct dive *dive, int tanknum, char *idx) +static void smtk_build_tank_info(MdbHandle *mdb, cylinder_t *tank, char *idx) { MdbTableDef *table; MdbColumn *col[MDB_MAX_COLS]; @@ -409,9 +409,9 @@ static void smtk_build_tank_info(MdbHandle *mdb, struct dive *dive, int tanknum, for (i = 1; i <= atoi(idx); i++) mdb_fetch_row(table); - dive->cylinder[tanknum].type.description = copy_string(col[1]->bind_ptr); - dive->cylinder[tanknum].type.size.mliter = strtod(col[2]->bind_ptr, NULL) * 1000; - dive->cylinder[tanknum].type.workingpressure.mbar = strtod(col[4]->bind_ptr, NULL) * 1000; + tank->type.description = copy_string(col[1]->bind_ptr); + tank->type.size.mliter = lrint(strtod(col[2]->bind_ptr, NULL) * 1000); + tank->type.workingpressure.mbar = lrint(strtod(col[4]->bind_ptr, NULL) * 1000); smtk_free(bound_values, table->num_cols); mdb_free_tabledef(table); |