aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-24 20:39:14 +0100
committerMax Kellermann <max@duempel.org>2014-02-24 20:39:37 +0100
commit6d9739165eaf3d81e00f60124cfc48aba509a9a6 (patch)
tree9ed80a99420dd9526c1e724ba8628c766b858c3f /src/output
parent7c5396ffb9151cb379e883f0776c4db57eeef5ed (diff)
downloadmpd-6d9739165eaf3d81e00f60124cfc48aba509a9a6.tar.gz
mpd-6d9739165eaf3d81e00f60124cfc48aba509a9a6.tar.xz
mpd-6d9739165eaf3d81e00f60124cfc48aba509a9a6.zip
output/httpd/client: eliminate GLib
Diffstat (limited to 'src/output')
-rw-r--r--src/output/plugins/httpd/HttpdClient.cxx24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/output/plugins/httpd/HttpdClient.cxx b/src/output/plugins/httpd/HttpdClient.cxx
index d761bdf57..cd2adc860 100644
--- a/src/output/plugins/httpd/HttpdClient.cxx
+++ b/src/output/plugins/httpd/HttpdClient.cxx
@@ -26,8 +26,6 @@
#include "system/SocketError.hxx"
#include "Log.hxx"
-#include <glib.h>
-
#include <assert.h>
#include <string.h>
@@ -142,7 +140,9 @@ HttpdClient::HandleLine(const char *line)
bool
HttpdClient::SendResponse()
{
- char buffer[1024];
+ char buffer[1024], *allocated = nullptr;
+ const char *response;
+
assert(state == RESPONSE);
if (dlna_streaming_requested) {
@@ -158,18 +158,14 @@ HttpdClient::SendResponse()
"contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0\r\n"
"\r\n",
httpd.content_type);
+ response = buffer;
} else if (metadata_requested) {
- char *metadata_header =
+ response = allocated =
icy_server_metadata_header(httpd.name, httpd.genre,
httpd.website,
httpd.content_type,
metaint);
-
- g_strlcpy(buffer, metadata_header, sizeof(buffer));
-
- delete[] metadata_header;
-
} else { /* revert to a normal HTTP request */
snprintf(buffer, sizeof(buffer),
"HTTP/1.1 200 OK\r\n"
@@ -179,9 +175,11 @@ HttpdClient::SendResponse()
"Cache-Control: no-cache, no-store\r\n"
"\r\n",
httpd.content_type);
+ response = buffer;
}
- ssize_t nbytes = SocketMonitor::Write(buffer, strlen(buffer));
+ ssize_t nbytes = SocketMonitor::Write(response, strlen(response));
+ delete[] allocated;
if (gcc_unlikely(nbytes < 0)) {
const SocketErrorMessage msg;
FormatWarning(httpd_output_domain,
@@ -321,7 +319,7 @@ HttpdClient::TryWrite()
metadata_sent = true;
}
} else {
- guchar empty_data = 0;
+ char empty_data = 0;
ssize_t nbytes = Write(&empty_data, 1);
if (nbytes < 0) {
@@ -406,13 +404,13 @@ HttpdClient::PushPage(Page *page)
void
HttpdClient::PushMetaData(Page *page)
{
+ assert(page != nullptr);
+
if (metadata) {
metadata->Unref();
metadata = nullptr;
}
- g_return_if_fail (page);
-
page->Ref();
metadata = page;
metadata_sent = false;