diff options
Diffstat (limited to 'src/output/plugins/httpd')
-rw-r--r-- | src/output/plugins/httpd/IcyMetaDataServer.cxx | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/output/plugins/httpd/IcyMetaDataServer.cxx b/src/output/plugins/httpd/IcyMetaDataServer.cxx index 146df23d1..5bbe10100 100644 --- a/src/output/plugins/httpd/IcyMetaDataServer.cxx +++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx @@ -57,16 +57,13 @@ icy_server_metadata_header(const char *name, static char * icy_server_metadata_string(const char *stream_title, const char* stream_url) { - gchar *icy_metadata; - guint meta_length; - // The leading n is a placeholder for the length information - icy_metadata = FormatNew("nStreamTitle='%s';" - "StreamUrl='%s';", - stream_title, - stream_url); + gchar *icy_metadata = FormatNew("nStreamTitle='%s';" + "StreamUrl='%s';", + stream_title, + stream_url); - meta_length = strlen(icy_metadata); + guint meta_length = strlen(icy_metadata); meta_length--; // subtract placeholder @@ -86,23 +83,21 @@ Page * icy_server_metadata_page(const Tag &tag, const TagType *types) { const gchar *tag_items[TAG_NUM_OF_ITEM_TYPES]; - gint last_item, item; - guint position; - gchar *icy_string; - gchar stream_title[(1 + 255 - 28) * 16]; // Length + Metadata - - // "StreamTitle='';StreamUrl='';" - // = 4081 - 28 - stream_title[0] = '\0'; - - last_item = -1; + gint last_item = -1; while (*types != TAG_NUM_OF_ITEM_TYPES) { const gchar *tag_item = tag.GetValue(*types++); if (tag_item) tag_items[++last_item] = tag_item; } - position = item = 0; + gint item = 0; + + // Length + Metadata - "StreamTitle='';StreamUrl='';" = 4081 - 28 + gchar stream_title[(1 + 255 - 28) * 16]; + stream_title[0] = '\0'; + guint position = 0; + while (position < sizeof(stream_title) && item <= last_item) { gint length = 0; @@ -121,7 +116,7 @@ icy_server_metadata_page(const Tag &tag, const TagType *types) } } - icy_string = icy_server_metadata_string(stream_title, ""); + gchar *icy_string = icy_server_metadata_string(stream_title, ""); if (icy_string == nullptr) return nullptr; |