]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
idnode: fix idnode_slist_set, fixes #3646
authorJaroslav Kysela <perex@perex.cz>
Wed, 30 Mar 2016 11:27:38 +0000 (13:27 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 30 Mar 2016 11:27:38 +0000 (13:27 +0200)
src/bouquet.c
src/idnode.c

index 36cece81f6cc945489eb6fb21367175029d24201..eb66498bcc85289118a76b35850fd6d9ac300c52 100644 (file)
@@ -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,
index 53fc03f02f13d8b53d50fb71bac127896503302a..3b4c7dcfc2e6a8616bc0ec294e449ca1bf03e4b0 100644 (file)
@@ -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;