controlapi.cpp: Fix format warnings and update types in CControlAPI::EpgCGI

- Changed long to time_t for event times.
- Used PRIu64, PRIdMAX, and %lld for formatting and parsing time_t
 and event IDs.
- Updated sscanf and printf calls to handle time_t and uint64_t correctly.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 87d90833cc
Author: Thilo Graf <dbt@novatux.de>
Date: 2024-09-02 (Mon, 02 Sep 2024)

Origin message was:
------------------
controlapi.cpp: Fix format warnings and update types in CControlAPI::EpgCGI

- Changed long to time_t for event times.
- Used PRIu64, PRIdMAX, and %lld for formatting and parsing time_t
 and event IDs.
- Updated sscanf and printf calls to handle time_t and uint64_t correctly.


------------------
This commit was generated by Migit
This commit is contained in:
2024-09-02 21:06:01 +02:00
committed by vanhofen
parent b94589b497
commit 334ef62c67

View File

@@ -2137,16 +2137,14 @@ void CControlAPI::EpgCGI(CyhookHandler *hh)
int mode = NeutrinoAPI->Zapit->getMode();
CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin();
for (; !(cit.EndOfChannels()); cit++) {
CZapitChannel * channel = *cit;
CZapitChannel *channel = *cit;
NeutrinoAPI->GetChannelEvent(channel->getChannelID(), event);
if (event.eventID) {
if (!isExt) {
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %llu %s\n", channel->getChannelID(), event.eventID, event.description.c_str());
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %" PRIu64 " %s\n", channel->getChannelID(), event.eventID, event.description.c_str());
}
else { // ext output
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS
" %ld %u %llu %s\n", channel->getChannelID(), event.startTime, event.duration, event.eventID, event.description.c_str());
hh->printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %" PRIdMAX " %u %" PRIu64 " %s\n", channel->getChannelID(), static_cast<intmax_t>(event.startTime), event.duration, event.eventID, event.description.c_str());
}
}
}
@@ -2172,7 +2170,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh)
uint64_t epgid = 0;
time_t starttime = 0;
sscanf(hh->ParamList["fskid"].c_str(), "%" SCNu64 "", &epgid);
sscanf(hh->ParamList["starttime"].c_str(), "%lld", &starttime);
sscanf(hh->ParamList["starttime"].c_str(), "%lld", reinterpret_cast<long long*>(&starttime));
CEPGData longepg;
if (CEitManager::getInstance()->getEPGid(epgid, starttime, &longepg)) {
hh->printf("%u\n", longepg.fsk);
@@ -2191,7 +2189,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh)
for (eventIterator = eList.begin(); eventIterator != eList.end(); ++eventIterator) {
CShortEPGData epg;
if (CEitManager::getInstance()->getEPGidShort(eventIterator->eventID, &epg)) {
hh->printf("%llu %ld %d\n", eventIterator->eventID, eventIterator->startTime, eventIterator->duration);
hh->printf("%" PRIu64 " %" PRIdMAX " %d\n", eventIterator->eventID, static_cast<intmax_t>(eventIterator->startTime), eventIterator->duration);
hh->printf("%s\n", epg.title.c_str());
hh->printf("%s\n", epg.info1.c_str());
hh->printf("%s\n\n", epg.info2.c_str());