mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Made several functions threadsafe (cont'd)
This commit is contained in:
34
svdrp.c
34
svdrp.c
@@ -10,7 +10,7 @@
|
||||
* and interact with the Video Disk Recorder - or write a full featured
|
||||
* graphical interface that sits on top of an SVDRP connection.
|
||||
*
|
||||
* $Id: svdrp.c 1.66 2004/12/19 13:52:34 kls Exp $
|
||||
* $Id: svdrp.c 1.67 2004/12/26 12:23:55 kls Exp $
|
||||
*/
|
||||
|
||||
#include "svdrp.h"
|
||||
@@ -673,7 +673,7 @@ void cSVDRP::CmdLSTC(const char *Option)
|
||||
if (isnumber(Option)) {
|
||||
cChannel *channel = Channels.GetByNumber(strtol(Option, NULL, 10));
|
||||
if (channel)
|
||||
Reply(250, "%d %s", channel->Number(), channel->ToText());
|
||||
Reply(250, "%d %s", channel->Number(), *channel->ToText());
|
||||
else
|
||||
Reply(501, "Channel \"%s\" not defined", Option);
|
||||
}
|
||||
@@ -685,7 +685,7 @@ void cSVDRP::CmdLSTC(const char *Option)
|
||||
if (channel) {
|
||||
if (strcasestr(channel->Name(), Option)) {
|
||||
if (next)
|
||||
Reply(-250, "%d %s", next->Number(), next->ToText());
|
||||
Reply(-250, "%d %s", next->Number(), *next->ToText());
|
||||
next = channel;
|
||||
}
|
||||
}
|
||||
@@ -696,7 +696,7 @@ void cSVDRP::CmdLSTC(const char *Option)
|
||||
i = channel->Number() + 1;
|
||||
}
|
||||
if (next)
|
||||
Reply(250, "%d %s", next->Number(), next->ToText());
|
||||
Reply(250, "%d %s", next->Number(), *next->ToText());
|
||||
else
|
||||
Reply(501, "Channel \"%s\" not defined", Option);
|
||||
}
|
||||
@@ -706,7 +706,7 @@ void cSVDRP::CmdLSTC(const char *Option)
|
||||
while (i <= Channels.MaxNumber()) {
|
||||
cChannel *channel = Channels.GetByNumber(i, 1);
|
||||
if (channel)
|
||||
Reply(channel->Number() < Channels.MaxNumber() ? -250 : 250, "%d %s", channel->Number(), channel->ToText());
|
||||
Reply(channel->Number() < Channels.MaxNumber() ? -250 : 250, "%d %s", channel->Number(), *channel->ToText());
|
||||
else
|
||||
Reply(501, "Channel \"%d\" not found", i);
|
||||
i = channel->Number() + 1;
|
||||
@@ -830,7 +830,7 @@ void cSVDRP::CmdLSTT(const char *Option)
|
||||
if (isnumber(Option)) {
|
||||
cTimer *timer = Timers.Get(strtol(Option, NULL, 10) - 1);
|
||||
if (timer)
|
||||
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
|
||||
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
|
||||
else
|
||||
Reply(501, "Timer \"%s\" not defined", Option);
|
||||
}
|
||||
@@ -841,7 +841,7 @@ void cSVDRP::CmdLSTT(const char *Option)
|
||||
for (int i = 0; i < Timers.Count(); i++) {
|
||||
cTimer *timer = Timers.Get(i);
|
||||
if (timer)
|
||||
Reply(i < Timers.Count() - 1 ? -250 : 250, "%d %s", timer->Index() + 1, timer->ToText());
|
||||
Reply(i < Timers.Count() - 1 ? -250 : 250, "%d %s", timer->Index() + 1, *timer->ToText());
|
||||
else
|
||||
Reply(501, "Timer \"%d\" not found", i + 1);
|
||||
}
|
||||
@@ -879,8 +879,8 @@ void cSVDRP::CmdMODC(const char *Option)
|
||||
*channel = ch;
|
||||
Channels.ReNumber();
|
||||
Channels.SetModified(true);
|
||||
isyslog("modifed channel %d %s", channel->Number(), channel->ToText());
|
||||
Reply(250, "%d %s", channel->Number(), channel->ToText());
|
||||
isyslog("modifed channel %d %s", channel->Number(), *channel->ToText());
|
||||
Reply(250, "%d %s", channel->Number(), *channel->ToText());
|
||||
}
|
||||
else
|
||||
Reply(501, "Channel settings are not unique");
|
||||
@@ -919,7 +919,7 @@ void cSVDRP::CmdMODT(const char *Option)
|
||||
*timer = t;
|
||||
Timers.SetModified();
|
||||
isyslog("timer %d modified (%s)", timer->Index() + 1, timer->HasFlags(tfActive) ? "active" : "inactive");
|
||||
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
|
||||
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
|
||||
}
|
||||
else
|
||||
Reply(501, "Timer \"%d\" not defined", n);
|
||||
@@ -954,8 +954,8 @@ void cSVDRP::CmdNEWC(const char *Option)
|
||||
Channels.Add(channel);
|
||||
Channels.ReNumber();
|
||||
Channels.SetModified(true);
|
||||
isyslog("new channel %d %s", channel->Number(), channel->ToText());
|
||||
Reply(250, "%d %s", channel->Number(), channel->ToText());
|
||||
isyslog("new channel %d %s", channel->Number(), *channel->ToText());
|
||||
Reply(250, "%d %s", channel->Number(), *channel->ToText());
|
||||
}
|
||||
else
|
||||
Reply(501, "Channel settings are not unique");
|
||||
@@ -977,11 +977,11 @@ void cSVDRP::CmdNEWT(const char *Option)
|
||||
Timers.Add(timer);
|
||||
Timers.SetModified();
|
||||
isyslog("timer %d added", timer->Index() + 1);
|
||||
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
|
||||
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
|
||||
return;
|
||||
}
|
||||
else
|
||||
Reply(550, "Timer already defined: %d %s", t->Index() + 1, t->ToText());
|
||||
Reply(550, "Timer already defined: %d %s", t->Index() + 1, *t->ToText());
|
||||
}
|
||||
else
|
||||
Reply(501, "Error in timer settings");
|
||||
@@ -998,7 +998,7 @@ void cSVDRP::CmdNEXT(const char *Option)
|
||||
time_t Start = t->StartTime();
|
||||
int Number = t->Index() + 1;
|
||||
if (!*Option)
|
||||
Reply(250, "%d %s", Number, *cCtime(Start));
|
||||
Reply(250, "%d %s", Number, *TimeToString(Start));
|
||||
else if (strcasecmp(Option, "ABS") == 0)
|
||||
Reply(250, "%d %ld", Number, Start);
|
||||
else if (strcasecmp(Option, "REL") == 0)
|
||||
@@ -1057,7 +1057,7 @@ void cSVDRP::CmdUPDT(const char *Option)
|
||||
isyslog("timer %d added", timer->Index() + 1);
|
||||
}
|
||||
Timers.SetModified();
|
||||
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
|
||||
Reply(250, "%d %s", timer->Index() + 1, *timer->ToText());
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -1151,7 +1151,7 @@ bool cSVDRP::Process(void)
|
||||
char buffer[BUFSIZ];
|
||||
gethostname(buffer, sizeof(buffer));
|
||||
time_t now = time(NULL);
|
||||
Reply(220, "%s SVDRP VideoDiskRecorder %s; %s", buffer, VDRVERSION, *cCtime(now));
|
||||
Reply(220, "%s SVDRP VideoDiskRecorder %s; %s", buffer, VDRVERSION, *TimeToString(now));
|
||||
}
|
||||
if (NewConnection)
|
||||
lastActivity = time(NULL);
|
||||
|
||||
Reference in New Issue
Block a user