diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2009-07-04 20:56:41 +0200 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2009-07-04 20:56:41 +0200 |
commit | 5a0aa41728efdce4931cce6b527040459d12518b (patch) | |
tree | cd624eadf027182fa7db371f0000ab8b1167cb4e /epgsearchsvdrp.c | |
parent | 236d130b574d7a2559c448d061c64d034e93a94e (diff) | |
download | vdr-plugin-epgsearch-5a0aa41728efdce4931cce6b527040459d12518b.tar.gz vdr-plugin-epgsearch-5a0aa41728efdce4931cce6b527040459d12518b.tar.bz2 |
fixes for gcc-4.4
Diffstat (limited to 'epgsearchsvdrp.c')
-rw-r--r-- | epgsearchsvdrp.c | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/epgsearchsvdrp.c b/epgsearchsvdrp.c index 9420b46..a06c3fa 100644 --- a/epgsearchsvdrp.c +++ b/epgsearchsvdrp.c @@ -761,45 +761,50 @@ cString cPluginEpgsearch::SVDRPCommand(const char *Command, const char *Option, } else if (strcasecmp(Command, "RENC") == 0) { - if (*Option) - { - char* pipePos = strchr(Option, '|'); + if (*Option) + { + const char* pipePos = strchr(Option, '|'); if (pipePos) - { - *pipePos = 0; - const char* oldName = Option; - const char* newName = pipePos+1; - if (strlen(oldName) > 0 && strlen(newName) > 0) - { - cChannelGroup *changrp = ChannelGroups.GetGroupByName(Option); - if (changrp) - { - strcpy(changrp->name, newName); - cMutexLock SearchExtsLock(&SearchExts); - cSearchExt *SearchExt = SearchExts.First(); - while (SearchExt) - { - if (SearchExt->useChannel == 2 && - SearchExt->channelGroup && - strcmp(SearchExt->channelGroup, oldName) == 0) - { - free(SearchExt->channelGroup); - SearchExt->channelGroup = strdup(newName); - } - SearchExt = SearchExts.Next(SearchExt); - } - ChannelGroups.Save(); - SearchExts.Save(); - return cString::sprintf("renamed channel group '%s' to '%s'", oldName, newName); - - } - else - { - ReplyCode = 901; - return cString::sprintf("channel group '%s' not defined", Option); - } - } - } + { + int index = pipePos - Option; + char* oldName = strdup(Option); + *(oldName + index) = 0; + const char* newName = oldName + index + 1; + if (strlen(oldName) > 0 && strlen(newName) > 0) + { + cChannelGroup *changrp = ChannelGroups.GetGroupByName(oldName); + if (changrp) + { + strcpy(changrp->name, newName); + cMutexLock SearchExtsLock(&SearchExts); + cSearchExt *SearchExt = SearchExts.First(); + while (SearchExt) + { + if (SearchExt->useChannel == 2 && + SearchExt->channelGroup && + strcmp(SearchExt->channelGroup, oldName) == 0) + { + free(SearchExt->channelGroup); + SearchExt->channelGroup = strdup(newName); + } + SearchExt = SearchExts.Next(SearchExt); + } + ChannelGroups.Save(); + SearchExts.Save(); + cString strReturn = cString::sprintf("renamed channel group '%s' to '%s'", oldName, newName); + free(oldName); + return strReturn; + + } + else + { + free(oldName); + ReplyCode = 901; + return cString::sprintf("channel group '%s' not defined", Option); + } + } + free(oldName); + } ReplyCode = 901; return cString("Error in channel group parameters"); } |