Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
config: fix EPG language parsing, fixes #3270
  • Loading branch information
perexg committed Nov 7, 2015
1 parent 0c7f054 commit ed37999
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 11 additions & 7 deletions src/config.c
Expand Up @@ -1621,6 +1621,7 @@ config_boot ( const char *path, gid_t gid, uid_t uid )
struct stat st;
char buf[1024];
htsmsg_t *config2;
htsmsg_field_t *f;
const char *s;

memset(&config, 0, sizeof(config));
Expand Down Expand Up @@ -1676,11 +1677,14 @@ config_boot ( const char *path, gid_t gid, uid_t uid )
if (!config2) {
tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
} else {
s = htsmsg_get_str(config2, "language");
if (s) {
htsmsg_t *m = htsmsg_csv_2_list(s, ',');
htsmsg_delete_field(config2, "language");
htsmsg_add_msg(config2, "language", m);
f = htsmsg_field_find(config2, "language");
if (f && f->hmf_type == HMF_STR) {
s = htsmsg_get_str(config2, "language");
if (s) {
htsmsg_t *m = htsmsg_csv_2_list(s, ',');
htsmsg_delete_field(config2, "language");
htsmsg_add_msg(config2, "language", m);
}
}
config.version = htsmsg_get_u32_or_default(config2, "config", 0);
s = htsmsg_get_str(config2, "full_version");
Expand Down Expand Up @@ -1802,7 +1806,7 @@ config_class_language_get ( void *o )
static int
config_class_language_set ( void *o, const void *v )
{
char *s = htsmsg_list_2_csv((htsmsg_t *)v, ',', 0);
char *s = htsmsg_list_2_csv((htsmsg_t *)v, ',', 3);
if (strcmp(s ?: "", config.language ?: "")) {
free(config.language);
config.language = s;
Expand Down Expand Up @@ -1831,7 +1835,7 @@ config_class_info_area_get ( void *o )
static int
config_class_info_area_set ( void *o, const void *v )
{
char *s = htsmsg_list_2_csv((htsmsg_t *)v, ',', 0);
char *s = htsmsg_list_2_csv((htsmsg_t *)v, ',', 3);
if (strcmp(s ?: "", config.info_area ?: "")) {
free(config.info_area);
config.info_area = s;
Expand Down
8 changes: 6 additions & 2 deletions src/htsmsg.c
Expand Up @@ -1068,8 +1068,12 @@ htsmsg_list_2_csv(htsmsg_t *m, char delim, int human)
used = 0;
if (human) {
sep[0] = delim;
sep[1] = ' ';
sep[2] = '\0';
if (human & 2) {
sep[1] = '\0';
} else {
sep[1] = ' ';
sep[2] = '\0';
}
ssep = "";
} else {
sep[0] = delim;
Expand Down

0 comments on commit ed37999

Please sign in to comment.