diff options
author | Max Kellermann <max@duempel.org> | 2013-01-03 10:33:04 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-03 11:16:18 +0100 |
commit | 70b87f2eb620bdf1d7e07141914feb2316794fb3 (patch) | |
tree | 427aba509182a185263e00e222c4ee7b0fd0eb87 | |
parent | 94b2ee627c06679eb2622f2ac2e2fb0240fbab3c (diff) | |
download | mpd-70b87f2eb620bdf1d7e07141914feb2316794fb3.tar.gz mpd-70b87f2eb620bdf1d7e07141914feb2316794fb3.tar.xz mpd-70b87f2eb620bdf1d7e07141914feb2316794fb3.zip |
client: convert to C++
Diffstat (limited to '')
-rw-r--r-- | Makefile.am | 36 | ||||
-rw-r--r-- | src/AllCommands.cxx | 10 | ||||
-rw-r--r-- | src/AllCommands.hxx (renamed from src/AllCommands.h) | 6 | ||||
-rw-r--r-- | src/Client.cxx (renamed from src/client.c) | 4 | ||||
-rw-r--r-- | src/Client.hxx (renamed from src/client.h) | 0 | ||||
-rw-r--r-- | src/ClientEvent.cxx (renamed from src/client_event.c) | 12 | ||||
-rw-r--r-- | src/ClientExpire.cxx (renamed from src/client_expire.c) | 6 | ||||
-rw-r--r-- | src/ClientFile.cxx (renamed from src/client_file.c) | 6 | ||||
-rw-r--r-- | src/ClientFile.hxx (renamed from src/client_file.h) | 6 | ||||
-rw-r--r-- | src/ClientGlobal.cxx (renamed from src/client_global.c) | 7 | ||||
-rw-r--r-- | src/ClientIdle.cxx (renamed from src/client_idle.c) | 11 | ||||
-rw-r--r-- | src/ClientIdle.hxx (renamed from src/client_idle.h) | 8 | ||||
-rw-r--r-- | src/ClientInternal.hxx (renamed from src/client_internal.h) | 10 | ||||
-rw-r--r-- | src/ClientList.cxx (renamed from src/client_list.c) | 6 | ||||
-rw-r--r-- | src/ClientMessage.cxx (renamed from src/client_message.c) | 4 | ||||
-rw-r--r-- | src/ClientMessage.hxx (renamed from src/client_message.h) | 0 | ||||
-rw-r--r-- | src/ClientNew.cxx | 4 | ||||
-rw-r--r-- | src/ClientProcess.cxx (renamed from src/client_process.c) | 10 | ||||
-rw-r--r-- | src/ClientRead.cxx (renamed from src/client_read.c) | 21 | ||||
-rw-r--r-- | src/ClientSubscribe.cxx (renamed from src/client_subscribe.c) | 11 | ||||
-rw-r--r-- | src/ClientSubscribe.hxx (renamed from src/client_subscribe.h) | 8 | ||||
-rw-r--r-- | src/ClientWrite.cxx (renamed from src/client_write.c) | 10 | ||||
-rw-r--r-- | src/CommandError.cxx | 5 | ||||
-rw-r--r-- | src/DatabaseCommands.cxx | 9 | ||||
-rw-r--r-- | src/DatabasePrint.cxx | 4 | ||||
-rw-r--r-- | src/DecoderPrint.cxx | 5 | ||||
-rw-r--r-- | src/Listen.cxx | 2 | ||||
-rw-r--r-- | src/Main.cxx | 6 | ||||
-rw-r--r-- | src/MessageCommands.cxx | 13 | ||||
-rw-r--r-- | src/OtherCommands.cxx | 12 | ||||
-rw-r--r-- | src/OutputCommands.cxx | 4 | ||||
-rw-r--r-- | src/OutputPrint.cxx | 2 | ||||
-rw-r--r-- | src/PlayerCommands.cxx | 9 | ||||
-rw-r--r-- | src/PlaylistCommands.cxx | 6 | ||||
-rw-r--r-- | src/PlaylistPrint.cxx | 2 | ||||
-rw-r--r-- | src/QueueCommands.cxx | 10 | ||||
-rw-r--r-- | src/QueuePrint.cxx | 2 | ||||
-rw-r--r-- | src/SongPrint.cxx | 2 | ||||
-rw-r--r-- | src/Stats.cxx | 5 | ||||
-rw-r--r-- | src/StickerCommands.cxx | 5 | ||||
-rw-r--r-- | src/StickerPrint.cxx | 5 | ||||
-rw-r--r-- | src/TagPrint.cxx | 5 | ||||
-rw-r--r-- | src/TimePrint.cxx | 5 | ||||
-rw-r--r-- | src/ls.cxx | 3 | ||||
-rw-r--r-- | src/protocol/ArgParser.cxx (renamed from src/protocol/argparser.c) | 6 | ||||
-rw-r--r-- | src/protocol/ArgParser.hxx (renamed from src/protocol/argparser.h) | 6 | ||||
-rw-r--r-- | src/protocol/Result.cxx (renamed from src/protocol/result.c) | 6 | ||||
-rw-r--r-- | src/protocol/Result.hxx (renamed from src/protocol/result.h) | 6 |
48 files changed, 155 insertions, 186 deletions
diff --git a/Makefile.am b/Makefile.am index 1535c5e9e..c0d59d806 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,8 +102,6 @@ mpd_headers = \ src/text_input_stream.h \ src/icy_server.h \ src/icy_metadata.h \ - src/client.h \ - src/client_internal.h \ src/server_socket.h \ src/log.h \ src/ls.h \ @@ -192,10 +190,10 @@ src_mpd_SOURCES = \ src/audio_check.c \ src/audio_format.c \ src/audio_parser.c \ - src/protocol/argparser.c src/protocol/argparser.h \ - src/protocol/result.c src/protocol/result.h \ + src/protocol/ArgParser.cxx src/protocol/ArgParser.hxx \ + src/protocol/Result.cxx src/protocol/Result.hxx \ src/CommandError.cxx src/CommandError.hxx \ - src/AllCommands.cxx src/AllCommands.h \ + src/AllCommands.cxx src/AllCommands.hxx \ src/QueueCommands.cxx src/QueueCommands.hxx \ src/PlayerCommands.cxx src/PlayerCommands.hxx \ src/PlaylistCommands.cxx src/PlaylistCommands.hxx \ @@ -243,22 +241,20 @@ src_mpd_SOURCES = \ src/UpdateContainer.cxx src/UpdateContainer.hxx \ src/UpdateInternal.hxx \ src/UpdateRemove.cxx src/UpdateRemove.hxx \ - src/client.c \ - src/client_event.c \ - src/client_expire.c \ - src/client_global.c \ - src/client_idle.h \ - src/client_idle.c \ - src/client_list.c \ + src/Client.cxx src/Client.hxx \ + src/ClientInternal.hxx \ + src/ClientEvent.cxx \ + src/ClientExpire.cxx \ + src/ClientGlobal.cxx \ + src/ClientIdle.cxx src/ClientIdle.hxx \ + src/ClientList.cxx \ src/ClientNew.cxx \ - src/client_process.c \ - src/client_read.c \ - src/client_write.c \ - src/client_message.h \ - src/client_message.c \ - src/client_subscribe.h \ - src/client_subscribe.c \ - src/client_file.c src/client_file.h \ + src/ClientProcess.cxx \ + src/ClientRead.cxx \ + src/ClientWrite.cxx \ + src/ClientMessage.cxx src/ClientMessage.hxx \ + src/ClientSubscribe.cxx src/ClientSubscribe.hxx \ + src/ClientFile.cxx src/ClientFile.hxx \ src/server_socket.c \ src/Listen.cxx src/Listen.hxx \ src/log.c \ diff --git a/src/AllCommands.cxx b/src/AllCommands.cxx index 6017f9859..d7ea8d60c 100644 --- a/src/AllCommands.cxx +++ b/src/AllCommands.cxx @@ -18,11 +18,7 @@ */ #include "config.h" - -extern "C" { -#include "AllCommands.h" -} - +#include "AllCommands.hxx" #include "command.h" #include "QueueCommands.hxx" #include "PlayerCommands.hxx" @@ -33,11 +29,11 @@ extern "C" { #include "OtherCommands.hxx" #include "Permission.hxx" #include "tag.h" +#include "protocol/Result.hxx" +#include "Client.hxx" extern "C" { -#include "protocol/result.h" #include "tokenizer.h" -#include "client.h" } #ifdef ENABLE_SQLITE diff --git a/src/AllCommands.h b/src/AllCommands.hxx index 8325094f5..9a0b45568 100644 --- a/src/AllCommands.h +++ b/src/AllCommands.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_ALL_COMMANDS_H -#define MPD_ALL_COMMANDS_H +#ifndef MPD_ALL_COMMANDS_HXX +#define MPD_ALL_COMMANDS_HXX #include "command.h" diff --git a/src/client.c b/src/Client.cxx index 3fa2c9be4..5214eabba 100644 --- a/src/client.c +++ b/src/Client.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,7 +18,7 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" bool client_is_expired(const struct client *client) { diff --git a/src/client.h b/src/Client.hxx index 51ad1eb2a..51ad1eb2a 100644 --- a/src/client.h +++ b/src/Client.hxx diff --git a/src/client_event.c b/src/ClientEvent.cxx index 5680e557b..0276ea746 100644 --- a/src/client_event.c +++ b/src/ClientEvent.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,7 +18,7 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" #include "Main.hxx" #include <assert.h> @@ -27,7 +27,7 @@ static gboolean client_out_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, gpointer data) { - struct client *client = data; + struct client *client = (struct client *)data; assert(!client_is_expired(client)); @@ -49,7 +49,7 @@ client_out_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, /* done sending deferred buffers exist: schedule read */ client->source_id = g_io_add_watch(client->channel, - G_IO_IN|G_IO_ERR|G_IO_HUP, + GIOCondition(G_IO_IN|G_IO_ERR|G_IO_HUP), client_in_event, client); return false; } @@ -62,7 +62,7 @@ gboolean client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, gpointer data) { - struct client *client = data; + struct client *client = (struct client *)data; enum command_return ret; assert(!client_is_expired(client)); @@ -99,7 +99,7 @@ client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, if (!g_queue_is_empty(client->deferred_send)) { /* deferred buffers exist: schedule write */ client->source_id = g_io_add_watch(client->channel, - G_IO_OUT|G_IO_ERR|G_IO_HUP, + GIOCondition(G_IO_OUT|G_IO_ERR|G_IO_HUP), client_out_event, client); return false; } diff --git a/src/client_expire.c b/src/ClientExpire.cxx index 1ca32ebcc..b02e2c8bb 100644 --- a/src/client_expire.c +++ b/src/ClientExpire.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,7 +18,7 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" static guint expire_source_id; @@ -42,7 +42,7 @@ client_set_expired(struct client *client) static void client_check_expired_callback(gpointer data, G_GNUC_UNUSED gpointer user_data) { - struct client *client = data; + struct client *client = (struct client *)data; if (client_is_expired(client)) { g_debug("[%u] expired", client->num); diff --git a/src/client_file.c b/src/ClientFile.cxx index 5214ff019..d06b1a03c 100644 --- a/src/client_file.c +++ b/src/ClientFile.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "client_file.h" -#include "client.h" +#include "ClientFile.hxx" +#include "Client.hxx" #include "ack.h" #include "io_error.h" diff --git a/src/client_file.h b/src/ClientFile.hxx index 2dd07dede..a3d0ed484 100644 --- a/src/client_file.h +++ b/src/ClientFile.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_CLIENT_FILE_H -#define MPD_CLIENT_FILE_H +#ifndef MPD_CLIENT_FILE_HXX +#define MPD_CLIENT_FILE_HXX #include "gerror.h" diff --git a/src/client_global.c b/src/ClientGlobal.cxx index adf3b2f9e..e51eeb949 100644 --- a/src/client_global.c +++ b/src/ClientGlobal.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,8 +18,11 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" + +extern "C" { #include "conf.h" +} #include <assert.h> diff --git a/src/client_idle.c b/src/ClientIdle.cxx index 930911d6e..7812c544c 100644 --- a/src/client_idle.c +++ b/src/ClientIdle.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,9 +18,12 @@ */ #include "config.h" -#include "client_idle.h" -#include "client_internal.h" +#include "ClientIdle.hxx" +#include "ClientInternal.hxx" + +extern "C" { #include "idle.h" +} #include <assert.h> @@ -68,7 +71,7 @@ client_idle_add(struct client *client, unsigned flags) static void client_idle_callback(gpointer data, gpointer user_data) { - struct client *client = data; + struct client *client = (struct client *)data; unsigned flags = GPOINTER_TO_UINT(user_data); client_idle_add(client, flags); diff --git a/src/client_idle.h b/src/ClientIdle.hxx index c56fd014c..8c335b1e3 100644 --- a/src/client_idle.h +++ b/src/ClientIdle.hxx @@ -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 @@ -17,10 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_CLIENT_IDLE_H -#define MPD_CLIENT_IDLE_H - -#include <stdbool.h> +#ifndef MPD_CLIENT_IDLE_HXX +#define MPD_CLIENT_IDLE_HXX struct client; diff --git a/src/client_internal.h b/src/ClientInternal.hxx index 5c2b9f11c..4252b5349 100644 --- a/src/client_internal.h +++ b/src/ClientInternal.hxx @@ -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 @@ -17,11 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_CLIENT_INTERNAL_H -#define MPD_CLIENT_INTERNAL_H +#ifndef MPD_CLIENT_INTERNAL_HXX +#define MPD_CLIENT_INTERNAL_HXX -#include "client.h" -#include "client_message.h" +#include "Client.hxx" +#include "ClientMessage.hxx" #include "command.h" #include <glib.h> diff --git a/src/client_list.c b/src/ClientList.cxx index 2c7f37aff..0e4876f85 100644 --- a/src/client_list.c +++ b/src/ClientList.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,7 +18,7 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" #include <assert.h> @@ -42,7 +42,7 @@ client_list_get_first(void) { assert(clients != NULL); - return clients->data; + return (struct client *)clients->data; } void diff --git a/src/client_message.c b/src/ClientMessage.cxx index b681b4e7f..c15ea0802 100644 --- a/src/client_message.c +++ b/src/ClientMessage.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 @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "client_message.h" +#include "ClientMessage.hxx" #include <assert.h> #include <glib.h> diff --git a/src/client_message.h b/src/ClientMessage.hxx index 6d1e734be..6d1e734be 100644 --- a/src/client_message.h +++ b/src/ClientMessage.hxx diff --git a/src/ClientNew.cxx b/src/ClientNew.cxx index e1c042614..bccabede9 100644 --- a/src/ClientNew.cxx +++ b/src/ClientNew.cxx @@ -18,9 +18,7 @@ */ #include "config.h" -extern "C" { -#include "client_internal.h" -} +#include "ClientInternal.hxx" #include "fd_util.h" extern "C" { #include "fifo_buffer.h" diff --git a/src/client_process.c b/src/ClientProcess.cxx index 7217b35ab..284c4d862 100644 --- a/src/client_process.c +++ b/src/ClientProcess.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,9 +18,9 @@ */ #include "config.h" -#include "client_internal.h" -#include "protocol/result.h" -#include "AllCommands.h" +#include "ClientInternal.hxx" +#include "protocol/Result.hxx" +#include "AllCommands.hxx" #include <string.h> @@ -35,7 +35,7 @@ client_process_command_list(struct client *client, bool list_ok, GSList *list) unsigned num = 0; for (GSList *cur = list; cur != NULL; cur = g_slist_next(cur)) { - char *cmd = cur->data; + char *cmd = (char *)cur->data; g_debug("command_process_list: process command \"%s\"", cmd); diff --git a/src/client_read.c b/src/ClientRead.cxx index 26ade264e..830820dea 100644 --- a/src/client_read.c +++ b/src/ClientRead.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,8 +18,11 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" + +extern "C" { #include "fifo_buffer.h" +} #include <assert.h> #include <string.h> @@ -27,19 +30,16 @@ static char * client_read_line(struct client *client) { - const char *p, *newline; size_t length; - char *line; - - p = fifo_buffer_read(client->input, &length); + const char *p = (const char *)fifo_buffer_read(client->input, &length); if (p == NULL) return NULL; - newline = memchr(p, '\n', length); + const char *newline = (const char *)memchr(p, '\n', length); if (newline == NULL) return NULL; - line = g_strndup(p, newline - p); + char *line = g_strndup(p, newline - p); fifo_buffer_consume(client->input, newline - p + 1); return g_strchomp(line); @@ -71,8 +71,6 @@ client_input_received(struct client *client, size_t bytesRead) enum command_return client_read(struct client *client) { - char *p; - size_t max_length; GError *error = NULL; GIOStatus status; gsize bytes_read; @@ -80,7 +78,8 @@ client_read(struct client *client) assert(client != NULL); assert(client->channel != NULL); - p = fifo_buffer_write(client->input, &max_length); + size_t max_length; + char *p = (char *)fifo_buffer_write(client->input, &max_length); if (p == NULL) { g_warning("[%u] buffer overflow", client->num); return COMMAND_RETURN_CLOSE; diff --git a/src/client_subscribe.c b/src/ClientSubscribe.cxx index c65a7ed31..38440be7b 100644 --- a/src/client_subscribe.c +++ b/src/ClientSubscribe.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 @@ -17,10 +17,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include "client_subscribe.h" -#include "client_internal.h" -#include "client_idle.h" +#include "ClientSubscribe.hxx" +#include "ClientIdle.hxx" +#include "ClientInternal.hxx" + +extern "C" { #include "idle.h" +} #include <string.h> diff --git a/src/client_subscribe.h b/src/ClientSubscribe.hxx index 2dff982ba..2f0f73291 100644 --- a/src/client_subscribe.h +++ b/src/ClientSubscribe.hxx @@ -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 @@ -17,13 +17,11 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_CLIENT_SUBSCRIBE_H -#define MPD_CLIENT_SUBSCRIBE_H +#ifndef MPD_CLIENT_SUBSCRIBE_HXX +#define MPD_CLIENT_SUBSCRIBE_HXX #include "gcc.h" -#include <stdbool.h> - typedef struct _GSList GSList; struct client; struct client_message; diff --git a/src/client_write.c b/src/ClientWrite.cxx index 78cfca8a1..dccd256ff 100644 --- a/src/client_write.c +++ b/src/ClientWrite.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,7 +18,7 @@ */ #include "config.h" -#include "client_internal.h" +#include "ClientInternal.hxx" #include <assert.h> #include <string.h> @@ -73,6 +73,7 @@ client_write_deferred(struct client *client) while (!g_queue_is_empty(client->deferred_send)) { struct deferred_buffer *buf = + (struct deferred_buffer *) g_queue_peek_head(client->deferred_send); assert(buf->size > 0); @@ -129,7 +130,7 @@ static void client_defer_output(struct client *client, return; } - buf = g_malloc(alloc); + buf = (struct deferred_buffer *)g_malloc(alloc); buf->size = length; memcpy(buf->data, data, length); @@ -246,7 +247,6 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) #ifndef G_OS_WIN32 va_list tmp; int length; - char *buffer; va_copy(tmp, args); length = vsnprintf(NULL, 0, fmt, tmp); @@ -256,7 +256,7 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) /* wtf.. */ return; - buffer = g_malloc(length + 1); + char *buffer = (char *)g_malloc(length + 1); vsnprintf(buffer, length + 1, fmt, args); client_write(client, buffer, length); g_free(buffer); diff --git a/src/CommandError.cxx b/src/CommandError.cxx index 32d3cb5ec..04de35e83 100644 --- a/src/CommandError.cxx +++ b/src/CommandError.cxx @@ -21,10 +21,7 @@ #include "CommandError.hxx" #include "db_error.h" #include "io_error.h" - -extern "C" { -#include "protocol/result.h" -} +#include "protocol/Result.hxx" #include <assert.h> #include <errno.h> diff --git a/src/DatabaseCommands.cxx b/src/DatabaseCommands.cxx index c3c22482e..c0f02ad24 100644 --- a/src/DatabaseCommands.cxx +++ b/src/DatabaseCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -24,14 +24,11 @@ #include "DatabasePrint.hxx" #include "DatabaseSelection.hxx" #include "CommandError.hxx" -#include "client_internal.h" +#include "ClientInternal.hxx" #include "tag.h" #include "uri.h" #include "SongFilter.hxx" - -extern "C" { -#include "protocol/result.h" -} +#include "protocol/Result.hxx" #include <assert.h> #include <string.h> diff --git a/src/DatabasePrint.cxx b/src/DatabasePrint.cxx index 755224e9a..7ac670def 100644 --- a/src/DatabasePrint.cxx +++ b/src/DatabasePrint.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -25,9 +25,9 @@ #include "SongPrint.hxx" #include "TimePrint.hxx" #include "Directory.hxx" +#include "Client.hxx" extern "C" { -#include "client.h" #include "song.h" #include "tag.h" } diff --git a/src/DecoderPrint.cxx b/src/DecoderPrint.cxx index a22908c0e..5dabf3490 100644 --- a/src/DecoderPrint.cxx +++ b/src/DecoderPrint.cxx @@ -21,10 +21,7 @@ #include "DecoderPrint.hxx" #include "decoder_list.h" #include "decoder_plugin.h" - -extern "C" { -#include "client.h" -} +#include "Client.hxx" #include <assert.h> diff --git a/src/Listen.cxx b/src/Listen.cxx index 90cfe5a03..954de08f1 100644 --- a/src/Listen.cxx +++ b/src/Listen.cxx @@ -20,10 +20,10 @@ #include "config.h" #include "Listen.hxx" #include "Main.hxx" +#include "Client.hxx" extern "C" { #include "server_socket.h" -#include "client.h" #include "conf.h" } diff --git a/src/Main.cxx b/src/Main.cxx index 88be49e4b..668a140be 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -29,14 +29,14 @@ #include "DatabaseSimple.hxx" #include "Permission.hxx" #include "Listen.hxx" +#include "ClientIdle.hxx" +#include "Client.hxx" +#include "AllCommands.hxx" extern "C" { #include "daemon.h" #include "io_thread.h" -#include "client.h" -#include "client_idle.h" #include "idle.h" -#include "AllCommands.h" #include "playlist.h" #include "cmdline.h" #include "conf.h" diff --git a/src/MessageCommands.cxx b/src/MessageCommands.cxx index c8ced1f35..ff22725fb 100644 --- a/src/MessageCommands.cxx +++ b/src/MessageCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -19,13 +19,10 @@ #include "config.h" #include "MessageCommands.hxx" - -extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" -#include "client_internal.h" -#include "client_subscribe.h" -} +#include "ClientSubscribe.hxx" +#include "ClientInternal.hxx" +#include "protocol/Result.hxx" +#include "protocol/ArgParser.hxx" #include <set> #include <string> diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index 66d97d841..f7f225f63 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -29,10 +29,10 @@ #include "TimePrint.hxx" #include "Mapper.hxx" #include "DecoderPrint.hxx" +#include "protocol/ArgParser.hxx" +#include "protocol/Result.hxx" extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" #include "ls.h" #include "uri.h" #include "volume.h" @@ -41,11 +41,11 @@ extern "C" { #include "Permission.hxx" #include "PlaylistFile.hxx" +#include "ClientIdle.hxx" +#include "ClientFile.hxx" +#include "Client.hxx" extern "C" { -#include "client.h" -#include "client_idle.h" -#include "client_file.h" #include "idle.h" } diff --git a/src/OutputCommands.cxx b/src/OutputCommands.cxx index 235bf976a..5903ac430 100644 --- a/src/OutputCommands.cxx +++ b/src/OutputCommands.cxx @@ -20,10 +20,10 @@ #include "config.h" #include "OutputCommands.hxx" #include "OutputPrint.hxx" +#include "protocol/Result.hxx" +#include "protocol/ArgParser.hxx" extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" #include "output_command.h" } diff --git a/src/OutputPrint.cxx b/src/OutputPrint.cxx index aa3c4c043..bf20fe794 100644 --- a/src/OutputPrint.cxx +++ b/src/OutputPrint.cxx @@ -25,10 +25,10 @@ #include "config.h" #include "OutputPrint.hxx" #include "output_internal.h" +#include "Client.hxx" extern "C" { #include "output_all.h" -#include "client.h" } void diff --git a/src/PlayerCommands.cxx b/src/PlayerCommands.cxx index 3aa3f7e63..e80bb04fa 100644 --- a/src/PlayerCommands.cxx +++ b/src/PlayerCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -22,15 +22,14 @@ #include "CommandError.hxx" #include "PlaylistPrint.hxx" #include "UpdateGlue.hxx" +#include "ClientInternal.hxx" +#include "protocol/Result.hxx" +#include "protocol/ArgParser.hxx" extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" #include "player_control.h" #include "playlist.h" #include "volume.h" -#include "client.h" -#include "client_internal.h" #include "replay_gain_config.h" } diff --git a/src/PlaylistCommands.cxx b/src/PlaylistCommands.cxx index 890beef79..5a767576a 100644 --- a/src/PlaylistCommands.cxx +++ b/src/PlaylistCommands.cxx @@ -26,14 +26,14 @@ #include "PlaylistFile.hxx" #include "PlaylistQueue.hxx" #include "TimePrint.hxx" +#include "ClientInternal.hxx" +#include "protocol/ArgParser.hxx" +#include "protocol/Result.hxx" extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" #include "playlist.h" #include "ls.h" #include "uri.h" -#include "client_internal.h" } #include <assert.h> diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx index 6fc354f30..0a15d2091 100644 --- a/src/PlaylistPrint.cxx +++ b/src/PlaylistPrint.cxx @@ -26,13 +26,13 @@ #include "SongPrint.hxx" #include "DatabaseGlue.hxx" #include "DatabasePlugin.hxx" +#include "Client.hxx" extern "C" { #include "playlist_list.h" #include "playlist_plugin.h" #include "playlist.h" #include "song.h" -#include "client.h" #include "input_stream.h" } diff --git a/src/QueueCommands.cxx b/src/QueueCommands.cxx index cdd58d31e..185f32990 100644 --- a/src/QueueCommands.cxx +++ b/src/QueueCommands.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -23,15 +23,15 @@ #include "DatabaseQueue.hxx" #include "SongFilter.hxx" #include "PlaylistPrint.hxx" +#include "ClientFile.hxx" +#include "ClientInternal.hxx" +#include "protocol/ArgParser.hxx" +#include "protocol/Result.hxx" extern "C" { -#include "protocol/argparser.h" -#include "protocol/result.h" #include "playlist.h" #include "ls.h" #include "uri.h" -#include "client_internal.h" -#include "client_file.h" } #include <string.h> diff --git a/src/QueuePrint.cxx b/src/QueuePrint.cxx index f99181ca5..de2df5531 100644 --- a/src/QueuePrint.cxx +++ b/src/QueuePrint.cxx @@ -22,11 +22,11 @@ #include "SongFilter.hxx" #include "SongPrint.hxx" #include "Mapper.hxx" +#include "Client.hxx" extern "C" { #include "queue.h" #include "song.h" -#include "client.h" } /** diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx index b15a5cf1a..7b3bde2bc 100644 --- a/src/SongPrint.cxx +++ b/src/SongPrint.cxx @@ -24,9 +24,9 @@ #include "TimePrint.hxx" #include "TagPrint.hxx" #include "Mapper.hxx" +#include "Client.hxx" extern "C" { -#include "client.h" #include "uri.h" } diff --git a/src/Stats.cxx b/src/Stats.cxx index 81d083d8c..e3d906915 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -21,11 +21,10 @@ extern "C" { #include "stats.h" -#include "client.h" #include "player_control.h" -#include "client_internal.h" } +#include "ClientInternal.hxx" #include "DatabaseSelection.hxx" #include "DatabaseGlue.hxx" #include "DatabasePlugin.hxx" diff --git a/src/StickerCommands.cxx b/src/StickerCommands.cxx index 3383b9553..dbd97ce21 100644 --- a/src/StickerCommands.cxx +++ b/src/StickerCommands.cxx @@ -28,10 +28,7 @@ #include "StickerPrint.hxx" #include "StickerDatabase.hxx" #include "CommandError.hxx" - -extern "C" { -#include "protocol/result.h" -} +#include "protocol/Result.hxx" #include <string.h> diff --git a/src/StickerPrint.cxx b/src/StickerPrint.cxx index 6099f728d..6a14620e0 100644 --- a/src/StickerPrint.cxx +++ b/src/StickerPrint.cxx @@ -20,10 +20,7 @@ #include "config.h" #include "StickerPrint.hxx" #include "StickerDatabase.hxx" - -extern "C" { -#include "client.h" -} +#include "Client.hxx" void sticker_print_value(struct client *client, diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index 9f25d95c6..ef05b6c14 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -22,10 +22,7 @@ #include "tag.h" #include "tag_internal.h" #include "song.h" - -extern "C" { -#include "client.h" -} +#include "Client.hxx" void tag_print_types(struct client *client) { diff --git a/src/TimePrint.cxx b/src/TimePrint.cxx index f9499980b..208b20e6e 100644 --- a/src/TimePrint.cxx +++ b/src/TimePrint.cxx @@ -19,10 +19,7 @@ #include "config.h" #include "TimePrint.hxx" - -extern "C" { -#include "client.h" -} +#include "Client.hxx" #include <glib.h> diff --git a/src/ls.cxx b/src/ls.cxx index 00edb2bb5..9c3a307c7 100644 --- a/src/ls.cxx +++ b/src/ls.cxx @@ -22,9 +22,10 @@ extern "C" { #include "ls.h" #include "uri.h" -#include "client.h" } +#include "Client.hxx" + #include <glib.h> #include <assert.h> diff --git a/src/protocol/argparser.c b/src/protocol/ArgParser.cxx index b21d4c53c..a92809224 100644 --- a/src/protocol/argparser.c +++ b/src/protocol/ArgParser.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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,8 +18,8 @@ */ #include "config.h" -#include "argparser.h" -#include "result.h" +#include "ArgParser.hxx" +#include "Result.hxx" #include <glib.h> #include <stdlib.h> diff --git a/src/protocol/argparser.h b/src/protocol/ArgParser.hxx index e88aea478..73b046403 100644 --- a/src/protocol/argparser.h +++ b/src/protocol/ArgParser.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PROTOCOL_ARGPARSER_H -#define MPD_PROTOCOL_ARGPARSER_H +#ifndef MPD_PROTOCOL_ARGPARSER_HXX +#define MPD_PROTOCOL_ARGPARSER_HXX #include "check.h" diff --git a/src/protocol/result.c b/src/protocol/Result.cxx index 30cd0a266..f38c33815 100644 --- a/src/protocol/result.c +++ b/src/protocol/Result.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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,8 +18,8 @@ */ #include "config.h" -#include "result.h" -#include "client.h" +#include "Result.hxx" +#include "Client.hxx" #include <assert.h> diff --git a/src/protocol/result.h b/src/protocol/Result.hxx index 09ea6c418..68cb84945 100644 --- a/src/protocol/result.h +++ b/src/protocol/Result.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2012 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 @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef MPD_PROTOCOL_RESULT_H -#define MPD_PROTOCOL_RESULT_H +#ifndef MPD_PROTOCOL_RESULT_HXX +#define MPD_PROTOCOL_RESULT_HXX #include "check.h" #include "gcc.h" |