diff options
author | Max Kellermann <max@duempel.org> | 2014-12-01 22:25:30 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-12-01 22:28:14 +0100 |
commit | fb70a34c8029dd021a3d9a6380252df608b14bcd (patch) | |
tree | d329ba7036110e5838f7d769c9bb08706e6a09f5 /src/output/plugins/httpd | |
parent | fbf76c6d213a89b384cabb58bfc7e63cc969c718 (diff) | |
download | mpd-fb70a34c8029dd021a3d9a6380252df608b14bcd.tar.gz mpd-fb70a34c8029dd021a3d9a6380252df608b14bcd.tar.xz mpd-fb70a34c8029dd021a3d9a6380252df608b14bcd.zip |
output/httpd/IcyMetaDataServer: make variables more local
Diffstat (limited to '')
-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; |