From 7a982169c9dc3a673e922e7f3b9b73368cef0aae Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 3 Jan 2013 17:27:26 +0100 Subject: Client: rename the struct client to class Client --- src/AllCommands.cxx | 16 ++++++++-------- src/AllCommands.hxx | 4 ++-- src/Client.cxx | 8 ++++---- src/Client.hxx | 18 +++++++++--------- src/ClientEvent.cxx | 4 ++-- src/ClientExpire.cxx | 4 ++-- src/ClientFile.cxx | 2 +- src/ClientFile.hxx | 4 ++-- src/ClientGlobal.cxx | 2 +- src/ClientIdle.cxx | 8 ++++---- src/ClientIdle.hxx | 6 +++--- src/ClientInternal.hxx | 23 ++++++++++++----------- src/ClientList.cxx | 8 ++++---- src/ClientNew.cxx | 6 +++--- src/ClientProcess.cxx | 4 ++-- src/ClientRead.cxx | 6 +++--- src/ClientSubscribe.cxx | 12 ++++++------ src/ClientSubscribe.hxx | 12 ++++++------ src/ClientWrite.cxx | 27 ++++++++++++++++----------- src/CommandError.cxx | 4 ++-- src/CommandError.hxx | 6 ++++-- src/DatabaseCommands.cxx | 24 ++++++++++++------------ src/DatabaseCommands.hxx | 22 ++++++++++++---------- src/DatabasePrint.cxx | 28 ++++++++++++++-------------- src/DatabasePrint.hxx | 12 ++++++------ src/DecoderPrint.cxx | 4 ++-- src/DecoderPrint.hxx | 4 ++-- src/MessageCommands.cxx | 14 +++++++------- src/MessageCommands.hxx | 12 +++++++----- src/OtherCommands.cxx | 30 +++++++++++++++--------------- src/OtherCommands.hxx | 30 ++++++++++++++++-------------- src/OutputCommands.cxx | 6 +++--- src/OutputCommands.hxx | 8 +++++--- src/OutputPrint.cxx | 2 +- src/OutputPrint.hxx | 4 ++-- src/PlayerCommands.cxx | 42 +++++++++++++++++++++--------------------- src/PlayerCommands.hxx | 44 +++++++++++++++++++++++--------------------- src/PlaylistCommands.cxx | 24 ++++++++++++------------ src/PlaylistCommands.hxx | 24 +++++++++++++----------- src/PlaylistPrint.cxx | 22 +++++++++++----------- src/PlaylistPrint.hxx | 20 ++++++++++---------- src/QueueCommands.cxx | 40 ++++++++++++++++++++-------------------- src/QueueCommands.hxx | 40 +++++++++++++++++++++------------------- src/QueuePrint.cxx | 12 ++++++------ src/QueuePrint.hxx | 12 ++++++------ src/SongPrint.cxx | 4 ++-- src/SongPrint.hxx | 6 +++--- src/Stats.cxx | 2 +- src/StickerCommands.cxx | 6 +++--- src/StickerCommands.hxx | 4 +++- src/StickerPrint.cxx | 6 +++--- src/StickerPrint.hxx | 7 +++---- src/TagPrint.cxx | 4 ++-- src/TagPrint.hxx | 6 +++--- src/TimePrint.cxx | 2 +- src/TimePrint.hxx | 4 ++-- src/ls.cxx | 2 +- src/ls.hxx | 5 ++--- src/protocol/ArgParser.cxx | 12 ++++++------ src/protocol/ArgParser.hxx | 14 +++++++------- src/protocol/Result.cxx | 6 +++--- src/protocol/Result.hxx | 8 ++++---- src/stats.h | 4 ++-- 63 files changed, 394 insertions(+), 372 deletions(-) diff --git a/src/AllCommands.cxx b/src/AllCommands.cxx index d7ea8d60c..58dcf4dba 100644 --- a/src/AllCommands.cxx +++ b/src/AllCommands.cxx @@ -58,16 +58,16 @@ struct command { unsigned permission; int min; int max; - enum command_return (*handler)(struct client *client, int argc, char **argv); + enum command_return (*handler)(Client *client, int argc, char **argv); }; /* don't be fooled, this is the command handler for "commands" command */ static enum command_return -handle_commands(struct client *client, +handle_commands(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]); static enum command_return -handle_not_commands(struct client *client, +handle_not_commands(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]); /** @@ -182,7 +182,7 @@ command_available(G_GNUC_UNUSED const struct command *cmd) /* don't be fooled, this is the command handler for "commands" command */ static enum command_return -handle_commands(struct client *client, +handle_commands(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { const unsigned permission = client_get_permission(client); @@ -200,7 +200,7 @@ handle_commands(struct client *client, } static enum command_return -handle_not_commands(struct client *client, +handle_not_commands(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { const unsigned permission = client_get_permission(client); @@ -252,7 +252,7 @@ command_lookup(const char *name) } static bool -command_check_request(const struct command *cmd, struct client *client, +command_check_request(const struct command *cmd, Client *client, unsigned permission, int argc, char *argv[]) { int min = cmd->min + 1; @@ -290,7 +290,7 @@ command_check_request(const struct command *cmd, struct client *client, } static const struct command * -command_checked_lookup(struct client *client, unsigned permission, +command_checked_lookup(Client *client, unsigned permission, int argc, char *argv[]) { const struct command *cmd; @@ -317,7 +317,7 @@ command_checked_lookup(struct client *client, unsigned permission, } enum command_return -command_process(struct client *client, unsigned num, char *line) +command_process(Client *client, unsigned num, char *line) { GError *error = NULL; int argc; diff --git a/src/AllCommands.hxx b/src/AllCommands.hxx index 9a0b45568..a55eb5a3b 100644 --- a/src/AllCommands.hxx +++ b/src/AllCommands.hxx @@ -22,13 +22,13 @@ #include "command.h" -struct client; +class Client; void command_init(void); void command_finish(void); enum command_return -command_process(struct client *client, unsigned num, char *line); +command_process(Client *client, unsigned num, char *line); #endif diff --git a/src/Client.cxx b/src/Client.cxx index 5214eabba..efb4125ac 100644 --- a/src/Client.cxx +++ b/src/Client.cxx @@ -20,22 +20,22 @@ #include "config.h" #include "ClientInternal.hxx" -bool client_is_expired(const struct client *client) +bool client_is_expired(const Client *client) { return client->channel == NULL; } -int client_get_uid(const struct client *client) +int client_get_uid(const Client *client) { return client->uid; } -unsigned client_get_permission(const struct client *client) +unsigned client_get_permission(const Client *client) { return client->permission; } -void client_set_permission(struct client *client, unsigned permission) +void client_set_permission(Client *client, unsigned permission) { client->permission = permission; } diff --git a/src/Client.hxx b/src/Client.hxx index 51ad1eb2a..622815a56 100644 --- a/src/Client.hxx +++ b/src/Client.hxx @@ -26,9 +26,9 @@ #include #include -struct client; struct sockaddr; struct player_control; +class Client; void client_manager_init(void); void client_manager_deinit(void); @@ -37,14 +37,14 @@ void client_new(struct player_control *player_control, int fd, const struct sockaddr *sa, size_t sa_length, int uid); gcc_pure -bool client_is_expired(const struct client *client); +bool client_is_expired(const Client *client); /** * returns the uid of the client process, or a negative value if the * uid is unknown */ gcc_pure -int client_get_uid(const struct client *client); +int client_get_uid(const Client *client); /** * Is this client running on the same machine, connected with a local @@ -52,31 +52,31 @@ int client_get_uid(const struct client *client); */ gcc_pure static inline bool -client_is_local(const struct client *client) +client_is_local(const Client *client) { return client_get_uid(client) > 0; } gcc_pure -unsigned client_get_permission(const struct client *client); +unsigned client_get_permission(const Client *client); -void client_set_permission(struct client *client, unsigned permission); +void client_set_permission(Client *client, unsigned permission); /** * Write a C string to the client. */ -void client_puts(struct client *client, const char *s); +void client_puts(Client *client, const char *s); /** * Write a printf-like formatted string to the client. */ -void client_vprintf(struct client *client, const char *fmt, va_list args); +void client_vprintf(Client *client, const char *fmt, va_list args); /** * Write a printf-like formatted string to the client. */ gcc_fprintf void -client_printf(struct client *client, const char *fmt, ...); +client_printf(Client *client, const char *fmt, ...); #endif diff --git a/src/ClientEvent.cxx b/src/ClientEvent.cxx index 0276ea746..aacd01cfe 100644 --- a/src/ClientEvent.cxx +++ b/src/ClientEvent.cxx @@ -27,7 +27,7 @@ static gboolean client_out_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, gpointer data) { - struct client *client = (struct client *)data; + Client *client = (Client *)data; assert(!client_is_expired(client)); @@ -62,7 +62,7 @@ gboolean client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition, gpointer data) { - struct client *client = (struct client *)data; + Client *client = (Client *)data; enum command_return ret; assert(!client_is_expired(client)); diff --git a/src/ClientExpire.cxx b/src/ClientExpire.cxx index b02e2c8bb..e24770ea1 100644 --- a/src/ClientExpire.cxx +++ b/src/ClientExpire.cxx @@ -23,7 +23,7 @@ static guint expire_source_id; void -client_set_expired(struct client *client) +client_set_expired(Client *client) { if (!client_is_expired(client)) client_schedule_expire(); @@ -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 = (struct client *)data; + Client *client = (Client *)data; if (client_is_expired(client)) { g_debug("[%u] expired", client->num); diff --git a/src/ClientFile.cxx b/src/ClientFile.cxx index d06b1a03c..ca5acb229 100644 --- a/src/ClientFile.cxx +++ b/src/ClientFile.cxx @@ -28,7 +28,7 @@ #include bool -client_allow_file(const struct client *client, const char *path_fs, +client_allow_file(const Client *client, const char *path_fs, GError **error_r) { #ifdef WIN32 diff --git a/src/ClientFile.hxx b/src/ClientFile.hxx index a3d0ed484..48e00c44f 100644 --- a/src/ClientFile.hxx +++ b/src/ClientFile.hxx @@ -24,7 +24,7 @@ #include -struct client; +class Client; /** * Is this client allowed to use the specified local file? @@ -37,7 +37,7 @@ struct client; * @return true if access is allowed */ bool -client_allow_file(const struct client *client, const char *path_fs, +client_allow_file(const Client *client, const char *path_fs, GError **error_r); #endif diff --git a/src/ClientGlobal.cxx b/src/ClientGlobal.cxx index e51eeb949..10c78f1f1 100644 --- a/src/ClientGlobal.cxx +++ b/src/ClientGlobal.cxx @@ -58,7 +58,7 @@ void client_manager_init(void) static void client_close_all(void) { while (!client_list_is_empty()) { - struct client *client = client_list_get_first(); + Client *client = client_list_get_first(); client_close(client); } diff --git a/src/ClientIdle.cxx b/src/ClientIdle.cxx index 7812c544c..c2fa5dde5 100644 --- a/src/ClientIdle.cxx +++ b/src/ClientIdle.cxx @@ -31,7 +31,7 @@ extern "C" { * Send "idle" response to this client. */ static void -client_idle_notify(struct client *client) +client_idle_notify(Client *client) { unsigned flags, i; const char *const* idle_names; @@ -55,7 +55,7 @@ client_idle_notify(struct client *client) } void -client_idle_add(struct client *client, unsigned flags) +client_idle_add(Client *client, unsigned flags) { if (client_is_expired(client)) return; @@ -71,7 +71,7 @@ client_idle_add(struct client *client, unsigned flags) static void client_idle_callback(gpointer data, gpointer user_data) { - struct client *client = (struct client *)data; + Client *client = (Client *)data; unsigned flags = GPOINTER_TO_UINT(user_data); client_idle_add(client, flags); @@ -84,7 +84,7 @@ void client_manager_idle_add(unsigned flags) client_list_foreach(client_idle_callback, GUINT_TO_POINTER(flags)); } -bool client_idle_wait(struct client *client, unsigned flags) +bool client_idle_wait(Client *client, unsigned flags) { assert(!client->idle_waiting); diff --git a/src/ClientIdle.hxx b/src/ClientIdle.hxx index 8c335b1e3..a8c08b7aa 100644 --- a/src/ClientIdle.hxx +++ b/src/ClientIdle.hxx @@ -20,10 +20,10 @@ #ifndef MPD_CLIENT_IDLE_HXX #define MPD_CLIENT_IDLE_HXX -struct client; +class Client; void -client_idle_add(struct client *client, unsigned flags); +client_idle_add(Client *client, unsigned flags); /** * Adds the specified idle flags to all clients and immediately sends @@ -38,6 +38,6 @@ client_manager_idle_add(unsigned flags); * client into waiting mode and returns false. */ bool -client_idle_wait(struct client *client, unsigned flags); +client_idle_wait(Client *client, unsigned flags); #endif diff --git a/src/ClientInternal.hxx b/src/ClientInternal.hxx index 4252b5349..ac50a3e99 100644 --- a/src/ClientInternal.hxx +++ b/src/ClientInternal.hxx @@ -39,7 +39,8 @@ struct deferred_buffer { char data[sizeof(long)]; }; -struct client { +class Client { +public: struct player_control *player_control; GIOChannel *channel; @@ -112,23 +113,23 @@ client_list_is_empty(void); bool client_list_is_full(void); -struct client * +Client * client_list_get_first(void); void -client_list_add(struct client *client); +client_list_add(Client *client); void client_list_foreach(GFunc func, gpointer user_data); void -client_list_remove(struct client *client); +client_list_remove(Client *client); void -client_close(struct client *client); +client_close(Client *client); static inline void -new_cmd_list_ptr(struct client *client, const char *s) +new_cmd_list_ptr(Client *client, const char *s) { client->cmd_list = g_slist_prepend(client->cmd_list, g_strdup(s)); } @@ -143,7 +144,7 @@ free_cmd_list(GSList *list) } void -client_set_expired(struct client *client); +client_set_expired(Client *client); /** * Schedule an "expired" check for all clients: permanently delete @@ -159,16 +160,16 @@ void client_deinit_expire(void); enum command_return -client_read(struct client *client); +client_read(Client *client); enum command_return -client_process_line(struct client *client, char *line); +client_process_line(Client *client, char *line); void -client_write_deferred(struct client *client); +client_write_deferred(Client *client); void -client_write_output(struct client *client); +client_write_output(Client *client); gboolean client_in_event(GIOChannel *source, GIOCondition condition, diff --git a/src/ClientList.cxx b/src/ClientList.cxx index 0e4876f85..e0fa533d9 100644 --- a/src/ClientList.cxx +++ b/src/ClientList.cxx @@ -37,16 +37,16 @@ client_list_is_full(void) return num_clients >= client_max_connections; } -struct client * +Client * client_list_get_first(void) { assert(clients != NULL); - return (struct client *)clients->data; + return (Client *)clients->data; } void -client_list_add(struct client *client) +client_list_add(Client *client) { clients = g_list_prepend(clients, client); ++num_clients; @@ -59,7 +59,7 @@ client_list_foreach(GFunc func, gpointer user_data) } void -client_list_remove(struct client *client) +client_list_remove(Client *client) { assert(num_clients > 0); assert(clients != NULL); diff --git a/src/ClientNew.cxx b/src/ClientNew.cxx index bccabede9..5830a728e 100644 --- a/src/ClientNew.cxx +++ b/src/ClientNew.cxx @@ -50,7 +50,7 @@ client_new(struct player_control *player_control, int fd, const struct sockaddr *sa, size_t sa_length, int uid) { static unsigned int next_client_num; - struct client *client; + Client *client; char *remote; assert(player_control != NULL); @@ -87,7 +87,7 @@ client_new(struct player_control *player_control, return; } - client = g_new0(struct client, 1); + client = g_new0(Client, 1); client->player_control = player_control; client->channel = g_io_channel_new_socket(fd); @@ -143,7 +143,7 @@ deferred_buffer_free(gpointer data, G_GNUC_UNUSED gpointer user_data) } void -client_close(struct client *client) +client_close(Client *client) { client_list_remove(client); diff --git a/src/ClientProcess.cxx b/src/ClientProcess.cxx index 284c4d862..bbc19321e 100644 --- a/src/ClientProcess.cxx +++ b/src/ClientProcess.cxx @@ -29,7 +29,7 @@ #define CLIENT_LIST_MODE_END "command_list_end" static enum command_return -client_process_command_list(struct client *client, bool list_ok, GSList *list) +client_process_command_list(Client *client, bool list_ok, GSList *list) { enum command_return ret = COMMAND_RETURN_OK; unsigned num = 0; @@ -51,7 +51,7 @@ client_process_command_list(struct client *client, bool list_ok, GSList *list) } enum command_return -client_process_line(struct client *client, char *line) +client_process_line(Client *client, char *line) { enum command_return ret; diff --git a/src/ClientRead.cxx b/src/ClientRead.cxx index 830820dea..aab4cae33 100644 --- a/src/ClientRead.cxx +++ b/src/ClientRead.cxx @@ -28,7 +28,7 @@ extern "C" { #include static char * -client_read_line(struct client *client) +client_read_line(Client *client) { size_t length; const char *p = (const char *)fifo_buffer_read(client->input, &length); @@ -46,7 +46,7 @@ client_read_line(struct client *client) } static enum command_return -client_input_received(struct client *client, size_t bytesRead) +client_input_received(Client *client, size_t bytesRead) { char *line; @@ -69,7 +69,7 @@ client_input_received(struct client *client, size_t bytesRead) } enum command_return -client_read(struct client *client) +client_read(Client *client) { GError *error = NULL; GIOStatus status; diff --git a/src/ClientSubscribe.cxx b/src/ClientSubscribe.cxx index 38440be7b..31987c6a0 100644 --- a/src/ClientSubscribe.cxx +++ b/src/ClientSubscribe.cxx @@ -29,7 +29,7 @@ extern "C" { G_GNUC_PURE static GSList * -client_find_subscription(const struct client *client, const char *channel) +client_find_subscription(const Client *client, const char *channel) { for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i)) if (strcmp((const char *)i->data, channel) == 0) @@ -39,7 +39,7 @@ client_find_subscription(const struct client *client, const char *channel) } enum client_subscribe_result -client_subscribe(struct client *client, const char *channel) +client_subscribe(Client *client, const char *channel) { assert(client != NULL); assert(channel != NULL); @@ -63,7 +63,7 @@ client_subscribe(struct client *client, const char *channel) } bool -client_unsubscribe(struct client *client, const char *channel) +client_unsubscribe(Client *client, const char *channel) { GSList *i = client_find_subscription(client, channel); if (i == NULL) @@ -83,7 +83,7 @@ client_unsubscribe(struct client *client, const char *channel) } void -client_unsubscribe_all(struct client *client) +client_unsubscribe_all(Client *client) { for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i)) g_free(i->data); @@ -94,7 +94,7 @@ client_unsubscribe_all(struct client *client) } bool -client_push_message(struct client *client, const struct client_message *msg) +client_push_message(Client *client, const struct client_message *msg) { assert(client != NULL); assert(msg != NULL); @@ -115,7 +115,7 @@ client_push_message(struct client *client, const struct client_message *msg) } GSList * -client_read_messages(struct client *client) +client_read_messages(Client *client) { GSList *messages = g_slist_reverse(client->messages); diff --git a/src/ClientSubscribe.hxx b/src/ClientSubscribe.hxx index 2f0f73291..9b62374a9 100644 --- a/src/ClientSubscribe.hxx +++ b/src/ClientSubscribe.hxx @@ -23,7 +23,7 @@ #include "gcc.h" typedef struct _GSList GSList; -struct client; +class Client; struct client_message; enum client_subscribe_result { @@ -41,19 +41,19 @@ enum client_subscribe_result { }; enum client_subscribe_result -client_subscribe(struct client *client, const char *channel); +client_subscribe(Client *client, const char *channel); bool -client_unsubscribe(struct client *client, const char *channel); +client_unsubscribe(Client *client, const char *channel); void -client_unsubscribe_all(struct client *client); +client_unsubscribe_all(Client *client); bool -client_push_message(struct client *client, const struct client_message *msg); +client_push_message(Client *client, const struct client_message *msg); gcc_malloc GSList * -client_read_messages(struct client *client); +client_read_messages(Client *client); #endif diff --git a/src/ClientWrite.cxx b/src/ClientWrite.cxx index dccd256ff..825029fb9 100644 --- a/src/ClientWrite.cxx +++ b/src/ClientWrite.cxx @@ -25,7 +25,7 @@ #include static size_t -client_write_deferred_buffer(struct client *client, +client_write_deferred_buffer(Client *client, const struct deferred_buffer *buffer) { GError *error = NULL; @@ -67,7 +67,7 @@ client_write_deferred_buffer(struct client *client, } void -client_write_deferred(struct client *client) +client_write_deferred(Client *client) { size_t ret; @@ -109,8 +109,8 @@ client_write_deferred(struct client *client) } } -static void client_defer_output(struct client *client, - const void *data, size_t length) +static void +client_defer_output(Client *client, const void *data, size_t length) { size_t alloc; struct deferred_buffer *buf; @@ -137,8 +137,8 @@ static void client_defer_output(struct client *client, g_queue_push_tail(client->deferred_send, buf); } -static void client_write_direct(struct client *client, - const char *data, size_t length) +static void +client_write_direct(Client *client, const char *data, size_t length) { GError *error = NULL; GIOStatus status; @@ -182,7 +182,7 @@ static void client_write_direct(struct client *client, } void -client_write_output(struct client *client) +client_write_output(Client *client) { if (client_is_expired(client) || !client->send_buf_used) return; @@ -212,7 +212,8 @@ client_write_output(struct client *client) /** * Write a block of data to the client. */ -static void client_write(struct client *client, const char *buffer, size_t buflen) +static void +client_write(Client *client, const char *buffer, size_t buflen) { /* if the client is going to be closed, do nothing */ if (client_is_expired(client)) @@ -237,12 +238,14 @@ static void client_write(struct client *client, const char *buffer, size_t bufle } } -void client_puts(struct client *client, const char *s) +void +client_puts(Client *client, const char *s) { client_write(client, s, strlen(s)); } -void client_vprintf(struct client *client, const char *fmt, va_list args) +void +client_vprintf(Client *client, const char *fmt, va_list args) { #ifndef G_OS_WIN32 va_list tmp; @@ -274,7 +277,9 @@ void client_vprintf(struct client *client, const char *fmt, va_list args) #endif } -G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...) +G_GNUC_PRINTF(2, 3) +void +client_printf(Client *client, const char *fmt, ...) { va_list args; diff --git a/src/CommandError.cxx b/src/CommandError.cxx index 04de35e83..7e777d82a 100644 --- a/src/CommandError.cxx +++ b/src/CommandError.cxx @@ -27,7 +27,7 @@ #include enum command_return -print_playlist_result(struct client *client, enum playlist_result result) +print_playlist_result(Client *client, enum playlist_result result) { switch (result) { case PLAYLIST_RESULT_SUCCESS: @@ -89,7 +89,7 @@ print_playlist_result(struct client *client, enum playlist_result result) * Send the GError to the client and free the GError. */ enum command_return -print_error(struct client *client, GError *error) +print_error(Client *client, GError *error) { assert(client != NULL); assert(error != NULL); diff --git a/src/CommandError.hxx b/src/CommandError.hxx index a90e24427..739e982e9 100644 --- a/src/CommandError.hxx +++ b/src/CommandError.hxx @@ -25,13 +25,15 @@ #include +class Client; + enum command_return -print_playlist_result(struct client *client, enum playlist_result result); +print_playlist_result(Client *client, enum playlist_result result); /** * Send the GError to the client and free the GError. */ enum command_return -print_error(struct client *client, GError *error); +print_error(Client *client, GError *error); #endif diff --git a/src/DatabaseCommands.cxx b/src/DatabaseCommands.cxx index c0f02ad24..4e636a33f 100644 --- a/src/DatabaseCommands.cxx +++ b/src/DatabaseCommands.cxx @@ -34,7 +34,7 @@ #include enum command_return -handle_lsinfo2(struct client *client, int argc, char *argv[]) +handle_lsinfo2(Client *client, int argc, char *argv[]) { const char *uri; @@ -54,7 +54,7 @@ handle_lsinfo2(struct client *client, int argc, char *argv[]) } static enum command_return -handle_match(struct client *client, int argc, char *argv[], bool fold_case) +handle_match(Client *client, int argc, char *argv[], bool fold_case) { SongFilter filter; if (!filter.Parse(argc - 1, argv + 1, fold_case)) { @@ -71,19 +71,19 @@ handle_match(struct client *client, int argc, char *argv[], bool fold_case) } enum command_return -handle_find(struct client *client, int argc, char *argv[]) +handle_find(Client *client, int argc, char *argv[]) { return handle_match(client, argc, argv, false); } enum command_return -handle_search(struct client *client, int argc, char *argv[]) +handle_search(Client *client, int argc, char *argv[]) { return handle_match(client, argc, argv, true); } static enum command_return -handle_match_add(struct client *client, int argc, char *argv[], bool fold_case) +handle_match_add(Client *client, int argc, char *argv[], bool fold_case) { SongFilter filter; if (!filter.Parse(argc - 1, argv + 1, fold_case)) { @@ -98,19 +98,19 @@ handle_match_add(struct client *client, int argc, char *argv[], bool fold_case) } enum command_return -handle_findadd(struct client *client, int argc, char *argv[]) +handle_findadd(Client *client, int argc, char *argv[]) { return handle_match_add(client, argc, argv, false); } enum command_return -handle_searchadd(struct client *client, int argc, char *argv[]) +handle_searchadd(Client *client, int argc, char *argv[]) { return handle_match_add(client, argc, argv, true); } enum command_return -handle_searchaddpl(struct client *client, int argc, char *argv[]) +handle_searchaddpl(Client *client, int argc, char *argv[]) { const char *playlist = argv[1]; @@ -127,7 +127,7 @@ handle_searchaddpl(struct client *client, int argc, char *argv[]) } enum command_return -handle_count(struct client *client, int argc, char *argv[]) +handle_count(Client *client, int argc, char *argv[]) { SongFilter filter; if (!filter.Parse(argc - 1, argv + 1, false)) { @@ -142,7 +142,7 @@ handle_count(struct client *client, int argc, char *argv[]) } enum command_return -handle_listall(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_listall(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { const char *directory = ""; @@ -156,7 +156,7 @@ handle_listall(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_list(struct client *client, int argc, char *argv[]) +handle_list(Client *client, int argc, char *argv[]) { unsigned tagType = locate_parse_type(argv[1]); @@ -205,7 +205,7 @@ handle_list(struct client *client, int argc, char *argv[]) } enum command_return -handle_listallinfo(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_listallinfo(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { const char *directory = ""; diff --git a/src/DatabaseCommands.hxx b/src/DatabaseCommands.hxx index 2b93faf4a..335adc4d6 100644 --- a/src/DatabaseCommands.hxx +++ b/src/DatabaseCommands.hxx @@ -22,34 +22,36 @@ #include "command.h" +class Client; + enum command_return -handle_lsinfo2(struct client *client, int argc, char *argv[]); +handle_lsinfo2(Client *client, int argc, char *argv[]); enum command_return -handle_find(struct client *client, int argc, char *argv[]); +handle_find(Client *client, int argc, char *argv[]); enum command_return -handle_findadd(struct client *client, int argc, char *argv[]); +handle_findadd(Client *client, int argc, char *argv[]); enum command_return -handle_search(struct client *client, int argc, char *argv[]); +handle_search(Client *client, int argc, char *argv[]); enum command_return -handle_searchadd(struct client *client, int argc, char *argv[]); +handle_searchadd(Client *client, int argc, char *argv[]); enum command_return -handle_searchaddpl(struct client *client, int argc, char *argv[]); +handle_searchaddpl(Client *client, int argc, char *argv[]); enum command_return -handle_count(struct client *client, int argc, char *argv[]); +handle_count(Client *client, int argc, char *argv[]); enum command_return -handle_listall(struct client *client, int argc, char *argv[]); +handle_listall(Client *client, int argc, char *argv[]); enum command_return -handle_list(struct client *client, int argc, char *argv[]); +handle_list(Client *client, int argc, char *argv[]); enum command_return -handle_listallinfo(struct client *client, int argc, char *argv[]); +handle_listallinfo(Client *client, int argc, char *argv[]); #endif diff --git a/src/DatabasePrint.cxx b/src/DatabasePrint.cxx index 7ac670def..2c3fcc9f8 100644 --- a/src/DatabasePrint.cxx +++ b/src/DatabasePrint.cxx @@ -38,7 +38,7 @@ extern "C" { #include static bool -PrintDirectory(struct client *client, const Directory &directory) +PrintDirectory(Client *client, const Directory &directory) { if (!directory.IsRoot()) client_printf(client, "directory: %s\n", directory.GetPath()); @@ -47,7 +47,7 @@ PrintDirectory(struct client *client, const Directory &directory) } static void -print_playlist_in_directory(struct client *client, +print_playlist_in_directory(Client *client, const Directory &directory, const char *name_utf8) { @@ -59,7 +59,7 @@ print_playlist_in_directory(struct client *client, } static bool -PrintSongBrief(struct client *client, song &song) +PrintSongBrief(Client *client, song &song) { assert(song.parent != NULL); @@ -73,7 +73,7 @@ PrintSongBrief(struct client *client, song &song) } static bool -PrintSongFull(struct client *client, song &song) +PrintSongFull(Client *client, song &song) { assert(song.parent != NULL); @@ -87,7 +87,7 @@ PrintSongFull(struct client *client, song &song) } static bool -PrintPlaylistBrief(struct client *client, +PrintPlaylistBrief(Client *client, const PlaylistInfo &playlist, const Directory &directory) { @@ -96,7 +96,7 @@ PrintPlaylistBrief(struct client *client, } static bool -PrintPlaylistFull(struct client *client, +PrintPlaylistFull(Client *client, const PlaylistInfo &playlist, const Directory &directory) { @@ -109,7 +109,7 @@ PrintPlaylistFull(struct client *client, } bool -db_selection_print(struct client *client, const DatabaseSelection &selection, +db_selection_print(Client *client, const DatabaseSelection &selection, bool full, GError **error_r) { const Database *db = GetDatabase(error_r); @@ -135,7 +135,7 @@ struct SearchStats { unsigned long playTime; }; -static void printSearchStats(struct client *client, SearchStats *stats) +static void printSearchStats(Client *client, SearchStats *stats) { client_printf(client, "songs: %i\n", stats->numberOfSongs); client_printf(client, "playtime: %li\n", stats->playTime); @@ -151,7 +151,7 @@ stats_visitor_song(SearchStats &stats, song &song) } bool -searchStatsForSongsIn(struct client *client, const char *name, +searchStatsForSongsIn(Client *client, const char *name, const SongFilter *filter, GError **error_r) { @@ -176,14 +176,14 @@ searchStatsForSongsIn(struct client *client, const char *name, } bool -printAllIn(struct client *client, const char *uri_utf8, GError **error_r) +printAllIn(Client *client, const char *uri_utf8, GError **error_r) { const DatabaseSelection selection(uri_utf8, true); return db_selection_print(client, selection, false, error_r); } bool -printInfoForAllIn(struct client *client, const char *uri_utf8, +printInfoForAllIn(Client *client, const char *uri_utf8, GError **error_r) { const DatabaseSelection selection(uri_utf8, true); @@ -191,7 +191,7 @@ printInfoForAllIn(struct client *client, const char *uri_utf8, } static bool -PrintSongURIVisitor(struct client *client, song &song) +PrintSongURIVisitor(Client *client, song &song) { song_print_uri(client, &song); @@ -199,7 +199,7 @@ PrintSongURIVisitor(struct client *client, song &song) } static bool -PrintUniqueTag(struct client *client, enum tag_type tag_type, +PrintUniqueTag(Client *client, enum tag_type tag_type, const char *value) { client_printf(client, "%s: %s\n", tag_item_names[tag_type], value); @@ -207,7 +207,7 @@ PrintUniqueTag(struct client *client, enum tag_type tag_type, } bool -listAllUniqueTags(struct client *client, int type, +listAllUniqueTags(Client *client, int type, const SongFilter *filter, GError **error_r) { diff --git a/src/DatabasePrint.hxx b/src/DatabasePrint.hxx index 413a923a3..68551b63c 100644 --- a/src/DatabasePrint.hxx +++ b/src/DatabasePrint.hxx @@ -23,34 +23,34 @@ #include "gcc.h" #include "gerror.h" -struct client; class SongFilter; struct DatabaseSelection; struct db_visitor; +class Client; gcc_nonnull(1) bool -db_selection_print(struct client *client, const DatabaseSelection &selection, +db_selection_print(Client *client, const DatabaseSelection &selection, bool full, GError **error_r); gcc_nonnull(1,2) bool -printAllIn(struct client *client, const char *uri_utf8, GError **error_r); +printAllIn(Client *client, const char *uri_utf8, GError **error_r); gcc_nonnull(1,2) bool -printInfoForAllIn(struct client *client, const char *uri_utf8, +printInfoForAllIn(Client *client, const char *uri_utf8, GError **error_r); gcc_nonnull(1,2) bool -searchStatsForSongsIn(struct client *client, const char *name, +searchStatsForSongsIn(Client *client, const char *name, const SongFilter *filter, GError **error_r); gcc_nonnull(1) bool -listAllUniqueTags(struct client *client, int type, +listAllUniqueTags(Client *client, int type, const SongFilter *filter, GError **error_r); diff --git a/src/DecoderPrint.cxx b/src/DecoderPrint.cxx index 5dabf3490..70c713e9c 100644 --- a/src/DecoderPrint.cxx +++ b/src/DecoderPrint.cxx @@ -26,7 +26,7 @@ #include static void -decoder_plugin_print(struct client *client, +decoder_plugin_print(Client *client, const struct decoder_plugin *plugin) { const char *const*p; @@ -46,7 +46,7 @@ decoder_plugin_print(struct client *client, } void -decoder_list_print(struct client *client) +decoder_list_print(Client *client) { decoder_plugins_for_each_enabled(plugin) decoder_plugin_print(client, plugin); diff --git a/src/DecoderPrint.hxx b/src/DecoderPrint.hxx index e6e14aef3..d94ba2cef 100644 --- a/src/DecoderPrint.hxx +++ b/src/DecoderPrint.hxx @@ -20,9 +20,9 @@ #ifndef MPD_DECODER_PRINT_HXX #define MPD_DECODER_PRINT_HXX -struct client; +class Client; void -decoder_list_print(struct client *client); +decoder_list_print(Client *client); #endif diff --git a/src/MessageCommands.cxx b/src/MessageCommands.cxx index ff22725fb..5be179027 100644 --- a/src/MessageCommands.cxx +++ b/src/MessageCommands.cxx @@ -30,7 +30,7 @@ #include enum command_return -handle_subscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_subscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { assert(argc == 2); @@ -59,7 +59,7 @@ handle_subscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_unsubscribe(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_unsubscribe(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { assert(argc == 2); @@ -81,7 +81,7 @@ collect_channels(gpointer data, gpointer user_data) { struct channels_context *context = (struct channels_context *)user_data; - const struct client *client = (const struct client *)data; + const Client *client = (const Client *)data; for (GSList *i = client->subscriptions; i != NULL; i = g_slist_next(i)) { @@ -92,7 +92,7 @@ collect_channels(gpointer data, gpointer user_data) } enum command_return -handle_channels(struct client *client, +handle_channels(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { assert(argc == 1); @@ -108,7 +108,7 @@ handle_channels(struct client *client, } enum command_return -handle_read_messages(struct client *client, +handle_read_messages(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { assert(argc == 1); @@ -139,14 +139,14 @@ send_message(gpointer data, gpointer user_data) { struct send_message_context *context = (struct send_message_context *)user_data; - struct client *client = (struct client *)data; + Client *client = (Client *)data; if (client_push_message(client, &context->msg)) context->sent = true; } enum command_return -handle_send_message(struct client *client, +handle_send_message(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { assert(argc == 3); diff --git a/src/MessageCommands.hxx b/src/MessageCommands.hxx index 111c06ff7..b10f3d8e8 100644 --- a/src/MessageCommands.hxx +++ b/src/MessageCommands.hxx @@ -22,19 +22,21 @@ #include "command.h" +class Client; + enum command_return -handle_subscribe(struct client *client, int argc, char *argv[]); +handle_subscribe(Client *client, int argc, char *argv[]); enum command_return -handle_unsubscribe(struct client *client, int argc, char *argv[]); +handle_unsubscribe(Client *client, int argc, char *argv[]); enum command_return -handle_channels(struct client *client, int argc, char *argv[]); +handle_channels(Client *client, int argc, char *argv[]); enum command_return -handle_read_messages(struct client *client, int argc, char *argv[]); +handle_read_messages(Client *client, int argc, char *argv[]); enum command_return -handle_send_message(struct client *client, int argc, char *argv[]); +handle_send_message(Client *client, int argc, char *argv[]); #endif diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index 7958b8711..32d51c42e 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -57,7 +57,7 @@ extern "C" { #include static void -print_spl_list(struct client *client, const PlaylistFileList &list) +print_spl_list(Client *client, const PlaylistFileList &list) { for (const auto &i : list) { client_printf(client, "playlist: %s\n", i.name.c_str()); @@ -68,7 +68,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list) } enum command_return -handle_urlhandlers(struct client *client, +handle_urlhandlers(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { if (client_is_local(client)) @@ -78,7 +78,7 @@ handle_urlhandlers(struct client *client, } enum command_return -handle_decoders(struct client *client, +handle_decoders(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { decoder_list_print(client); @@ -86,7 +86,7 @@ handle_decoders(struct client *client, } enum command_return -handle_tagtypes(struct client *client, +handle_tagtypes(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { tag_print_types(client); @@ -94,21 +94,21 @@ handle_tagtypes(struct client *client, } enum command_return -handle_kill(G_GNUC_UNUSED struct client *client, +handle_kill(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { return COMMAND_RETURN_KILL; } enum command_return -handle_close(G_GNUC_UNUSED struct client *client, +handle_close(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { return COMMAND_RETURN_CLOSE; } enum command_return -handle_lsinfo(struct client *client, int argc, char *argv[]) +handle_lsinfo(Client *client, int argc, char *argv[]) { const char *uri; @@ -151,7 +151,7 @@ handle_lsinfo(struct client *client, int argc, char *argv[]) } enum command_return -handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_update(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { const char *path = NULL; unsigned ret; @@ -182,7 +182,7 @@ handle_update(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_rescan(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { const char *path = NULL; unsigned ret; @@ -210,7 +210,7 @@ handle_rescan(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_setvol(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned level; bool success; @@ -234,7 +234,7 @@ handle_setvol(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_stats(struct client *client, +handle_stats(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { stats_print(client); @@ -242,14 +242,14 @@ handle_stats(struct client *client, } enum command_return -handle_ping(G_GNUC_UNUSED struct client *client, +handle_ping(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { return COMMAND_RETURN_OK; } enum command_return -handle_password(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_password(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned permission = 0; @@ -264,7 +264,7 @@ handle_password(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_config(struct client *client, +handle_config(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { if (!client_is_local(client)) { @@ -281,7 +281,7 @@ handle_config(struct client *client, } enum command_return -handle_idle(struct client *client, +handle_idle(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { unsigned flags = 0, j; diff --git a/src/OtherCommands.hxx b/src/OtherCommands.hxx index c4cc3ac22..564ad38e7 100644 --- a/src/OtherCommands.hxx +++ b/src/OtherCommands.hxx @@ -22,46 +22,48 @@ #include "command.h" +class Client; + enum command_return -handle_urlhandlers(struct client *client, int argc, char *argv[]); +handle_urlhandlers(Client *client, int argc, char *argv[]); enum command_return -handle_decoders(struct client *client, int argc, char *argv[]); +handle_decoders(Client *client, int argc, char *argv[]); enum command_return -handle_tagtypes(struct client *client, int argc, char *argv[]); +handle_tagtypes(Client *client, int argc, char *argv[]); enum command_return -handle_kill(struct client *client, int argc, char *argv[]); +handle_kill(Client *client, int argc, char *argv[]); enum command_return -handle_close(struct client *client, int argc, char *argv[]); +handle_close(Client *client, int argc, char *argv[]); enum command_return -handle_lsinfo(struct client *client, int argc, char *argv[]); +handle_lsinfo(Client *client, int argc, char *argv[]); enum command_return -handle_update(struct client *client, int argc, char *argv[]); +handle_update(Client *client, int argc, char *argv[]); enum command_return -handle_rescan(struct client *client, int argc, char *argv[]); +handle_rescan(Client *client, int argc, char *argv[]); enum command_return -handle_setvol(struct client *client, int argc, char *argv[]); +handle_setvol(Client *client, int argc, char *argv[]); enum command_return -handle_stats(struct client *client, int argc, char *argv[]); +handle_stats(Client *client, int argc, char *argv[]); enum command_return -handle_ping(struct client *client, int argc, char *argv[]); +handle_ping(Client *client, int argc, char *argv[]); enum command_return -handle_password(struct client *client, int argc, char *argv[]); +handle_password(Client *client, int argc, char *argv[]); enum command_return -handle_config(struct client *client, int argc, char *argv[]); +handle_config(Client *client, int argc, char *argv[]); enum command_return -handle_idle(struct client *client, int argc, char *argv[]); +handle_idle(Client *client, int argc, char *argv[]); #endif diff --git a/src/OutputCommands.cxx b/src/OutputCommands.cxx index 5903ac430..4dd689c4e 100644 --- a/src/OutputCommands.cxx +++ b/src/OutputCommands.cxx @@ -30,7 +30,7 @@ extern "C" { #include enum command_return -handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_enableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned device; bool ret; @@ -49,7 +49,7 @@ handle_enableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_disableoutput(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned device; bool ret; @@ -68,7 +68,7 @@ handle_disableoutput(struct client *client, G_GNUC_UNUSED int argc, char *argv[] } enum command_return -handle_devices(struct client *client, +handle_devices(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { printAudioDevices(client); diff --git a/src/OutputCommands.hxx b/src/OutputCommands.hxx index 1dc4c5ee6..4f7082bfb 100644 --- a/src/OutputCommands.hxx +++ b/src/OutputCommands.hxx @@ -22,13 +22,15 @@ #include "command.h" +class Client; + enum command_return -handle_enableoutput(struct client *client, int argc, char *argv[]); +handle_enableoutput(Client *client, int argc, char *argv[]); enum command_return -handle_disableoutput(struct client *client, int argc, char *argv[]); +handle_disableoutput(Client *client, int argc, char *argv[]); enum command_return -handle_devices(struct client *client, int argc, char *argv[]); +handle_devices(Client *client, int argc, char *argv[]); #endif diff --git a/src/OutputPrint.cxx b/src/OutputPrint.cxx index bf20fe794..ed4391547 100644 --- a/src/OutputPrint.cxx +++ b/src/OutputPrint.cxx @@ -32,7 +32,7 @@ extern "C" { } void -printAudioDevices(struct client *client) +printAudioDevices(Client *client) { const unsigned n = audio_output_count(); diff --git a/src/OutputPrint.hxx b/src/OutputPrint.hxx index 5be7fe79a..78717d0af 100644 --- a/src/OutputPrint.hxx +++ b/src/OutputPrint.hxx @@ -25,9 +25,9 @@ #ifndef MPD_OUTPUT_PRINT_HXX #define MPD_OUTPUT_PRINT_HXX -struct client; +class Client; void -printAudioDevices(struct client *client); +printAudioDevices(Client *client); #endif diff --git a/src/PlayerCommands.cxx b/src/PlayerCommands.cxx index e80bb04fa..e4b5c145f 100644 --- a/src/PlayerCommands.cxx +++ b/src/PlayerCommands.cxx @@ -56,7 +56,7 @@ extern "C" { #define COMMAND_STATUS_UPDATING_DB "updating_db" enum command_return -handle_play(struct client *client, int argc, char *argv[]) +handle_play(Client *client, int argc, char *argv[]) { int song = -1; enum playlist_result result; @@ -68,7 +68,7 @@ handle_play(struct client *client, int argc, char *argv[]) } enum command_return -handle_playid(struct client *client, int argc, char *argv[]) +handle_playid(Client *client, int argc, char *argv[]) { int id = -1; enum playlist_result result; @@ -81,7 +81,7 @@ handle_playid(struct client *client, int argc, char *argv[]) } enum command_return -handle_stop(G_GNUC_UNUSED struct client *client, +handle_stop(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { playlist_stop(&g_playlist, client->player_control); @@ -89,7 +89,7 @@ handle_stop(G_GNUC_UNUSED struct client *client, } enum command_return -handle_currentsong(struct client *client, +handle_currentsong(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { playlist_print_current(client, &g_playlist); @@ -97,7 +97,7 @@ handle_currentsong(struct client *client, } enum command_return -handle_pause(struct client *client, +handle_pause(Client *client, int argc, char *argv[]) { if (argc == 2) { @@ -113,7 +113,7 @@ handle_pause(struct client *client, } enum command_return -handle_status(struct client *client, +handle_status(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { const char *state = NULL; @@ -210,7 +210,7 @@ handle_status(struct client *client, } enum command_return -handle_next(G_GNUC_UNUSED struct client *client, +handle_next(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { /* single mode is not considered when this is user who @@ -225,7 +225,7 @@ handle_next(G_GNUC_UNUSED struct client *client, } enum command_return -handle_previous(G_GNUC_UNUSED struct client *client, +handle_previous(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { playlist_previous(&g_playlist, client->player_control); @@ -233,7 +233,7 @@ handle_previous(G_GNUC_UNUSED struct client *client, } enum command_return -handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_repeat(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -244,7 +244,7 @@ handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_single(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -255,7 +255,7 @@ handle_single(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_consume(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -266,7 +266,7 @@ handle_consume(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_random(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { bool status; if (!check_bool(client, &status, argv[1])) @@ -277,7 +277,7 @@ handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_clearerror(G_GNUC_UNUSED struct client *client, +handle_clearerror(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { pc_clear_error(client->player_control); @@ -285,7 +285,7 @@ handle_clearerror(G_GNUC_UNUSED struct client *client, } enum command_return -handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_seek(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned song, seek_time; enum playlist_result result; @@ -301,7 +301,7 @@ handle_seek(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_seekid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned id, seek_time; enum playlist_result result; @@ -317,7 +317,7 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_seekcur(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { const char *p = argv[1]; bool relative = *p == '+' || *p == '-'; @@ -332,7 +332,7 @@ handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_crossfade(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_crossfade(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned xfade_time; @@ -344,7 +344,7 @@ handle_crossfade(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_mixrampdb(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_mixrampdb(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { float db; @@ -356,7 +356,7 @@ handle_mixrampdb(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_mixrampdelay(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_mixrampdelay(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { float delay_secs; @@ -368,7 +368,7 @@ handle_mixrampdelay(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_replay_gain_mode(struct client *client, +handle_replay_gain_mode(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { if (!replay_gain_set_mode_string(argv[1])) { @@ -381,7 +381,7 @@ handle_replay_gain_mode(struct client *client, } enum command_return -handle_replay_gain_status(struct client *client, +handle_replay_gain_status(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { client_printf(client, "replay_gain_mode: %s\n", diff --git a/src/PlayerCommands.hxx b/src/PlayerCommands.hxx index 40a8a779a..a2fed5853 100644 --- a/src/PlayerCommands.hxx +++ b/src/PlayerCommands.hxx @@ -22,67 +22,69 @@ #include "command.h" +class Client; + enum command_return -handle_play(struct client *client, int argc, char *argv[]); +handle_play(Client *client, int argc, char *argv[]); enum command_return -handle_playid(struct client *client, int argc, char *argv[]); +handle_playid(Client *client, int argc, char *argv[]); enum command_return -handle_stop(struct client *client, int argc, char *argv[]); +handle_stop(Client *client, int argc, char *argv[]); enum command_return -handle_currentsong(struct client *client, int argc, char *argv[]); +handle_currentsong(Client *client, int argc, char *argv[]); enum command_return -handle_pause(struct client *client, int argc, char *argv[]); +handle_pause(Client *client, int argc, char *argv[]); enum command_return -handle_status(struct client *client, int argc, char *argv[]); +handle_status(Client *client, int argc, char *argv[]); enum command_return -handle_next(struct client *client, int argc, char *argv[]); +handle_next(Client *client, int argc, char *argv[]); enum command_return -handle_previous(struct client *client, int argc, char *avg[]); +handle_previous(Client *client, int argc, char *avg[]); enum command_return -handle_repeat(struct client *client, int argc, char *argv[]); +handle_repeat(Client *client, int argc, char *argv[]); enum command_return -handle_single(struct client *client, int argc, char *argv[]); +handle_single(Client *client, int argc, char *argv[]); enum command_return -handle_consume(struct client *client, int argc, char *argv[]); +handle_consume(Client *client, int argc, char *argv[]); enum command_return -handle_random(struct client *client, int argc, char *argv[]); +handle_random(Client *client, int argc, char *argv[]); enum command_return -handle_clearerror(struct client *client, int argc, char *argv[]); +handle_clearerror(Client *client, int argc, char *argv[]); enum command_return -handle_seek(struct client *client, int argc, char *argv[]); +handle_seek(Client *client, int argc, char *argv[]); enum command_return -handle_seekid(struct client *client, int argc, char *argv[]); +handle_seekid(Client *client, int argc, char *argv[]); enum command_return -handle_seekcur(struct client *client, int argc, char *argv[]); +handle_seekcur(Client *client, int argc, char *argv[]); enum command_return -handle_crossfade(struct client *client, int argc, char *argv[]); +handle_crossfade(Client *client, int argc, char *argv[]); enum command_return -handle_mixrampdb(struct client *client, int argc, char *argv[]); +handle_mixrampdb(Client *client, int argc, char *argv[]); enum command_return -handle_mixrampdelay(struct client *client, int argc, char *argv[]); +handle_mixrampdelay(Client *client, int argc, char *argv[]); enum command_return -handle_replay_gain_mode(struct client *client, int argc, char *argv[]); +handle_replay_gain_mode(Client *client, int argc, char *argv[]); enum command_return -handle_replay_gain_status(struct client *client, int argc, char *argv[]); +handle_replay_gain_status(Client *client, int argc, char *argv[]); #endif diff --git a/src/PlaylistCommands.cxx b/src/PlaylistCommands.cxx index db5f6859c..a684e4a3b 100644 --- a/src/PlaylistCommands.cxx +++ b/src/PlaylistCommands.cxx @@ -40,7 +40,7 @@ extern "C" { #include static void -print_spl_list(struct client *client, const PlaylistFileList &list) +print_spl_list(Client *client, const PlaylistFileList &list) { for (const auto &i : list) { client_printf(client, "playlist: %s\n", i.name.c_str()); @@ -51,7 +51,7 @@ print_spl_list(struct client *client, const PlaylistFileList &list) } enum command_return -handle_save(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_save(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { enum playlist_result result; @@ -60,7 +60,7 @@ handle_save(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_load(struct client *client, int argc, char *argv[]) +handle_load(Client *client, int argc, char *argv[]) { unsigned start_index, end_index; @@ -97,7 +97,7 @@ handle_load(struct client *client, int argc, char *argv[]) } enum command_return -handle_listplaylist(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_listplaylist(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { if (playlist_file_print(client, argv[1], false)) return COMMAND_RETURN_OK; @@ -109,7 +109,7 @@ handle_listplaylist(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_listplaylistinfo(struct client *client, +handle_listplaylistinfo(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { if (playlist_file_print(client, argv[1], true)) @@ -122,7 +122,7 @@ handle_listplaylistinfo(struct client *client, } enum command_return -handle_rm(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_rm(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { GError *error = NULL; return spl_delete(argv[1], &error) @@ -131,7 +131,7 @@ handle_rm(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_rename(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_rename(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { GError *error = NULL; return spl_rename(argv[1], argv[2], &error) @@ -140,7 +140,7 @@ handle_rename(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_playlistdelete(struct client *client, +handle_playlistdelete(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { char *playlist = argv[1]; unsigned from; @@ -155,7 +155,7 @@ handle_playlistdelete(struct client *client, } enum command_return -handle_playlistmove(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_playlistmove(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { char *playlist = argv[1]; unsigned from, to; @@ -172,7 +172,7 @@ handle_playlistmove(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_playlistclear(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { GError *error = NULL; return spl_clear(argv[1], &error) @@ -181,7 +181,7 @@ handle_playlistclear(struct client *client, G_GNUC_UNUSED int argc, char *argv[] } enum command_return -handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_playlistadd(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { char *playlist = argv[1]; char *uri = argv[2]; @@ -210,7 +210,7 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_listplaylists(struct client *client, +handle_listplaylists(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { GError *error = NULL; diff --git a/src/PlaylistCommands.hxx b/src/PlaylistCommands.hxx index 267ed5c95..067f428b6 100644 --- a/src/PlaylistCommands.hxx +++ b/src/PlaylistCommands.hxx @@ -22,37 +22,39 @@ #include "command.h" +class Client; + enum command_return -handle_save(struct client *client, int argc, char *argv[]); +handle_save(Client *client, int argc, char *argv[]); enum command_return -handle_load(struct client *client, int argc, char *argv[]); +handle_load(Client *client, int argc, char *argv[]); enum command_return -handle_listplaylist(struct client *client, int argc, char *argv[]); +handle_listplaylist(Client *client, int argc, char *argv[]); enum command_return -handle_listplaylistinfo(struct client *client, int argc, char *argv[]); +handle_listplaylistinfo(Client *client, int argc, char *argv[]); enum command_return -handle_rm(struct client *client, int argc, char *argv[]); +handle_rm(Client *client, int argc, char *argv[]); enum command_return -handle_rename(struct client *client, int argc, char *argv[]); +handle_rename(Client *client, int argc, char *argv[]); enum command_return -handle_playlistdelete(struct client *client, int argc, char *argv[]); +handle_playlistdelete(Client *client, int argc, char *argv[]); enum command_return -handle_playlistmove(struct client *client, int argc, char *argv[]); +handle_playlistmove(Client *client, int argc, char *argv[]); enum command_return -handle_playlistclear(struct client *client, int argc, char *argv[]); +handle_playlistclear(Client *client, int argc, char *argv[]); enum command_return -handle_playlistadd(struct client *client, int argc, char *argv[]); +handle_playlistadd(Client *client, int argc, char *argv[]); enum command_return -handle_listplaylists(struct client *client, int argc, char *argv[]); +handle_listplaylists(Client *client, int argc, char *argv[]); #endif diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx index 0a15d2091..de17ac2c8 100644 --- a/src/PlaylistPrint.cxx +++ b/src/PlaylistPrint.cxx @@ -37,7 +37,7 @@ extern "C" { } void -playlist_print_uris(struct client *client, const struct playlist *playlist) +playlist_print_uris(Client *client, const struct playlist *playlist) { const struct queue *queue = &playlist->queue; @@ -45,7 +45,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist) } bool -playlist_print_info(struct client *client, const struct playlist *playlist, +playlist_print_info(Client *client, const struct playlist *playlist, unsigned start, unsigned end) { const struct queue *queue = &playlist->queue; @@ -63,7 +63,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist, } bool -playlist_print_id(struct client *client, const struct playlist *playlist, +playlist_print_id(Client *client, const struct playlist *playlist, unsigned id) { const struct queue *queue = &playlist->queue; @@ -78,7 +78,7 @@ playlist_print_id(struct client *client, const struct playlist *playlist, } bool -playlist_print_current(struct client *client, const struct playlist *playlist) +playlist_print_current(Client *client, const struct playlist *playlist) { int current_position = playlist_get_current_song(playlist); @@ -91,14 +91,14 @@ playlist_print_current(struct client *client, const struct playlist *playlist) } void -playlist_print_find(struct client *client, const struct playlist *playlist, +playlist_print_find(Client *client, const struct playlist *playlist, const SongFilter &filter) { queue_find(client, &playlist->queue, filter); } void -playlist_print_changes_info(struct client *client, +playlist_print_changes_info(Client *client, const struct playlist *playlist, uint32_t version) { @@ -106,7 +106,7 @@ playlist_print_changes_info(struct client *client, } void -playlist_print_changes_position(struct client *client, +playlist_print_changes_position(Client *client, const struct playlist *playlist, uint32_t version) { @@ -114,7 +114,7 @@ playlist_print_changes_position(struct client *client, } static bool -PrintSongDetails(struct client *client, const char *uri_utf8) +PrintSongDetails(Client *client, const char *uri_utf8) { const Database *db = GetDatabase(nullptr); if (db == nullptr) @@ -130,7 +130,7 @@ PrintSongDetails(struct client *client, const char *uri_utf8) } bool -spl_print(struct client *client, const char *name_utf8, bool detail, +spl_print(Client *client, const char *name_utf8, bool detail, GError **error_r) { GError *error = NULL; @@ -150,7 +150,7 @@ spl_print(struct client *client, const char *name_utf8, bool detail, } static void -playlist_provider_print(struct client *client, const char *uri, +playlist_provider_print(Client *client, const char *uri, struct playlist_provider *playlist, bool detail) { struct song *song; @@ -173,7 +173,7 @@ playlist_provider_print(struct client *client, const char *uri, } bool -playlist_file_print(struct client *client, const char *uri, bool detail) +playlist_file_print(Client *client, const char *uri, bool detail) { GMutex *mutex = g_mutex_new(); GCond *cond = g_cond_new(); diff --git a/src/PlaylistPrint.hxx b/src/PlaylistPrint.hxx index 22db2fe02..588aeca85 100644 --- a/src/PlaylistPrint.hxx +++ b/src/PlaylistPrint.hxx @@ -23,15 +23,15 @@ #include #include -struct client; struct playlist; class SongFilter; +class Client; /** * Sends the whole playlist to the client, song URIs only. */ void -playlist_print_uris(struct client *client, const struct playlist *playlist); +playlist_print_uris(Client *client, const struct playlist *playlist); /** * Sends a range of the playlist to the client, including all known @@ -40,7 +40,7 @@ playlist_print_uris(struct client *client, const struct playlist *playlist); * This function however fails when the start offset is invalid. */ bool -playlist_print_info(struct client *client, const struct playlist *playlist, +playlist_print_info(Client *client, const struct playlist *playlist, unsigned start, unsigned end); /** @@ -49,7 +49,7 @@ playlist_print_info(struct client *client, const struct playlist *playlist, * @return true on suite, false if there is no such song */ bool -playlist_print_id(struct client *client, const struct playlist *playlist, +playlist_print_id(Client *client, const struct playlist *playlist, unsigned id); /** @@ -58,20 +58,20 @@ playlist_print_id(struct client *client, const struct playlist *playlist, * @return true on success, false if there is no current song */ bool -playlist_print_current(struct client *client, const struct playlist *playlist); +playlist_print_current(Client *client, const struct playlist *playlist); /** * Find songs in the playlist. */ void -playlist_print_find(struct client *client, const struct playlist *playlist, +playlist_print_find(Client *client, const struct playlist *playlist, const SongFilter &filter); /** * Print detailed changes since the specified playlist version. */ void -playlist_print_changes_info(struct client *client, +playlist_print_changes_info(Client *client, const struct playlist *playlist, uint32_t version); @@ -79,7 +79,7 @@ playlist_print_changes_info(struct client *client, * Print changes since the specified playlist version, position only. */ void -playlist_print_changes_position(struct client *client, +playlist_print_changes_position(Client *client, const struct playlist *playlist, uint32_t version); @@ -92,7 +92,7 @@ playlist_print_changes_position(struct client *client, * @return true on success, false if the playlist does not exist */ bool -spl_print(struct client *client, const char *name_utf8, bool detail, +spl_print(Client *client, const char *name_utf8, bool detail, GError **error_r); /** @@ -104,6 +104,6 @@ spl_print(struct client *client, const char *name_utf8, bool detail, * @return true on success, false if the playlist does not exist */ bool -playlist_file_print(struct client *client, const char *uri, bool detail); +playlist_file_print(Client *client, const char *uri, bool detail); #endif diff --git a/src/QueueCommands.cxx b/src/QueueCommands.cxx index dc73132e5..8a13075a5 100644 --- a/src/QueueCommands.cxx +++ b/src/QueueCommands.cxx @@ -37,7 +37,7 @@ extern "C" { #include enum command_return -handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_add(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { char *uri = argv[1]; enum playlist_result result; @@ -76,7 +76,7 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_addid(struct client *client, int argc, char *argv[]) +handle_addid(Client *client, int argc, char *argv[]) { char *uri = argv[1]; unsigned added_id; @@ -128,7 +128,7 @@ handle_addid(struct client *client, int argc, char *argv[]) } enum command_return -handle_delete(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_delete(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned start, end; enum playlist_result result; @@ -142,7 +142,7 @@ handle_delete(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_deleteid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_deleteid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned id; enum playlist_result result; @@ -155,7 +155,7 @@ handle_deleteid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_playlist(struct client *client, +handle_playlist(Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { playlist_print_uris(client, &g_playlist); @@ -163,7 +163,7 @@ handle_playlist(struct client *client, } enum command_return -handle_shuffle(G_GNUC_UNUSED struct client *client, +handle_shuffle(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { unsigned start = 0, end = queue_length(&g_playlist.queue); @@ -175,7 +175,7 @@ handle_shuffle(G_GNUC_UNUSED struct client *client, } enum command_return -handle_clear(G_GNUC_UNUSED struct client *client, +handle_clear(G_GNUC_UNUSED Client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { playlist_clear(&g_playlist, client->player_control); @@ -183,7 +183,7 @@ handle_clear(G_GNUC_UNUSED struct client *client, } enum command_return -handle_plchanges(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_plchanges(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { uint32_t version; @@ -195,7 +195,7 @@ handle_plchanges(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_plchangesposid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { uint32_t version; @@ -207,7 +207,7 @@ handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[ } enum command_return -handle_playlistinfo(struct client *client, int argc, char *argv[]) +handle_playlistinfo(Client *client, int argc, char *argv[]) { unsigned start = 0, end = G_MAXUINT; bool ret; @@ -224,7 +224,7 @@ handle_playlistinfo(struct client *client, int argc, char *argv[]) } enum command_return -handle_playlistid(struct client *client, int argc, char *argv[]) +handle_playlistid(Client *client, int argc, char *argv[]) { if (argc >= 2) { unsigned id; @@ -243,7 +243,7 @@ handle_playlistid(struct client *client, int argc, char *argv[]) } static enum command_return -handle_playlist_match(struct client *client, int argc, char *argv[], +handle_playlist_match(Client *client, int argc, char *argv[], bool fold_case) { SongFilter filter; @@ -257,19 +257,19 @@ handle_playlist_match(struct client *client, int argc, char *argv[], } enum command_return -handle_playlistfind(struct client *client, int argc, char *argv[]) +handle_playlistfind(Client *client, int argc, char *argv[]) { return handle_playlist_match(client, argc, argv, false); } enum command_return -handle_playlistsearch(struct client *client, int argc, char *argv[]) +handle_playlistsearch(Client *client, int argc, char *argv[]) { return handle_playlist_match(client, argc, argv, true); } enum command_return -handle_prio(struct client *client, int argc, char *argv[]) +handle_prio(Client *client, int argc, char *argv[]) { unsigned priority; @@ -301,7 +301,7 @@ handle_prio(struct client *client, int argc, char *argv[]) } enum command_return -handle_prioid(struct client *client, int argc, char *argv[]) +handle_prioid(Client *client, int argc, char *argv[]) { unsigned priority; @@ -331,7 +331,7 @@ handle_prioid(struct client *client, int argc, char *argv[]) } enum command_return -handle_move(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_move(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned start, end; int to; @@ -347,7 +347,7 @@ handle_move(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_moveid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_moveid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned id; int to; @@ -363,7 +363,7 @@ handle_moveid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_swap(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_swap(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned song1, song2; enum playlist_result result; @@ -378,7 +378,7 @@ handle_swap(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } enum command_return -handle_swapid(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +handle_swapid(Client *client, G_GNUC_UNUSED int argc, char *argv[]) { unsigned id1, id2; enum playlist_result result; diff --git a/src/QueueCommands.hxx b/src/QueueCommands.hxx index b28608f62..97b61e212 100644 --- a/src/QueueCommands.hxx +++ b/src/QueueCommands.hxx @@ -22,61 +22,63 @@ #include "command.h" +class Client; + enum command_return -handle_add(struct client *client, int argc, char *argv[]); +handle_add(Client *client, int argc, char *argv[]); enum command_return -handle_addid(struct client *client, int argc, char *argv[]); +handle_addid(Client *client, int argc, char *argv[]); enum command_return -handle_delete(struct client *client, int argc, char *argv[]); +handle_delete(Client *client, int argc, char *argv[]); enum command_return -handle_deleteid(struct client *client, int argc, char *argv[]); +handle_deleteid(Client *client, int argc, char *argv[]); enum command_return -handle_playlist(struct client *client, int argc, char *argv[]); +handle_playlist(Client *client, int argc, char *argv[]); enum command_return -handle_shuffle(struct client *client, int argc, char *argv[]); +handle_shuffle(Client *client, int argc, char *argv[]); enum command_return -handle_clear(struct client *client, int argc, char *argv[]); +handle_clear(Client *client, int argc, char *argv[]); enum command_return -handle_plchanges(struct client *client, int argc, char *argv[]); +handle_plchanges(Client *client, int argc, char *argv[]); enum command_return -handle_plchangesposid(struct client *client, int argc, char *argv[]); +handle_plchangesposid(Client *client, int argc, char *argv[]); enum command_return -handle_playlistinfo(struct client *client, int argc, char *argv[]); +handle_playlistinfo(Client *client, int argc, char *argv[]); enum command_return -handle_playlistid(struct client *client, int argc, char *argv[]); +handle_playlistid(Client *client, int argc, char *argv[]); enum command_return -handle_playlistfind(struct client *client, int argc, char *argv[]); +handle_playlistfind(Client *client, int argc, char *argv[]); enum command_return -handle_playlistsearch(struct client *client, int argc, char *argv[]); +handle_playlistsearch(Client *client, int argc, char *argv[]); enum command_return -handle_prio(struct client *client, int argc, char *argv[]); +handle_prio(Client *client, int argc, char *argv[]); enum command_return -handle_prioid(struct client *client, int argc, char *argv[]); +handle_prioid(Client *client, int argc, char *argv[]); enum command_return -handle_move(struct client *client, int argc, char *argv[]); +handle_move(Client *client, int argc, char *argv[]); enum command_return -handle_moveid(struct client *client, int argc, char *argv[]); +handle_moveid(Client *client, int argc, char *argv[]); enum command_return -handle_swap(struct client *client, int argc, char *argv[]); +handle_swap(Client *client, int argc, char *argv[]); enum command_return -handle_swapid(struct client *client, int argc, char *argv[]); +handle_swapid(Client *client, int argc, char *argv[]); #endif diff --git a/src/QueuePrint.cxx b/src/QueuePrint.cxx index de2df5531..bd49f92ec 100644 --- a/src/QueuePrint.cxx +++ b/src/QueuePrint.cxx @@ -38,7 +38,7 @@ extern "C" { * @param end the index of the last song (excluding) */ static void -queue_print_song_info(struct client *client, const struct queue *queue, +queue_print_song_info(Client *client, const struct queue *queue, unsigned position) { song_print_info(client, queue_get(queue, position)); @@ -51,7 +51,7 @@ queue_print_song_info(struct client *client, const struct queue *queue, } void -queue_print_info(struct client *client, const struct queue *queue, +queue_print_info(Client *client, const struct queue *queue, unsigned start, unsigned end) { assert(start <= end); @@ -62,7 +62,7 @@ queue_print_info(struct client *client, const struct queue *queue, } void -queue_print_uris(struct client *client, const struct queue *queue, +queue_print_uris(Client *client, const struct queue *queue, unsigned start, unsigned end) { assert(start <= end); @@ -75,7 +75,7 @@ queue_print_uris(struct client *client, const struct queue *queue, } void -queue_print_changes_info(struct client *client, const struct queue *queue, +queue_print_changes_info(Client *client, const struct queue *queue, uint32_t version) { for (unsigned i = 0; i < queue_length(queue); i++) { @@ -85,7 +85,7 @@ queue_print_changes_info(struct client *client, const struct queue *queue, } void -queue_print_changes_position(struct client *client, const struct queue *queue, +queue_print_changes_position(Client *client, const struct queue *queue, uint32_t version) { for (unsigned i = 0; i < queue_length(queue); i++) @@ -95,7 +95,7 @@ queue_print_changes_position(struct client *client, const struct queue *queue, } void -queue_find(struct client *client, const struct queue *queue, +queue_find(Client *client, const struct queue *queue, const SongFilter &filter) { for (unsigned i = 0; i < queue_length(queue); i++) { diff --git a/src/QueuePrint.hxx b/src/QueuePrint.hxx index 808b8dec1..6b3a29fb6 100644 --- a/src/QueuePrint.hxx +++ b/src/QueuePrint.hxx @@ -27,28 +27,28 @@ #include -struct client; struct queue; class SongFilter; +class Client; void -queue_print_info(struct client *client, const struct queue *queue, +queue_print_info(Client *client, const struct queue *queue, unsigned start, unsigned end); void -queue_print_uris(struct client *client, const struct queue *queue, +queue_print_uris(Client *client, const struct queue *queue, unsigned start, unsigned end); void -queue_print_changes_info(struct client *client, const struct queue *queue, +queue_print_changes_info(Client *client, const struct queue *queue, uint32_t version); void -queue_print_changes_position(struct client *client, const struct queue *queue, +queue_print_changes_position(Client *client, const struct queue *queue, uint32_t version); void -queue_find(struct client *client, const struct queue *queue, +queue_find(Client *client, const struct queue *queue, const SongFilter &filter); #endif diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx index 7b3bde2bc..c56e54d8b 100644 --- a/src/SongPrint.cxx +++ b/src/SongPrint.cxx @@ -31,7 +31,7 @@ extern "C" { } void -song_print_uri(struct client *client, struct song *song) +song_print_uri(Client *client, struct song *song) { if (song_in_database(song) && !song->parent->IsRoot()) { client_printf(client, "%s%s/%s\n", SONG_FILE, @@ -52,7 +52,7 @@ song_print_uri(struct client *client, struct song *song) } void -song_print_info(struct client *client, struct song *song) +song_print_info(Client *client, struct song *song) { song_print_uri(client, song); diff --git a/src/SongPrint.hxx b/src/SongPrint.hxx index 22a77d4af..49f9478be 100644 --- a/src/SongPrint.hxx +++ b/src/SongPrint.hxx @@ -20,13 +20,13 @@ #ifndef MPD_SONG_PRINT_HXX #define MPD_SONG_PRINT_HXX -struct client; struct song; +class Client; void -song_print_info(struct client *client, struct song *song); +song_print_info(Client *client, struct song *song); void -song_print_uri(struct client *client, struct song *song); +song_print_uri(Client *client, struct song *song); #endif diff --git a/src/Stats.cxx b/src/Stats.cxx index e3d906915..f96bcf177 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -66,7 +66,7 @@ void stats_update(void) } void -stats_print(struct client *client) +stats_print(Client *client) { client_printf(client, "artists: %u\n" diff --git a/src/StickerCommands.cxx b/src/StickerCommands.cxx index dbd97ce21..d13647c33 100644 --- a/src/StickerCommands.cxx +++ b/src/StickerCommands.cxx @@ -33,7 +33,7 @@ #include struct sticker_song_find_data { - struct client *client; + Client *client; const char *name; }; @@ -49,7 +49,7 @@ sticker_song_find_print_cb(struct song *song, const char *value, } static enum command_return -handle_sticker_song(struct client *client, int argc, char *argv[]) +handle_sticker_song(Client *client, int argc, char *argv[]) { GError *error = nullptr; const Database *db = GetDatabase(&error); @@ -156,7 +156,7 @@ handle_sticker_song(struct client *client, int argc, char *argv[]) } enum command_return -handle_sticker(struct client *client, int argc, char *argv[]) +handle_sticker(Client *client, int argc, char *argv[]) { assert(argc >= 4); diff --git a/src/StickerCommands.hxx b/src/StickerCommands.hxx index c253d0bb7..840bd33d5 100644 --- a/src/StickerCommands.hxx +++ b/src/StickerCommands.hxx @@ -22,7 +22,9 @@ #include "command.h" +class Client; + enum command_return -handle_sticker(struct client *client, int argc, char *argv[]); +handle_sticker(Client *client, int argc, char *argv[]); #endif diff --git a/src/StickerPrint.cxx b/src/StickerPrint.cxx index 6a14620e0..1708ee4f0 100644 --- a/src/StickerPrint.cxx +++ b/src/StickerPrint.cxx @@ -23,7 +23,7 @@ #include "Client.hxx" void -sticker_print_value(struct client *client, +sticker_print_value(Client *client, const char *name, const char *value) { client_printf(client, "sticker: %s=%s\n", name, value); @@ -32,13 +32,13 @@ sticker_print_value(struct client *client, static void print_sticker_cb(const char *name, const char *value, void *data) { - struct client *client = (struct client *)data; + Client *client = (Client *)data; sticker_print_value(client, name, value); } void -sticker_print(struct client *client, const struct sticker *sticker) +sticker_print(Client *client, const struct sticker *sticker) { sticker_foreach(sticker, print_sticker_cb, client); } diff --git a/src/StickerPrint.hxx b/src/StickerPrint.hxx index 99573d237..27225a494 100644 --- a/src/StickerPrint.hxx +++ b/src/StickerPrint.hxx @@ -21,19 +21,18 @@ #define MPD_STICKER_PRINT_HXX struct sticker; -struct client; +class Client; /** * Sends one sticker value to the client. */ void -sticker_print_value(struct client *client, - const char *name, const char *value); +sticker_print_value(Client *client, const char *name, const char *value); /** * Sends all sticker values to the client. */ void -sticker_print(struct client *client, const struct sticker *sticker); +sticker_print(Client *client, const struct sticker *sticker); #endif diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx index ef05b6c14..5a5dbbeff 100644 --- a/src/TagPrint.cxx +++ b/src/TagPrint.cxx @@ -24,7 +24,7 @@ #include "song.h" #include "Client.hxx" -void tag_print_types(struct client *client) +void tag_print_types(Client *client) { int i; @@ -35,7 +35,7 @@ void tag_print_types(struct client *client) } } -void tag_print(struct client *client, const struct tag *tag) +void tag_print(Client *client, const struct tag *tag) { if (tag->time >= 0) client_printf(client, SONG_TIME "%i\n", tag->time); diff --git a/src/TagPrint.hxx b/src/TagPrint.hxx index 861f84441..99e1d0850 100644 --- a/src/TagPrint.hxx +++ b/src/TagPrint.hxx @@ -21,10 +21,10 @@ #define MPD_TAG_PRINT_HXX struct tag; -struct client; +class Client; -void tag_print_types(struct client *client); +void tag_print_types(Client *client); -void tag_print(struct client *client, const struct tag *tag); +void tag_print(Client *client, const struct tag *tag); #endif diff --git a/src/TimePrint.cxx b/src/TimePrint.cxx index 208b20e6e..c5247dd9d 100644 --- a/src/TimePrint.cxx +++ b/src/TimePrint.cxx @@ -24,7 +24,7 @@ #include void -time_print(struct client *client, const char *name, time_t t) +time_print(Client *client, const char *name, time_t t) { #ifdef G_OS_WIN32 const struct tm *tm2 = gmtime(&t); diff --git a/src/TimePrint.hxx b/src/TimePrint.hxx index 07e1d301c..f45101256 100644 --- a/src/TimePrint.hxx +++ b/src/TimePrint.hxx @@ -22,12 +22,12 @@ #include -struct client; +class Client; /** * Write a line with a time stamp to the client. */ void -time_print(struct client *client, const char *name, time_t t); +time_print(Client *client, const char *name, time_t t); #endif diff --git a/src/ls.cxx b/src/ls.cxx index 9f81747a6..9bb56c898 100644 --- a/src/ls.cxx +++ b/src/ls.cxx @@ -78,7 +78,7 @@ void print_supported_uri_schemes_to_fp(FILE *fp) fprintf(fp,"\n"); } -void print_supported_uri_schemes(struct client *client) +void print_supported_uri_schemes(Client *client) { const char **prefixes = remoteUrlPrefixes; diff --git a/src/ls.hxx b/src/ls.hxx index 004bd2f8e..8ae5a58fd 100644 --- a/src/ls.hxx +++ b/src/ls.hxx @@ -20,10 +20,9 @@ #ifndef MPD_LS_HXX #define MPD_LS_HXX -#include #include -struct client; +class Client; /** * Checks whether the scheme of the specified URI is supported by MPD. @@ -36,7 +35,7 @@ bool uri_supported_scheme(const char *url); * Send a list of supported URI schemes to the client. This is the * response to the "urlhandlers" command. */ -void print_supported_uri_schemes(struct client *client); +void print_supported_uri_schemes(Client *client); /** * Send a list of supported URI schemes to a file pointer. diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx index a92809224..0ab19f7d4 100644 --- a/src/protocol/ArgParser.cxx +++ b/src/protocol/ArgParser.cxx @@ -25,7 +25,7 @@ #include bool -check_uint32(struct client *client, uint32_t *dst, const char *s) +check_uint32(Client *client, uint32_t *dst, const char *s) { char *test; @@ -39,7 +39,7 @@ check_uint32(struct client *client, uint32_t *dst, const char *s) } bool -check_int(struct client *client, int *value_r, const char *s) +check_int(Client *client, int *value_r, const char *s) { char *test; long value; @@ -64,7 +64,7 @@ check_int(struct client *client, int *value_r, const char *s) } bool -check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, +check_range(Client *client, unsigned *value_r1, unsigned *value_r2, const char *s) { char *test, *test2; @@ -134,7 +134,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, } bool -check_unsigned(struct client *client, unsigned *value_r, const char *s) +check_unsigned(Client *client, unsigned *value_r, const char *s) { unsigned long value; char *endptr; @@ -157,7 +157,7 @@ check_unsigned(struct client *client, unsigned *value_r, const char *s) } bool -check_bool(struct client *client, bool *value_r, const char *s) +check_bool(Client *client, bool *value_r, const char *s) { long value; char *endptr; @@ -174,7 +174,7 @@ check_bool(struct client *client, bool *value_r, const char *s) } bool -check_float(struct client *client, float *value_r, const char *s) +check_float(Client *client, float *value_r, const char *s) { float value; char *endptr; diff --git a/src/protocol/ArgParser.hxx b/src/protocol/ArgParser.hxx index 73b046403..b6feb3e67 100644 --- a/src/protocol/ArgParser.hxx +++ b/src/protocol/ArgParser.hxx @@ -25,25 +25,25 @@ #include #include -struct client; +class Client; bool -check_uint32(struct client *client, uint32_t *dst, const char *s); +check_uint32(Client *client, uint32_t *dst, const char *s); bool -check_int(struct client *client, int *value_r, const char *s); +check_int(Client *client, int *value_r, const char *s); bool -check_range(struct client *client, unsigned *value_r1, unsigned *value_r2, +check_range(Client *client, unsigned *value_r1, unsigned *value_r2, const char *s); bool -check_unsigned(struct client *client, unsigned *value_r, const char *s); +check_unsigned(Client *client, unsigned *value_r, const char *s); bool -check_bool(struct client *client, bool *value_r, const char *s); +check_bool(Client *client, bool *value_r, const char *s); bool -check_float(struct client *client, float *value_r, const char *s); +check_float(Client *client, float *value_r, const char *s); #endif diff --git a/src/protocol/Result.cxx b/src/protocol/Result.cxx index f38c33815..e10a731cc 100644 --- a/src/protocol/Result.cxx +++ b/src/protocol/Result.cxx @@ -27,13 +27,13 @@ const char *current_command; int command_list_num; void -command_success(struct client *client) +command_success(Client *client) { client_puts(client, "OK\n"); } void -command_error_v(struct client *client, enum ack error, +command_error_v(Client *client, enum ack error, const char *fmt, va_list args) { assert(client != NULL); @@ -48,7 +48,7 @@ command_error_v(struct client *client, enum ack error, } void -command_error(struct client *client, enum ack error, const char *fmt, ...) +command_error(Client *client, enum ack error, const char *fmt, ...) { va_list args; va_start(args, fmt); diff --git a/src/protocol/Result.hxx b/src/protocol/Result.hxx index 68cb84945..99d9a2fa0 100644 --- a/src/protocol/Result.hxx +++ b/src/protocol/Result.hxx @@ -24,20 +24,20 @@ #include "gcc.h" #include "ack.h" -struct client; +class Client; extern const char *current_command; extern int command_list_num; void -command_success(struct client *client); +command_success(Client *client); void -command_error_v(struct client *client, enum ack error, +command_error_v(Client *client, enum ack error, const char *fmt, va_list args); gcc_fprintf_ void -command_error(struct client *client, enum ack error, const char *fmt, ...); +command_error(Client *client, enum ack error, const char *fmt, ...); #endif diff --git a/src/stats.h b/src/stats.h index adb1c3443..eb723bcf3 100644 --- a/src/stats.h +++ b/src/stats.h @@ -22,7 +22,7 @@ #include -struct client; +class Client; struct stats { GTimer *timer; @@ -50,6 +50,6 @@ void stats_global_finish(void); void stats_update(void); void -stats_print(struct client *client); +stats_print(Client *client); #endif -- cgit v1.2.3