1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Fixed parsing of the setup values.

This commit is contained in:
Rolf Ahrenberg 2015-01-15 00:10:22 +02:00
parent 3b9269e9de
commit fb7a7fe3a2
3 changed files with 11 additions and 6 deletions

View File

@ -101,3 +101,4 @@ VDR Plugin 'satip' Revision History
2015-01-18: Version 1.0.2 2015-01-18: Version 1.0.2
- Added configurable CI slots. - Added configurable CI slots.
- Fixed parsing of the setup values.

View File

@ -235,7 +235,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
#ifdef USE_SINGLE_MODEL_SERVERS_ONLY #ifdef USE_SINGLE_MODEL_SERVERS_ONLY
int n = 0; int n = 0;
char *s, *p = (char *)modelP; char *s, *p = strdup(modelP);
char *r = strtok_r(p, ",", &s); char *r = strtok_r(p, ",", &s);
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
@ -249,6 +249,7 @@ void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char
DELETENULL(tmp); DELETENULL(tmp);
r = strtok_r(NULL, ",\n", &s); r = strtok_r(NULL, ",\n", &s);
} }
FREE_POINTER(p);
#else #else
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP); cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
// Validate against existing servers // Validate against existing servers

13
satip.c
View File

@ -198,7 +198,7 @@ void cPluginSatip::ParseServer(const char *paramP)
{ {
debug1("%s (%s)", __PRETTY_FUNCTION__, paramP); debug1("%s (%s)", __PRETTY_FUNCTION__, paramP);
int n = 0; int n = 0;
char *s, *p = (char *)paramP; char *s, *p = strdup(paramP);
char *r = strtok_r(p, ";", &s); char *r = strtok_r(p, ";", &s);
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
@ -233,13 +233,14 @@ void cPluginSatip::ParseServer(const char *paramP)
++n; ++n;
r = strtok_r(NULL, ";", &s); r = strtok_r(NULL, ";", &s);
} }
FREE_POINTER(p);
} }
int cPluginSatip::ParseCicams(const char *valueP, int *cicamsP) int cPluginSatip::ParseCicams(const char *valueP, int *cicamsP)
{ {
debug1("%s (%s,)", __PRETTY_FUNCTION__, valueP); debug1("%s (%s,)", __PRETTY_FUNCTION__, valueP);
int n = 0; int n = 0;
char *s, *p = (char *)valueP; char *s, *p = strdup(valueP);
char *r = strtok_r(p, " ", &s); char *r = strtok_r(p, " ", &s);
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
@ -247,8 +248,9 @@ int cPluginSatip::ParseCicams(const char *valueP, int *cicamsP)
if (n < MAX_CICAM_COUNT) { if (n < MAX_CICAM_COUNT) {
cicamsP[n++] = atoi(r); cicamsP[n++] = atoi(r);
} }
r = strtok_r(NULL, " \n", &s); r = strtok_r(NULL, " ", &s);
} }
FREE_POINTER(p);
return n; return n;
} }
@ -256,7 +258,7 @@ int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
{ {
debug1("%s (%s,)", __PRETTY_FUNCTION__, valueP); debug1("%s (%s,)", __PRETTY_FUNCTION__, valueP);
int n = 0; int n = 0;
char *s, *p = (char *)valueP; char *s, *p = strdup(valueP);
char *r = strtok_r(p, " ", &s); char *r = strtok_r(p, " ", &s);
while (r) { while (r) {
r = skipspace(r); r = skipspace(r);
@ -264,8 +266,9 @@ int cPluginSatip::ParseSources(const char *valueP, int *sourcesP)
if (n < MAX_DISABLED_SOURCES_COUNT) { if (n < MAX_DISABLED_SOURCES_COUNT) {
sourcesP[n++] = cSource::FromString(r); sourcesP[n++] = cSource::FromString(r);
} }
r = strtok_r(NULL, " \n", &s); r = strtok_r(NULL, " ", &s);
} }
FREE_POINTER(p);
return n; return n;
} }