From d2f3d67c940656c0772b1685bc319171a67d34fb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 23 Jan 2020 21:15:51 +0100 Subject: [PATCH] lcd4l: avoid taking address of packed members Should fix possible compiler warnings with -Waddress-of-packed-member. Comes with newer compilers e.g gcc 9.x Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/af2f80a9e90e5416eeec393881adebe92d3ffff6 Author: Thilo Graf Date: 2020-01-23 (Thu, 23 Jan 2020) ------------------ This commit was generated by Migit --- src/driver/lcd4l.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/driver/lcd4l.cpp b/src/driver/lcd4l.cpp index ec85a216c..f271f3caa 100644 --- a/src/driver/lcd4l.cpp +++ b/src/driver/lcd4l.cpp @@ -856,29 +856,32 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) Info2 = shortEpgData.info2; } - if ((CurrentNext.current_zeit.dauer > 0) && (CurrentNext.current_zeit.dauer < 86400)) + time_t cur_duration = CurrentNext.current_zeit.dauer; + time_t cur_start_time = CurrentNext.current_zeit.startzeit; + if ((cur_duration > 0) && (cur_duration < 86400)) { - Progress = 100 * (time(NULL) - CurrentNext.current_zeit.startzeit) / CurrentNext.current_zeit.dauer; + Progress = 100 * (time(NULL) - cur_start_time) / cur_duration; - int total = CurrentNext.current_zeit.dauer / 60; - int done = (abs(time(NULL) - CurrentNext.current_zeit.startzeit) + 30) / 60; + int total = cur_duration / 60; + int done = (abs(time(NULL) - cur_start_time) + 30) / 60; int todo = total - done; - if ((time(NULL) < CurrentNext.current_zeit.startzeit) && todo >= 0) + if ((time(NULL) < cur_start_time) && todo >= 0) { done = 0; - todo = CurrentNext.current_zeit.dauer / 60; + todo = cur_duration / 60; } snprintf(Duration, sizeof(Duration), "%d/%d", done, total); } - tm_struct = localtime(&CurrentNext.current_zeit.startzeit); + tm_struct = localtime(&cur_start_time); snprintf(Start, sizeof(Start), "%02d:%02d", tm_struct->tm_hour, tm_struct->tm_min); } if (CSectionsdClient::epgflags::has_next) { Event += "\n" + CurrentNext.next_name; - tm_struct = localtime(&CurrentNext.next_zeit.startzeit); + time_t next_start_time = CurrentNext.next_zeit.startzeit; + tm_struct = localtime(&next_start_time); snprintf(End, sizeof(End), "%02d:%02d", tm_struct->tm_hour, tm_struct->tm_min); } }