From: Jaroslav Kysela Date: Fri, 12 Jan 2018 08:17:58 +0000 (+0100) Subject: xmltv: save category and keyword always in lowercase X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9fe904e054c4c5465e2a39dc215dda54494fbd10;p=thirdparty%2Ftvheadend.git xmltv: save category and keyword always in lowercase --- diff --git a/src/epggrab/module/xmltv.c b/src/epggrab/module/xmltv.c index 5e95dc921..5945be56d 100644 --- a/src/epggrab/module/xmltv.c +++ b/src/epggrab/module/xmltv.c @@ -538,7 +538,7 @@ static string_list_t * const char *str = htsmsg_get_str(e, "cdata"); if (str && *str) { if (!tag_list) tag_list = string_list_create(); - string_list_insert(tag_list, str); + string_list_insert_lowercase(tag_list, str); } } } diff --git a/src/string_list.c b/src/string_list.c index f003ab750..35d7e4cf6 100644 --- a/src/string_list.c +++ b/src/string_list.c @@ -18,6 +18,7 @@ #include "string_list.h" +#include #include #include "htsmsg.h" @@ -70,6 +71,18 @@ string_list_insert(string_list_t *l, const char *id) } } +void +string_list_insert_lowercase(string_list_t *l, const char *id) +{ + char *s, *p; + + if (!id) return; + s = alloca(strlen(id) + 1); + for (s = p = alloca(strlen(id) + 1); *id; id++, p++) + *p = tolower(*id); + string_list_insert(l, s); +} + htsmsg_t * string_list_to_htsmsg(const string_list_t *l) { diff --git a/src/string_list.h b/src/string_list.h index 1d6c47403..324e8ef0d 100644 --- a/src/string_list.h +++ b/src/string_list.h @@ -57,6 +57,9 @@ void string_list_destroy(string_list_t *l); /// Insert a copy of id in to the sorted string list. void string_list_insert(string_list_t *l, const char *id); +/// Insert a copy of lowercase id in to the sorted string list. +void string_list_insert_lowercase(string_list_t *l, const char *id); + /// Conversion function from sorted string list to an htsmsg. /// @return NULL if empty. struct htsmsg *string_list_to_htsmsg(const string_list_t *l)