Eliminate a compiler warning in searchtimer.c

This commit is contained in:
kamel5 2019-04-06 19:07:43 +02:00
parent c7f0131d52
commit ae206f4768

View File

@ -210,31 +210,31 @@ bool cTVGuideSearchTimer::Parse(bool readTemplate) {
return false; return false;
for (int value = 0; value < numValues; value++) { for (int value = 0; value < numValues; value++) {
switch (value) { switch (value) {
case 0: case 0:
if (!readTemplate) if (!readTemplate)
ID = atoi(values[value].c_str()); ID = atoi(values[value].c_str());
break; break;
case 1: case 1:
if (!readTemplate) { if (!readTemplate) {
std::string searchStringMasked = values[value]; std::string searchStringMasked = values[value];
std::replace(searchStringMasked.begin(), searchStringMasked.end(), '|', ':'); std::replace(searchStringMasked.begin(), searchStringMasked.end(), '|', ':');
searchString = searchStringMasked; searchString = searchStringMasked;
} }
break; break;
case 2: case 2:
useTime = atoi(values[value].c_str()); useTime = atoi(values[value].c_str());
break; break;
case 3: case 3:
if (useTime) { if (useTime) {
startTime = atoi(values[value].c_str()); startTime = atoi(values[value].c_str());
} }
break; break;
case 4: case 4:
if (useTime) { if (useTime) {
stopTime = atoi(values[value].c_str()); stopTime = atoi(values[value].c_str());
} }
break; break;
case 5: case 5:
useChannel = atoi(values[value].c_str()); useChannel = atoi(values[value].c_str());
break; break;
case 6: case 6:
@ -242,39 +242,44 @@ bool cTVGuideSearchTimer::Parse(bool readTemplate) {
channelMin = NULL; channelMin = NULL;
channelMax = NULL; channelMax = NULL;
} else if (useChannel == 1) { } else if (useChannel == 1) {
char *channelMinbuffer = NULL; int minNum = 0, maxNum = 0;
char *channelMaxbuffer = NULL; int fields = sscanf(values[value].c_str(), "%d-%d", &minNum, &maxNum);
int channels = sscanf(values[value].c_str(), "%a[^|]|%a[^|]", &channelMinbuffer, &channelMaxbuffer); if (fields == 0) { // stored with ID
char *channelMinbuffer = NULL;
char *channelMaxbuffer = NULL;
int channels = sscanf(values[value].c_str(), "%m[^|]|%m[^|]", &channelMinbuffer, &channelMaxbuffer);
#if VDRVERSNUM >= 20301 #if VDRVERSNUM >= 20301
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
channelMin = Channels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); channelMin = Channels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
#else #else
channelMin = Channels.GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true); channelMin = Channels.GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
#endif #endif
if (!channelMin) { if (!channelMin) {
channelMin = channelMax = NULL; esyslog("ERROR: channel '%s' not defined", channelMinbuffer);
useChannel = 0;
}
if (channels == 1)
channelMax = channelMin;
else {
#if VDRVERSNUM >= 20301
channelMax = Channels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
#else
channelMax = Channels.GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
#endif
if (!channelMax) {
channelMin = channelMax = NULL; channelMin = channelMax = NULL;
useChannel = 0; useChannel = 0;
} }
if (channels == 1)
channelMax = channelMin;
else {
#if VDRVERSNUM >= 20301
channelMax = Channels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
#else
channelMax = Channels.GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
#endif
if (!channelMax) {
esyslog("ERROR: channel '%s' not defined", channelMaxbuffer);
channelMin = channelMax = NULL;
useChannel = 0;
}
}
free(channelMinbuffer);
free(channelMaxbuffer);
} }
free(channelMinbuffer); } else if (useChannel == 2)
free(channelMaxbuffer); channelGroup = values[value];
} else if (useChannel == 2) {
channelGroup = values[value];
}
break; break;
case 7: case 7:
useCase = atoi(values[value].c_str()); useCase = atoi(values[value].c_str());
break; break;
case 8: case 8: