mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
36658d87f3
commit
20b348579b
1 changed files with 4 additions and 4 deletions
|
@ -396,7 +396,7 @@ static void smtk_build_location(MdbHandle *mdb, char *idx, timestamp_t when, uin
|
||||||
free(str);
|
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;
|
MdbTableDef *table;
|
||||||
MdbColumn *col[MDB_MAX_COLS];
|
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++)
|
for (i = 1; i <= atoi(idx); i++)
|
||||||
mdb_fetch_row(table);
|
mdb_fetch_row(table);
|
||||||
dive->cylinder[tanknum].type.description = copy_string(col[1]->bind_ptr);
|
tank->type.description = copy_string(col[1]->bind_ptr);
|
||||||
dive->cylinder[tanknum].type.size.mliter = strtod(col[2]->bind_ptr, NULL) * 1000;
|
tank->type.size.mliter = lrint(strtod(col[2]->bind_ptr, NULL) * 1000);
|
||||||
dive->cylinder[tanknum].type.workingpressure.mbar = strtod(col[4]->bind_ptr, NULL) * 1000;
|
tank->type.workingpressure.mbar = lrint(strtod(col[4]->bind_ptr, NULL) * 1000);
|
||||||
|
|
||||||
smtk_free(bound_values, table->num_cols);
|
smtk_free(bound_values, table->num_cols);
|
||||||
mdb_free_tabledef(table);
|
mdb_free_tabledef(table);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue