aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/SoupInputPlugin.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input/SoupInputPlugin.cxx (renamed from src/input/soup_input_plugin.c)58
1 files changed, 34 insertions, 24 deletions
diff --git a/src/input/soup_input_plugin.c b/src/input/SoupInputPlugin.cxx
index fc903b48c..5a60fa725 100644
--- a/src/input/soup_input_plugin.c
+++ b/src/input/SoupInputPlugin.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2011 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,14 +18,21 @@
*/
#include "config.h"
-#include "input/soup_input_plugin.h"
-#include "input_internal.h"
+#include "SoupInputPlugin.hxx"
#include "input_plugin.h"
-#include "io_thread.h"
+
+extern "C" {
+#include "input_internal.h"
+}
+
+#include "IOThread.hxx"
+#include "event/Loop.hxx"
#include "conf.h"
+extern "C" {
#include <libsoup/soup-uri.h>
#include <libsoup/soup-session-async.h>
+}
#include <assert.h>
#include <string.h>
@@ -99,7 +106,7 @@ input_soup_init(const struct config_param *param, GError **error_r)
soup_session_async_new_with_options(SOUP_SESSION_PROXY_URI,
soup_proxy,
SOUP_SESSION_ASYNC_CONTEXT,
- io_thread_context(),
+ io_thread_get().GetContext(),
NULL);
return true;
@@ -156,7 +163,7 @@ static void
input_soup_session_callback(G_GNUC_UNUSED SoupSession *session,
SoupMessage *msg, gpointer user_data)
{
- struct input_soup *s = user_data;
+ struct input_soup *s = (struct input_soup *)user_data;
assert(msg == s->msg);
assert(!s->completed);
@@ -177,7 +184,7 @@ input_soup_session_callback(G_GNUC_UNUSED SoupSession *session,
static void
input_soup_got_headers(SoupMessage *msg, gpointer user_data)
{
- struct input_soup *s = user_data;
+ struct input_soup *s = (struct input_soup *)user_data;
g_mutex_lock(s->base.mutex);
@@ -199,7 +206,7 @@ input_soup_got_headers(SoupMessage *msg, gpointer user_data)
static void
input_soup_got_chunk(SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
{
- struct input_soup *s = user_data;
+ struct input_soup *s = (struct input_soup *)user_data;
assert(msg == s->msg);
@@ -220,7 +227,7 @@ input_soup_got_chunk(SoupMessage *msg, SoupBuffer *chunk, gpointer user_data)
static void
input_soup_got_body(G_GNUC_UNUSED SoupMessage *msg, gpointer user_data)
{
- struct input_soup *s = user_data;
+ struct input_soup *s = (struct input_soup *)user_data;
assert(msg == s->msg);
@@ -256,7 +263,7 @@ input_soup_wait_data(struct input_soup *s)
static gpointer
input_soup_queue(gpointer data)
{
- struct input_soup *s = data;
+ struct input_soup *s = (struct input_soup *)data;
soup_session_queue_message(soup_session, s->msg,
input_soup_session_callback, s);
@@ -320,7 +327,7 @@ input_soup_open(const char *uri,
static gpointer
input_soup_cancel(gpointer data)
{
- struct input_soup *s = data;
+ struct input_soup *s = (struct input_soup *)data;
if (!s->completed)
soup_session_cancel_message(soup_session, s->msg,
@@ -352,7 +359,7 @@ input_soup_close(struct input_stream *is)
g_mutex_unlock(s->base.mutex);
SoupBuffer *buffer;
- while ((buffer = g_queue_pop_head(s->buffers)) != NULL)
+ while ((buffer = (SoupBuffer *)g_queue_pop_head(s->buffers)) != NULL)
soup_buffer_free(buffer);
g_queue_free(s->buffers);
@@ -403,10 +410,11 @@ input_soup_read(struct input_stream *is, void *ptr, size_t size,
return 0;
}
- char *p0 = ptr, *p = p0, *p_end = p0 + size;
+ char *p0 = (char *)ptr, *p = p0, *p_end = p0 + size;
while (p < p_end) {
- SoupBuffer *buffer = g_queue_pop_head(s->buffers);
+ SoupBuffer *buffer = (SoupBuffer *)
+ g_queue_pop_head(s->buffers);
if (buffer == NULL) {
assert(s->current_consumed == 0);
break;
@@ -460,14 +468,16 @@ input_soup_eof(G_GNUC_UNUSED struct input_stream *is)
}
const struct input_plugin input_plugin_soup = {
- .name = "soup",
- .init = input_soup_init,
- .finish = input_soup_finish,
-
- .open = input_soup_open,
- .close = input_soup_close,
- .check = input_soup_check,
- .available = input_soup_available,
- .read = input_soup_read,
- .eof = input_soup_eof,
+ "soup",
+ input_soup_init,
+ input_soup_finish,
+ input_soup_open,
+ input_soup_close,
+ input_soup_check,
+ nullptr,
+ nullptr,
+ input_soup_available,
+ input_soup_read,
+ input_soup_eof,
+ nullptr,
};