mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Do not set the water salinity of a dive unless libdivecomputer supports it
It's annoying to see water salinity data in the XML that isn't relevant, and adding the default value just because the dive got downloaded from libdivecomputer is definitely wrong. We should set the water salinity explicitly only if we have it explicitly set on the dive computer. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1ca1fe7994
commit
7bfc8de55e
1 changed files with 2 additions and 2 deletions
|
@ -332,17 +332,17 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
return rc;
|
||||
}
|
||||
|
||||
#ifdef DC_FIELD_SALINITY
|
||||
// Check if the libdivecomputer version already supports salinity
|
||||
double salinity = 1.03;
|
||||
#ifdef DC_FIELD_SALINITY
|
||||
rc = dc_parser_get_field(parser, DC_FIELD_SALINITY, 0, &salinity);
|
||||
if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
|
||||
dev_info(devdata, _("Error obtaining water salinity"));
|
||||
dc_parser_destroy(parser);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
dive->salinity = salinity * 10000.0 + 0.5;
|
||||
#endif
|
||||
|
||||
rc = parse_gasmixes(devdata, dive, parser, ngases);
|
||||
if (rc != DC_STATUS_SUCCESS) {
|
||||
|
|
Loading…
Reference in a new issue