From: Jaroslav Kysela Date: Wed, 30 Mar 2016 11:27:38 +0000 (+0200) Subject: idnode: fix idnode_slist_set, fixes #3646 X-Git-Tag: v4.2.1~772 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7965ebd938535897f66e5b909b1c27184d46eb09;p=thirdparty%2Ftvheadend.git idnode: fix idnode_slist_set, fixes #3646 --- diff --git a/src/bouquet.c b/src/bouquet.c index 36cece81f..eb66498bc 100644 --- a/src/bouquet.c +++ b/src/bouquet.c @@ -977,6 +977,7 @@ const idclass_t bouquet_class = { }, { .type = PT_INT, + .islist = 1, .id = "mapopt", .name = N_("Channel mapping options"), .desc = N_("Options to use/used when mapping " @@ -993,11 +994,11 @@ const idclass_t bouquet_class = { .get = bouquet_class_mapopt_get, .set = bouquet_class_mapopt_set, .rend = bouquet_class_mapopt_rend, - .opts = PO_ADVANCED, - .islist = 1 + .opts = PO_ADVANCED }, { .type = PT_INT, + .islist = 1, .id = "chtag", .name = N_("Create tags"), .desc = N_("Create and link these tags to channels when " @@ -1016,8 +1017,7 @@ const idclass_t bouquet_class = { .get = bouquet_class_chtag_get, .set = bouquet_class_chtag_set, .rend = bouquet_class_chtag_rend, - .opts = PO_ADVANCED, - .islist = 1 + .opts = PO_ADVANCED }, { .type = PT_STR, diff --git a/src/idnode.c b/src/idnode.c index 53fc03f02..3b4c7dcfc 100644 --- a/src/idnode.c +++ b/src/idnode.c @@ -1535,18 +1535,21 @@ idnode_slist_set ( idnode_t *in, idnode_slist_t *options, const htsmsg_t *vals ) for (o = options; o->id; o++) { ip = (void *)in + o->off; - HTSMSG_FOREACH(f, vals) { - if ((s = htsmsg_field_get_str(f)) != NULL) - continue; - if (strcmp(s, o->id)) - continue; - if (*ip == 0) changed = 1; - break; + if (!changed) { + HTSMSG_FOREACH(f, vals) { + if ((s = htsmsg_field_get_str(f)) != NULL) + continue; + if (strcmp(s, o->id)) + continue; + if (*ip == 0) changed = 1; + break; + } + if (f == NULL && *ip) changed = 1; } - if (f == NULL && *ip) changed = 1; + *ip = 0; } HTSMSG_FOREACH(f, vals) { - if ((s = htsmsg_field_get_str(f)) != NULL) + if ((s = htsmsg_field_get_str(f)) == NULL) continue; for (o = options; o->id; o++) { if (strcmp(o->id, s)) continue;