[PATCH 1/2] Fix default value for missing surface pressure from divecomputer

Linus Torvalds torvalds at linux-foundation.org
Wed Feb 12 14:31:07 UTC 2014


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Wed, 12 Feb 2014 14:11:21 -0800
Subject: [PATCH 1/2] Fix default value for missing surface pressure from divecomputer

We should *not* default to the incorrect "1 bar".  Instead, we should
leave the resuling pressure at 0 mbar, which leaves visual entries empty
and uses the default surface pressure for calculations.

Reported-by: Pedro Neves <nevesdiver at gmail.com>
Cc: Patrick Valsecchi <patrick at thus.ch>
Cc: Dirk Hohndel <dirk at hohndel.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---
 libdivecomputer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdivecomputer.c b/libdivecomputer.c
index b3cc1d5f7845..f93b2c0fc9bb 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -476,7 +476,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
 	}
 	dive->dc.salinity = salinity.density * 10.0 + 0.5;
 
-	double surface_pressure = 1.0;
+	double surface_pressure = 0;
 	rc = dc_parser_get_field(parser, DC_FIELD_ATMOSPHERIC, 0, &surface_pressure);
 	if (rc != DC_STATUS_SUCCESS && rc != DC_STATUS_UNSUPPORTED) {
 		dev_info(devdata, translate("gettextFromC","Error obtaining surface pressure"));
-- 
1.9.0.rc3




More information about the subsurface mailing list