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 is contained in:
2024-07-04 16:08:36 +02:00
parent 7308e50b77
commit b911d5f73a

View File

@@ -2128,16 +2128,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());
}
}
}
@@ -2163,7 +2161,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);
@@ -2182,7 +2180,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());