output/httpd/IcyMetaDataServer: make variables more local
This commit is contained in:
parent
fbf76c6d21
commit
fb70a34c80
@ -57,16 +57,13 @@ icy_server_metadata_header(const char *name,
|
|||||||
static char *
|
static char *
|
||||||
icy_server_metadata_string(const char *stream_title, const char* stream_url)
|
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
|
// The leading n is a placeholder for the length information
|
||||||
icy_metadata = FormatNew("nStreamTitle='%s';"
|
gchar *icy_metadata = FormatNew("nStreamTitle='%s';"
|
||||||
"StreamUrl='%s';",
|
"StreamUrl='%s';",
|
||||||
stream_title,
|
stream_title,
|
||||||
stream_url);
|
stream_url);
|
||||||
|
|
||||||
meta_length = strlen(icy_metadata);
|
guint meta_length = strlen(icy_metadata);
|
||||||
|
|
||||||
meta_length--; // subtract placeholder
|
meta_length--; // subtract placeholder
|
||||||
|
|
||||||
@ -86,23 +83,21 @@ Page *
|
|||||||
icy_server_metadata_page(const Tag &tag, const TagType *types)
|
icy_server_metadata_page(const Tag &tag, const TagType *types)
|
||||||
{
|
{
|
||||||
const gchar *tag_items[TAG_NUM_OF_ITEM_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) {
|
while (*types != TAG_NUM_OF_ITEM_TYPES) {
|
||||||
const gchar *tag_item = tag.GetValue(*types++);
|
const gchar *tag_item = tag.GetValue(*types++);
|
||||||
if (tag_item)
|
if (tag_item)
|
||||||
tag_items[++last_item] = 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) {
|
while (position < sizeof(stream_title) && item <= last_item) {
|
||||||
gint length = 0;
|
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)
|
if (icy_string == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user