From 650c087d231e4d0f3ceb1c9759377c501048afee Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Sep 2024 21:06:01 +0200 Subject: [PATCH] followscreenings.cpp: Fix format issues for time_t portability - Added for correct format specifiers. - Used PRIuMAX or time_t handling to resolve [-Wformat=] warnings. - Updated sscanf and snprintf calls in exec and show functions. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/91902a70d57d1749b6e9273a8e2fb93623c0a0d1 Author: Thilo Graf Date: 2024-09-02 (Mon, 02 Sep 2024) ------------------ This commit was generated by Migit --- src/gui/followscreenings.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/followscreenings.cpp b/src/gui/followscreenings.cpp index 56d3ea481..e314e5ddd 100644 --- a/src/gui/followscreenings.cpp +++ b/src/gui/followscreenings.cpp @@ -50,6 +50,8 @@ #include #include +#include + CFollowScreenings::~CFollowScreenings() { followlist.clear(); @@ -78,12 +80,12 @@ CChannelEventList *CFollowScreenings::getFollowScreenings(void) int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionKey) { - unsigned long a; - if (1 == sscanf(actionKey.c_str(), "%lu", &a)) { + uintmax_t a; + if (1 == sscanf(actionKey.c_str(), "%" SCNuMAX, &a)) { int ix = 0; CChannelEventList::iterator e; for (e = followlist.begin(); e != followlist.end(); e++, ix++) - if ((time_t)a == e->startTime) { + if (static_cast(a) == e->startTime) { time_t start = e->startTime - (ANNOUNCETIME + 120); time_t stop = e->startTime + e->duration; CTimerd::TimerList overlappingTimers = Timer.getOverlappingTimers(start, stop); @@ -107,7 +109,7 @@ int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionK CZapitChannel * ch = CServiceManager::getInstance()->FindChannel(channel_id); if (g_Timerd->addRecordTimerEvent(channel_id, e->startTime, e->startTime + e->duration, e->eventID, - e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, e->startTime - (ANNOUNCETIME + 120) > time(NULL), recDir, true, ch->bUseCI) == -1) { //NI + e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, e->startTime - (ANNOUNCETIME + 120) > time(NULL), recDir, true, ch->bUseCI) == -1) { //NI //FIXME -- no error handling, but this shouldn't happen ... } else { if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS)) //NI @@ -155,7 +157,7 @@ void CFollowScreenings::show() if (followlist.size() == 1 && g_settings.timer_followscreenings != FOLLOWSCREENINGS_ALWAYS) //NI { - snprintf(actionstr, sizeof(actionstr), "%lu", followlist.front().startTime); + snprintf(actionstr, sizeof(actionstr), "%" PRIuMAX, static_cast(followlist.front().startTime)); exec(NULL, actionstr); } else if (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS) //NI @@ -173,7 +175,7 @@ void CFollowScreenings::show() screening_date += strftime(" %d.", tmStartZeit); screening_date += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit)); screening_date += strftime(". %H:%M", tmStartZeit ); - snprintf(actionstr, sizeof(actionstr), "%lu", e->startTime); + snprintf(actionstr, sizeof(actionstr), "%" PRIuMAX, static_cast(e->startTime)); forwarders.push_back(new CMenuForwarder(screening_date, true, NULL, this, actionstr, directKey, icon)); updateRightIcon(i, e->startTime, e->duration); m.addItem(forwarders[i]);