Cleanup: Fix Problems Raised by Coverity Scan.

Opportunistically fix some problems newly raised by a recent Coverity
scan.

Not touching any of the string memory allocation issues as this is being
handled by the move towards C++ strings.

Signed-off-by: Michael Keller <mikeller@042.ch>
This commit is contained in:
Michael Keller 2024-03-13 13:11:34 +13:00 committed by Michael Keller
parent 3229d1e3a1
commit e6ff3f7537
3 changed files with 11 additions and 10 deletions

View file

@ -711,9 +711,9 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
dc->duration.seconds = (log[CMD_BT] + log[CMD_BT + 1] * 256) * 60;
dc->surfacetime.seconds = (log[CMD_SIT] + log[CMD_SIT + 1] * 256) * 60;
dc->maxdepth.mm = lrint((log[CMD_MAX_DEPTH] +
log[CMD_MAX_DEPTH + 1] * 256) / 4 * FEET * 1000);
log[CMD_MAX_DEPTH + 1] * 256) / 4.0 * FEET * 1000);
dc->meandepth.mm = lrint((log[CMD_AVG_DEPTH] +
log[CMD_AVG_DEPTH + 1] * 256) / 4 * FEET * 1000);
log[CMD_AVG_DEPTH + 1] * 256) / 4.0 * FEET * 1000);
dc->watertemp.mkelvin = F_to_mkelvin(log[CMD_MIN_TEMP]);
dc->surface_pressure.mbar = lrint(ATM / BAR * pow(1 - 0.0000225577
* (double) log[CMD_ALTITUDE] * 250 * FEET, 5.25588) * 1000);
@ -757,9 +757,9 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
dc->duration.seconds = (log[EMC_BT] + log[EMC_BT + 1] * 256) * 60;
dc->surfacetime.seconds = (log[EMC_SIT] + log[EMC_SIT + 1] * 256) * 60;
dc->maxdepth.mm = lrint((log[EMC_MAX_DEPTH] +
log[EMC_MAX_DEPTH + 1] * 256) / 4 * FEET * 1000);
log[EMC_MAX_DEPTH + 1] * 256) / 4.0 * FEET * 1000);
dc->meandepth.mm = lrint((log[EMC_AVG_DEPTH] +
log[EMC_AVG_DEPTH + 1] * 256) / 4 * FEET * 1000);
log[EMC_AVG_DEPTH + 1] * 256) / 4.0 * FEET * 1000);
dc->watertemp.mkelvin = F_to_mkelvin(log[EMC_MIN_TEMP]);
dc->surface_pressure.mbar = lrint(ATM / BAR * pow(1 - 0.0000225577
* (double) log[EMC_ALTITUDE] * 250 * FEET, 5.25588) * 1000);