mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
followscreenings.cpp: Fix format issues for time_t portability
- Added <inttypes.h> 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: 91902a70d5
Author: Thilo Graf <dbt@novatux.de>
Date: 2024-09-02 (Mon, 02 Sep 2024)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -50,6 +50,8 @@
|
|||||||
#include <global.h>
|
#include <global.h>
|
||||||
#include <neutrino.h>
|
#include <neutrino.h>
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
CFollowScreenings::~CFollowScreenings()
|
CFollowScreenings::~CFollowScreenings()
|
||||||
{
|
{
|
||||||
followlist.clear();
|
followlist.clear();
|
||||||
@@ -78,12 +80,12 @@ CChannelEventList *CFollowScreenings::getFollowScreenings(void)
|
|||||||
|
|
||||||
int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
|
int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionKey)
|
||||||
{
|
{
|
||||||
unsigned long a;
|
uintmax_t a;
|
||||||
if (1 == sscanf(actionKey.c_str(), "%lu", &a)) {
|
if (1 == sscanf(actionKey.c_str(), "%" SCNuMAX, &a)) {
|
||||||
int ix = 0;
|
int ix = 0;
|
||||||
CChannelEventList::iterator e;
|
CChannelEventList::iterator e;
|
||||||
for (e = followlist.begin(); e != followlist.end(); e++, ix++)
|
for (e = followlist.begin(); e != followlist.end(); e++, ix++)
|
||||||
if ((time_t)a == e->startTime) {
|
if (static_cast<time_t>(a) == e->startTime) {
|
||||||
time_t start = e->startTime - (ANNOUNCETIME + 120);
|
time_t start = e->startTime - (ANNOUNCETIME + 120);
|
||||||
time_t stop = e->startTime + e->duration;
|
time_t stop = e->startTime + e->duration;
|
||||||
CTimerd::TimerList overlappingTimers = Timer.getOverlappingTimers(start, stop);
|
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);
|
CZapitChannel * ch = CServiceManager::getInstance()->FindChannel(channel_id);
|
||||||
|
|
||||||
if (g_Timerd->addRecordTimerEvent(channel_id, e->startTime, e->startTime + e->duration, e->eventID,
|
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 ...
|
//FIXME -- no error handling, but this shouldn't happen ...
|
||||||
} else {
|
} else {
|
||||||
if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS)) //NI
|
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
|
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<uintmax_t>(followlist.front().startTime));
|
||||||
exec(NULL, actionstr);
|
exec(NULL, actionstr);
|
||||||
}
|
}
|
||||||
else if (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS) //NI
|
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 += strftime(" %d.", tmStartZeit);
|
||||||
screening_date += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit));
|
screening_date += g_Locale->getText(CLocaleManager::getMonth(tmStartZeit));
|
||||||
screening_date += strftime(". %H:%M", tmStartZeit );
|
screening_date += strftime(". %H:%M", tmStartZeit );
|
||||||
snprintf(actionstr, sizeof(actionstr), "%lu", e->startTime);
|
snprintf(actionstr, sizeof(actionstr), "%" PRIuMAX, static_cast<uintmax_t>(e->startTime));
|
||||||
forwarders.push_back(new CMenuForwarder(screening_date, true, NULL, this, actionstr, directKey, icon));
|
forwarders.push_back(new CMenuForwarder(screening_date, true, NULL, this, actionstr, directKey, icon));
|
||||||
updateRightIcon(i, e->startTime, e->duration);
|
updateRightIcon(i, e->startTime, e->duration);
|
||||||
m.addItem(forwarders[i]);
|
m.addItem(forwarders[i]);
|
||||||
|
Reference in New Issue
Block a user