mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 22:35:27 +00:00
Don't use the result of unsupported libdivecomputer calls
We report a bug if this is not unsupported and not successful. And then use the result. Hello? So if this is not supported, we still use the result? Oops. This has been around for a long time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
d45e870289
commit
037d1ceefa
1 changed files with 38 additions and 31 deletions
|
@ -439,6 +439,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dive->dc.deviceid = devdata->deviceid;
|
||||
dive->dc.diveid = calculate_diveid(fingerprint, fsize);
|
||||
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
tm.tm_year = dt.year;
|
||||
tm.tm_mon = dt.month - 1;
|
||||
tm.tm_mday = dt.day;
|
||||
|
@ -446,7 +447,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
tm.tm_min = dt.minute;
|
||||
tm.tm_sec = dt.second;
|
||||
dive->when = dive->dc.when = utc_mktime(&tm);
|
||||
|
||||
}
|
||||
// Parse the divetime.
|
||||
dev_info(devdata, translate("gettextFromC", "Dive %d: %s"), import_dive_number, get_dive_date_c_string(dive->when));
|
||||
unsigned int divetime = 0;
|
||||
|
@ -455,6 +456,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error parsing the divetime"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
dive->dc.duration.seconds = divetime;
|
||||
|
||||
// Parse the maxdepth.
|
||||
|
@ -464,6 +466,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error parsing the maxdepth"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
dive->dc.maxdepth.mm = rint(maxdepth * 1000);
|
||||
|
||||
#if DC_VERSION_CHECK(0, 5, 0) && defined(DC_GASMIX_UNKNOWN)
|
||||
|
@ -482,6 +485,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error parsing temperature"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
switch(i) {
|
||||
case 0:
|
||||
dive->dc.airtemp.mkelvin = C_to_mkelvin(temperature);
|
||||
|
@ -513,6 +517,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error obtaining water salinity"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
dive->dc.salinity = rint(salinity.density * 10.0);
|
||||
|
||||
double surface_pressure = 0;
|
||||
|
@ -521,6 +526,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error obtaining surface pressure"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
dive->dc.surface_pressure.mbar = rint(surface_pressure * 1000.0);
|
||||
#endif
|
||||
|
||||
|
@ -545,6 +551,7 @@ static int dive_cb(const unsigned char *data, unsigned int size,
|
|||
dev_info(devdata, translate("gettextFromC", "Error obtaining divemode"));
|
||||
goto error_exit;
|
||||
}
|
||||
if (rc == DC_STATUS_SUCCESS)
|
||||
switch(divemode) {
|
||||
case DC_DIVEMODE_FREEDIVE:
|
||||
case DC_DIVEMODE_GAUGE:
|
||||
|
|
Loading…
Add table
Reference in a new issue