diff options
author | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
---|---|---|
committer | Johann Friedrichs <johann.friedrichs@web.de> | 2018-03-21 12:14:55 +0100 |
commit | e8a0e569152c50d6084f252d12854b8fd4e74466 (patch) | |
tree | 5a90ef7ea08ff2096df157ca109c5268cdc04903 /menu_deftimercheckmethod.c | |
parent | 9c7d95ff8d6ba965cb23147507a859b1fd0491d6 (diff) | |
download | vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.gz vdr-plugin-epgsearch-e8a0e569152c50d6084f252d12854b8fd4e74466.tar.bz2 |
unified indentation
Diffstat (limited to 'menu_deftimercheckmethod.c')
-rw-r--r-- | menu_deftimercheckmethod.c | 114 |
1 files changed, 56 insertions, 58 deletions
diff --git a/menu_deftimercheckmethod.c b/menu_deftimercheckmethod.c index ce37dd5..4156e75 100644 --- a/menu_deftimercheckmethod.c +++ b/menu_deftimercheckmethod.c @@ -48,32 +48,33 @@ bool cDefTimerCheckMode::Parse(const char *s) pos_next = pos + strlen(pos); if (*pos_next == '\n') *pos_next = 0; while (*pos) { - while (*pos == ' ') pos++; - if (*pos) { - if (*pos != '|') { - pos_next = strchr(pos, '|'); - if (!pos_next) - pos_next = pos + strlen(pos); - valuelen = pos_next - pos + 1; - if (valuelen > MAXVALUELEN) - { - LogFile.eSysLog("entry '%s' is too long. Will be truncated!", pos); - valuelen = MAXVALUELEN; - } - strn0cpy(value, pos, valuelen); - pos = pos_next; - switch (parameter) { - case 1: channelID = tChannelID::FromString(value); - break; - case 2: mode = atol(value); - break; - default: - break; - } //switch - } - parameter++; - } - if (*pos) pos++; + while (*pos == ' ') pos++; + if (*pos) { + if (*pos != '|') { + pos_next = strchr(pos, '|'); + if (!pos_next) + pos_next = pos + strlen(pos); + valuelen = pos_next - pos + 1; + if (valuelen > MAXVALUELEN) { + LogFile.eSysLog("entry '%s' is too long. Will be truncated!", pos); + valuelen = MAXVALUELEN; + } + strn0cpy(value, pos, valuelen); + pos = pos_next; + switch (parameter) { + case 1: + channelID = tChannelID::FromString(value); + break; + case 2: + mode = atol(value); + break; + default: + break; + } //switch + } + parameter++; + } + if (*pos) pos++; } //while free(line); @@ -82,8 +83,8 @@ bool cDefTimerCheckMode::Parse(const char *s) cString cDefTimerCheckMode::ToText(void) const { - cString buffer = cString::sprintf("%s|%d", *channelID.ToString(), mode); - return buffer; + cString buffer = cString::sprintf("%s|%d", *channelID.ToString(), mode); + return buffer; } bool cDefTimerCheckMode::Save(FILE *f) @@ -97,8 +98,8 @@ int cDefTimerCheckModes::GetMode(const cChannel* channel) if (!channel) return 0; tChannelID ChannelID = channel->GetChannelID(); for (cDefTimerCheckMode *defMode = First(); defMode; defMode = Next(defMode)) - if (defMode->channelID == ChannelID) - return defMode->mode; + if (defMode->channelID == ChannelID) + return defMode->mode; return 0; } @@ -107,20 +108,19 @@ void cDefTimerCheckModes::SetMode(const cChannel* channel, int mode) if (!channel) return; tChannelID ChannelID = channel->GetChannelID(); for (cDefTimerCheckMode *defMode = First(); defMode; defMode = Next(defMode)) - if (defMode->channelID == ChannelID) - { - defMode->mode = mode; - return; - } + if (defMode->channelID == ChannelID) { + defMode->mode = mode; + return; + } Add(new cDefTimerCheckMode(ChannelID, mode)); } // --- cMenuDefTimerCheckMethod --------------------------------------------------------- cMenuDefTimerCheckMethod::cMenuDefTimerCheckMethod() -:cOsdMenu(tr("Default timer check method"), 20) + : cOsdMenu(tr("Default timer check method"), 20) { - SetMenuCategory(mcSetupPlugins); + SetMenuCategory(mcSetupPlugins); CheckModes[0] = tr("no check"); CheckModes[UPD_CHDUR] = tr("by channel and time"); CheckModes[UPD_EVENTID] = tr("by event ID"); @@ -142,14 +142,12 @@ void cMenuDefTimerCheckMethod::Set() delete modes; LOCK_CHANNELS_READ; modes = new int[Channels->Count()]; - int i=0; - for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++) - { - if (!channel->GroupSep() && *channel->Name()) - { - modes[i] = DefTimerCheckModes.GetMode(channel); - Add(new cMenuEditStraItem(channel->Name(), &modes[i], 3, CheckModes)); - } + int i = 0; + for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++) { + if (!channel->GroupSep() && *channel->Name()) { + modes[i] = DefTimerCheckModes.GetMode(channel); + Add(new cMenuEditStraItem(channel->Name(), &modes[i], 3, CheckModes)); + } } SetCurrent(Get(current)); } @@ -159,19 +157,19 @@ eOSState cMenuDefTimerCheckMethod::ProcessKey(eKeys Key) eOSState state = cOsdMenu::ProcessKey(Key); if (state == osUnknown) { - switch (Key) { - case kOk: - { - int i=0; - LOCK_CHANNELS_READ; - for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++) - if (!channel->GroupSep() && *channel->Name()) - DefTimerCheckModes.SetMode(channel, modes[i]); - DefTimerCheckModes.Save(); - return osBack; - } - default: break; - } + switch (Key) { + case kOk: { + int i = 0; + LOCK_CHANNELS_READ; + for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++) + if (!channel->GroupSep() && *channel->Name()) + DefTimerCheckModes.SetMode(channel, modes[i]); + DefTimerCheckModes.Save(); + return osBack; + } + default: + break; + } } return state; } |