aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/plugins/httpd
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-12-01 22:25:18 +0100
committerMax Kellermann <max@duempel.org>2014-12-01 22:33:57 +0100
commit7363d50a1e284d64f5b347ada036174e4fecaa3c (patch)
tree5112225c5e488a6f237487bdbfe98d4a0b7000bf /src/output/plugins/httpd
parent15213a041d3206f2736462577f1b7c32066c7360 (diff)
downloadmpd-7363d50a1e284d64f5b347ada036174e4fecaa3c.tar.gz
mpd-7363d50a1e284d64f5b347ada036174e4fecaa3c.tar.xz
mpd-7363d50a1e284d64f5b347ada036174e4fecaa3c.zip
output/httpd/IcyMetaDataServer: use CopyString() instead of g_strlcpy()
Diffstat (limited to 'src/output/plugins/httpd')
-rw-r--r--src/output/plugins/httpd/IcyMetaDataServer.cxx25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/output/plugins/httpd/IcyMetaDataServer.cxx b/src/output/plugins/httpd/IcyMetaDataServer.cxx
index 5f68ff982..108d4e7ec 100644
--- a/src/output/plugins/httpd/IcyMetaDataServer.cxx
+++ b/src/output/plugins/httpd/IcyMetaDataServer.cxx
@@ -22,8 +22,8 @@
#include "Page.hxx"
#include "tag/Tag.hxx"
#include "util/FormatString.hxx"
-
-#include <glib.h>
+#include "util/StringUtil.hxx"
+#include "util/Macros.hxx"
#include <string.h>
@@ -95,25 +95,14 @@ icy_server_metadata_page(const Tag &tag, const TagType *types)
// Length + Metadata - "StreamTitle='';StreamUrl='';" = 4081 - 28
char stream_title[(1 + 255 - 28) * 16];
+ char *p = stream_title, *const end = stream_title + ARRAY_SIZE(stream_title);
stream_title[0] = '\0';
- unsigned position = 0;
-
- while (position < sizeof(stream_title) && item <= last_item) {
- size_t length = 0;
-
- length = g_strlcpy(stream_title + position,
- tag_items[item++],
- sizeof(stream_title) - position);
-
- position += length;
- if (item <= last_item) {
- length = g_strlcpy(stream_title + position,
- " - ",
- sizeof(stream_title) - position);
+ while (p < end && item <= last_item) {
+ p = CopyString(p, tag_items[item++], end - p);
- position += length;
- }
+ if (item <= last_item)
+ p = CopyString(p, " - ", end - p);
}
char *icy_string = icy_server_metadata_string(stream_title, "");