From 252761498a96cbf86eadbb017527d2ec8011d274 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 20 Aug 2022 17:20:18 +0200 Subject: [PATCH] liquivision: use uint32_t for event time This is stored as uint32_t, so no reason to use the larger time_t. It appears to be, after all, relative to the dive start. Coverity was complaining about the down-conversion later in the code. Signed-off-by: Berthold Stoeger --- core/liquivision.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/liquivision.c b/core/liquivision.c index ca0bb111f..ef326f0a2 100644 --- a/core/liquivision.c +++ b/core/liquivision.c @@ -16,7 +16,7 @@ + ((p)[3]<<24)) struct lv_event { - time_t time; + uint32_t time; struct pressure { int sensor; int mbar; @@ -326,7 +326,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int ps_ptr += handle_event_ver2(event_code, ps, ps_ptr, &event); continue; // ignore all events } - int sample_time, last_time; + uint32_t sample_time, last_time; int depth_mm, last_depth, temp_mk, last_temp; while (true) { @@ -376,9 +376,9 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int last_depth = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm last_temp = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK sample->depth.mm = last_depth + (depth_mm - last_depth) - * ((int)event.time - last_time) / sample_interval; + * ((int)event.time - (int)last_time) / sample_interval; sample->temperature.mkelvin = last_temp + (temp_mk - last_temp) - * ((int)event.time - last_time) / sample_interval; + * ((int)event.time - (int)last_time) / sample_interval; } finish_sample(dc);