caclient_dvbcam_class_caid_list_set didn't count the existing entries in the
dvbcam caid_list. Thus, it couldn't check if the old and the new list size
differ. This was only a problem when the list was cleared, because the
change flag was not set in this case and the empty list was not saved.
Signed-off-by: Jasmin Jessich <jasmin@anw.at>
const char *s;
htsmsg_field_t *f;
uint16_t caid_list[ARRAY_SIZE(dc->caid_list)];
- int caid, index = 0, change = 0;
+ int caid, idx, index = 0, change = 0;
+
+ for (idx = 0; dc->caid_list[idx] && idx < ARRAY_SIZE(dc->caid_list); idx++);
- dc->caid_list[0] = 0;
if (list == NULL)
return 0;
HTSMSG_FOREACH(f, list) {
dc->caid_list[index] = 0;
if (change)
memcpy(dc->caid_list, caid_list, index * sizeof(caid_list[0]));
- return change;
+ return change || index != idx;
}
static const void *